curl --request POST \
--url https://api.sandbox.tesouro.com/finops/v1/payables/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/payables/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/payables/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/payables/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/payables/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/payables/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/payables/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 payables
Start a CSV export of the payables that match the given filters.
The export accepts the same query parameters as GET /payables (filters, sort and order), so the
current list query can be sent unchanged; limit and pagination_token are ignored. The file holds
one row per line item (a payable 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/payables/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/payables/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/payables/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/payables/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/payables/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/payables/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/payables/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.
id, created_at, updated_at, issued_at, due_date, amount, status, document_id, currency, counterpart_name, scheduled_payment_date Sort order (ascending by default). Typically used together with the sort parameter.
asc, desc Split payables in approve_in_progress by whether an approval request is waiting on the current user: mine keeps those waiting on the user, others keeps the rest, including payables the user could only force approve. Payables in any other status are returned as usual. Not stored in the pagination token, so send it again with every page.
mine, others Return only payables created after the specified date and time. The value must be in the ISO 8601 format YYYY-MM-DDThh:mm[:ss[.ffffff]][Z|±hh:mm].
Return only payables created before the specified date and time.
Return only payables created on or after the specified date and time.
Return only payables created before or on the specified date and time.
Return only payables that have the specified statuses.
To specify multiple statuses, repeat this parameter for each value: status__in=draft&status__in=new
draft, new, approve_in_progress, waiting_to_be_paid, partially_paid, paid, canceled, rejected Return only payables with 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 payables with the exact specified total amount. The amount must be specified in the minor units of currency. For example, $12.5 is represented as 1250.
Return only payables whose total amount (in minor units) exceeds the specified value.
Return only payables whose total amount (in minor units) is less than the specified value.
Return only payables whose total amount (in minor units) is greater than or equal to the specified value.
Return only payables whose total amount (in minor units) is less than or equal to the specified value.
Return only payables with the specified amount.
Return only payables whose amount (in minor units) exceeds the specified value.
Return only payables whose amount (in minor units) is less than the specified value.
Return only payables whose amount (in minor units) is greater than or equal to the specified value.
Return only payables whose amount (in minor units) is less than or equal to the specified value.
Return only payables that use the specified currency.
AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHF, CLP, CNY, COP, CRC, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HTG, HUF, IDR, ILS, INR, IQD, ISK, JMD, JOD, JPY, KES, KGS, KHR, KMF, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MUR, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SEK, SGD, SHP, SLE, SOS, SRD, SSP, SVC, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW Return only payables received from counterparts with the specified name (exact match, case-sensitive).
For counterparts of type = individual, the full name is formatted as first_name last_name.
Return only payables received from counterparts whose name contains the specified string (case-sensitive).
Return only payables received from counterparts whose name contains the specified string (case-insensitive).
Apply the icontains condition to search for the specified text in the document_id and counterpart_name fields in the payables.
Return payables that are due on the specified date (YYYY-MM-DD)
Return payables that are due after the specified date (exclusive, YYYY-MM-DD).
Return payables that are due before the specified date (exclusive, YYYY-MM-DD).
Return payables that are due on or after the specified date (YYYY-MM-DD).
Return payables that are due before or on the specified date (YYYY-MM-DD).
Return payables that are issued at the specified date (YYYY-MM-DD)
Return payables that are issued after the specified date (exclusive, YYYY-MM-DD).
Return payables that are issued before the specified date (exclusive, YYYY-MM-DD).
Return payables that are issued on or after the specified date (YYYY-MM-DD).
Return payables that are issued before or on the specified date (YYYY-MM-DD).
Return a payable with the exact specified document number (case-sensitive).
The document_id is the user-facing document number such as INV-00042, not to be confused with the payable ID (id).
Return only payables whose document number (document_id) contains the specified string (case-sensitive).
Return only payables whose document number (document_id) contains the specified string (case-insensitive).
Return only payables created by the entity user with the specified ID.
Return only payables received from the counterpart with the specified ID.
Counterparts that have been deleted but have associated payables will still return results here because the payables contain a frozen copy of the counterpart data.
If the specified counterpart ID does not exist and never existed, no results are returned.
Return only payables received from the counterparts 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: counterpart_id__in=<id1>&counterpart_id__in=<id2>
Return only payables coming from the specified source.
ocr, user_specified Return only payables with specific OCR statuses.
processing, error, success, canceled Search for a payable by the identifier of the line item associated with it.
Search for a payable by the identifier of the purchase order associated with it.
Return only payables assigned to the project with the specified ID.
Valid but nonexistent project IDs do not raise errors but return no results.
Return only payables 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.
Return only payables whose tags include at least one of the tags with the specified IDs. Valid but nonexistent tag IDs do not raise errors but produce no results.
Return only payables whose tags do not include any of the tags with the specified IDs. Valid but nonexistent tag IDs do not raise errors but produce the results.
Filter objects based on whether they have tags. If true, only objects with tags are returned. If false, only objects without tags are returned.
Return only payables from a given origin ['upload', 'email']
upload, email Return only payables with or without attachments (files)
Return payables with a live scheduled payment (see scheduled_payment_date on the response) on the specified date (YYYY-MM-DD).
Return only payables whose scheduled payment date is after the specified date (exclusive, YYYY-MM-DD).
Return only payables whose scheduled payment date is before the specified date (exclusive, YYYY-MM-DD).
Return only payables whose scheduled payment date is on or after the specified date (YYYY-MM-DD).
Return only payables whose scheduled payment date is before or on the specified date (YYYY-MM-DD).
Filter payables based on whether they have a live scheduled payment. If true, only payables with a non-null scheduled_payment_date are returned. If false, only payables with no live scheduled payment are returned.
Return only payables that have at least one duplicate match with this review status. Unless duplicate_matched_payable_status(__in/__not_in) is also given, this excludes matches whose other payable is cancelled - see duplicate_matched_payable_status__in.
suspected, dismissed, confirmed Return only payables that have at least one duplicate match with any of these review statuses.
suspected, dismissed, confirmed Return only payables that have at least one duplicate match with a review status other than these. For example, duplicate_match_status__not_in=dismissed returns payables with an unreviewed or confirmed duplicate.
suspected, dismissed, confirmed Return only payables that have a duplicate match whose other payable is in this status.
draft, new, approve_in_progress, waiting_to_be_paid, partially_paid, paid, canceled, rejected Return only payables that have a duplicate match whose other payable is in any of these statuses. Pass this explicitly (e.g. =canceled) to see a match a bare duplicate_match_status filter would otherwise hide.
draft, new, approve_in_progress, waiting_to_be_paid, partially_paid, paid, canceled, rejected Return only payables that have a duplicate match whose other payable is NOT in any of these statuses. Combined duplicate_* filters apply to the same match.
draft, new, approve_in_progress, waiting_to_be_paid, partially_paid, paid, canceled, rejected Response
Successful Response
The ID of the created export. Poll GET /data-exports/{id} for its status and download link.
Was this page helpful?