curl --request POST \
--url https://api.sandbox.tesouro.com/finops/v1/receivables/export \
--header 'Authorization: Bearer <token>' \
--header 'x-finops-version: <x-finops-version>' \
--header 'x-organization-id: <x-organization-id>'import requests
url = "https://api.sandbox.tesouro.com/finops/v1/receivables/export"
headers = {
"x-finops-version": "<x-finops-version>",
"x-organization-id": "<x-organization-id>",
"Authorization": "Bearer <token>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-finops-version': '<x-finops-version>',
'x-organization-id': '<x-organization-id>',
Authorization: 'Bearer <token>'
}
};
fetch('https://api.sandbox.tesouro.com/finops/v1/receivables/export', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.tesouro.com/finops/v1/receivables/export",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"x-finops-version: <x-finops-version>",
"x-organization-id: <x-organization-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.tesouro.com/finops/v1/receivables/export"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("x-finops-version", "<x-finops-version>")
req.Header.Add("x-organization-id", "<x-organization-id>")
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sandbox.tesouro.com/finops/v1/receivables/export")
.header("x-finops-version", "<x-finops-version>")
.header("x-organization-id", "<x-organization-id>")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.tesouro.com/finops/v1/receivables/export")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-finops-version"] = '<x-finops-version>'
request["x-organization-id"] = '<x-organization-id>'
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"ctx": {},
"input": "<unknown>"
}
]
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}Export receivables
Start a CSV export of the invoices that match the given filters.
The export accepts the same query parameters as GET /receivables (filters, sort and order), so the current list query can be sent unchanged; limit and pagination_token are ignored. Only invoices are exported: type must be omitted or invoice. The file holds one row per line item (an invoice without line items is one row) and may contain at most 100000 rows.
The export runs in the background. Poll GET /data-exports/{id} for its status and, once it has succeeded, GET /data-exports/{id}/download for a download link. Dates are in UTC.
curl --request POST \
--url https://api.sandbox.tesouro.com/finops/v1/receivables/export \
--header 'Authorization: Bearer <token>' \
--header 'x-finops-version: <x-finops-version>' \
--header 'x-organization-id: <x-organization-id>'import requests
url = "https://api.sandbox.tesouro.com/finops/v1/receivables/export"
headers = {
"x-finops-version": "<x-finops-version>",
"x-organization-id": "<x-organization-id>",
"Authorization": "Bearer <token>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-finops-version': '<x-finops-version>',
'x-organization-id': '<x-organization-id>',
Authorization: 'Bearer <token>'
}
};
fetch('https://api.sandbox.tesouro.com/finops/v1/receivables/export', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.tesouro.com/finops/v1/receivables/export",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"x-finops-version: <x-finops-version>",
"x-organization-id: <x-organization-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.tesouro.com/finops/v1/receivables/export"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("x-finops-version", "<x-finops-version>")
req.Header.Add("x-organization-id", "<x-organization-id>")
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sandbox.tesouro.com/finops/v1/receivables/export")
.header("x-finops-version", "<x-finops-version>")
.header("x-organization-id", "<x-organization-id>")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.tesouro.com/finops/v1/receivables/export")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-finops-version"] = '<x-finops-version>'
request["x-organization-id"] = '<x-organization-id>'
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"ctx": {},
"input": "<unknown>"
}
]
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
The ID of the entity that owns the requested resource.
"9d2b4c8f-2087-4738-ba91-7359683c49a4"
Query Parameters
The field to sort the results by. Typically used together with the order parameter.
counterpart_name, counterpart_id, amount, total_amount, discounted_subtotal, status, due_date, issue_date, document_id, created_at, project_id Sort order (ascending by default). Typically used together with the sort parameter.
asc, desc Return only receivables with the specified IDs. Valid but nonexistent IDs do not raise errors but produce no results.
To specify multiple IDs, repeat this parameter for each value:
id__in=<id1>&id__in=<id2>
Return only receivables created for the counterparts with the specified IDs.
To specify multiple IDs, repeat this parameter for each value:
counterpart_id__in=<id1>&counterpart_id__in=<id2>
Valid but nonexistent IDs do not raise errors but produce no results.
Return only receivables that have the specified statuses. See the applicable invoice statuses, quote statuses, and credit note statuses.
To specify multiple statuses, repeat this parameter for each value:
status__in=draft&status__in=issued
draft, issued, failed, accepted, expired, declined, recurring, partially_paid, paid, overdue, uncollectible, canceled Return only receivables created by the entity users with the specified IDs.To specify multiple user IDs, repeat this parameter for each ID:
entity_user_id__in=<user1>&entity_user_id__in=<user2>
If the request is authenticated using an entity user token, this user must have the receivable.read.allowed (rather than allowed_for_own) permission to be able to query receivables created by other users.
IDs of deleted users will still produce results here if those users had associated receivables. Valid but nonexistent user IDs do not raise errors but produce no results.
Return only receivables whose tags include at least one of the tags with the specified IDs.
For example, given receivables with the following tags:
- tagA
- tagB
- tagA, tagB
- tagC
- tagB, tagC
tag_ids__in=<tagA>&tag_ids__in=<tagB> will return receivables 1, 2, 3, and 5.
Valid but nonexistent tag IDs do not raise errors but produce no results.
Return only receivables whose tags include all of the tags with the specified IDs and optionally other tags that are not specified.
For example, given receivables with the following tags:
- tagA
- tagB
- tagA, tagB
- tagC
- tagA, tagB, tagC
tag_ids=<tagA>&tag_ids=<tagB> will return receivables 3 and 5.
Return only receivables whose line items include at least one of the product IDs with the specified IDs.
To specify multiple product IDs, repeat this parameter for each ID:
product_ids__in=<product1>&product_ids__in=<product2>
For example, given receivables with the following product IDs:
- productA
- productB
- productA, productB
- productC
- productB, productC
product_ids__in=<productA>&product_ids__in=<productB> will return receivables 1, 2, 3, and 5.Valid but nonexistent product IDs do not raise errors but produce no results.
Return only receivables whose line items include all of the product IDs with the specified IDs and optionally other products that are not specified.
To specify multiple product IDs, repeat this parameter for each ID:
product_ids=<product1>&product_ids=<product2>
For example, given receivables with the following product IDs:
- productA
- productB
- productA, productB
- productC
- productA, productB, productC
product_ids=<productA>&product_ids=<productB> will return receivables 3 and 5.
Return only receivables whose project_id include at least one of the project_id with the specified IDs. Valid but nonexistent project IDs do not raise errors but produce no results.
quote, invoice, credit_note INTERNAL, EXTERNAL, BANK_DETAILS draft, issued, failed, accepted, expired, declined, recurring, partially_paid, paid, overdue, uncollectible, canceled Response
Successful Response
The ID of the created export. Poll GET /data-exports/{id} for its status and download link.
Was this page helpful?