curl --request GET \
--url https://api.billing.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/invoices/exportimport requests
url = "https://api.billing.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/invoices/export"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.billing.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/invoices/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.billing.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/invoices/export",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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.billing.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/invoices/export"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.billing.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/invoices/export")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.billing.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/invoices/export")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body"<string>"{
"traceId": "1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b",
"code": "INSUFFICIENT_PERMISSIONS",
"origin": "BILLING",
"message": "insufficient permissions"
}{
"traceId": "1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b",
"code": "EXPORT_TOO_LARGE",
"origin": "BILLING",
"message": "This export is too large to generate in a single request. Narrow the filters (for example a shorter date range) and try again."
}Export invoices
Exports the invoices your organization issued as a CSV or XLSX file.
curl --request GET \
--url https://api.billing.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/invoices/exportimport requests
url = "https://api.billing.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/invoices/export"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.billing.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/invoices/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.billing.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/invoices/export",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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.billing.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/invoices/export"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.billing.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/invoices/export")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.billing.v2.portao3.com.br/realms/{realmId}/organizations/{organizationId}/invoices/export")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body"<string>"{
"traceId": "1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b",
"code": "INSUFFICIENT_PERMISSIONS",
"origin": "BILLING",
"message": "insufficient permissions"
}{
"traceId": "1-68ee2a1b-3c4d5e6f7a8b9c0d1e2f3a4b",
"code": "EXPORT_TOO_LARGE",
"origin": "BILLING",
"message": "This export is too large to generate in a single request. Narrow the filters (for example a shorter date range) and try again."
}contractId and dealId, to export one contract’s or one deal’s invoices — one per row, with six columns whose headers are in Portuguese: Descrição (the description, or the deal’s), Cliente (the payer’s name), Quantidade (the installment, as 1/12, or Única), Data de Vencimento (the due date, as DD/MM/YYYY, UTC), Status (the displayStatus, in Portuguese) and Valor (the invoice amount, in centavos). When no invoice matches, the file has the header and one empty row.
?type=csv answers a UTF-8 CSV file; ?type=xlsx an Excel workbook, base64-encoded. An export is limited to 50,000 invoices and 4 MiB: narrow the filters to export more. Any member of the organization, or an admin of the realm, can export them.Path Parameters
ID of your realm.
Format: UUID
ID of your organization: the one whose invoices you export.
Format: UUID
Query Parameters
Format of the exported file.
csv, xlsx How an xlsx file is encoded in the response body: always base64, the default. A csv file is always sent as plain text.
base64 Only invoices in these stored statuses (OPEN, CLOSED, PAID, CANCELED). Repeat the parameter or separate values with commas.
Example (comma-separated list): ?status=CLOSED,PAID
OPEN, CLOSED, PAID, CANCELED Only invoices whose payer (the debit party) has one of these CPF/CNPJ documents, digits only (exact match).
Example (comma-separated list): ?debitPartyDocuments=11144477735,39053344705
32Only invoices whose payer (the debit party) pays from a Portão 3 wallet of one of these organizations. It matches the organization of the payer's wallet, so a payer with no wallet (a customer who pays by boleto or PIX, for example) is not found by it: filter by debitPartyDocuments instead.
Format: UUID
Example: ?debitPartyOrgIds=5e0a1c2b-3d4f-4a6b-8c9d-0e1f2a3b4c5d
Only invoices whose deal has one of these charge types (SINGLE, RECURRENT, SUBSCRIPTION).
Example: ?chargeType=SINGLE
SINGLE, RECURRENT, SUBSCRIPTION Only invoices of this contract.
Format: UUID
Only invoices of this deal.
Format: UUID
Only invoices whose name contains this text (case-insensitive).
250Only invoices due on or after this moment, inclusive (ISO 8601 date or date-time).
Only invoices due on or before this moment, inclusive (ISO 8601 date or date-time).
Sort direction. Case-insensitive.
ASC, DESC Field to sort the invoices by.
createdAt, dueAt, closingAt, description, status, amount, invoiceNumber Response
application/csv — The invoices as a UTF-8 CSV file, when type is csv.
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet — The Excel workbook, base64-encoded, when type is xlsx.
The invoices as a UTF-8 CSV file, when type is csv.