List an order's fiscal requests
curl --request GET \
--url https://api.example.com/api/v1/external/fiscal/numberingimport requests
url = "https://api.example.com/api/v1/external/fiscal/numbering"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/v1/external/fiscal/numbering', 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.example.com/api/v1/external/fiscal/numbering",
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.example.com/api/v1/external/fiscal/numbering"
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.example.com/api/v1/external/fiscal/numbering")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/external/fiscal/numbering")
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{
"success": true,
"data": {
"items": [
{
"fiscalRequestId": "9afef543-56ce-4911-a92e-5908366fa980",
"orderCode": "EC-K004-42-1786579046934",
"countryCode": "EC",
"requestStatus": "GENERATED",
"documentStatus": "AUTHORIZED",
"document": {
"documentType": "SALE_INVOICE",
"documentNumber": "005-004-000000045"
},
"failure": null
},
{
"fiscalRequestId": "c1d9e0a2-77b4-4f10-9f3e-2b0c5d6a1e88",
"orderCode": "EC-K004-42-1786579046934",
"countryCode": "EC",
"requestStatus": "GENERATED",
"documentStatus": "AUTHORIZED",
"document": {
"documentType": "CREDIT_NOTE",
"documentNumber": "005-004-000000046",
"compensates": { "documentNumber": "005-004-000000045" }
},
"failure": null
}
]
}
}
{
"success": true,
"data": { "items": [] }
}
API
List an order's fiscal requests
Search numbering requests by order code, access key or status. An order can have more than one document.
GET
/
api
/
v1
/
external
/
fiscal
/
numbering
List an order's fiscal requests
curl --request GET \
--url https://api.example.com/api/v1/external/fiscal/numberingimport requests
url = "https://api.example.com/api/v1/external/fiscal/numbering"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/v1/external/fiscal/numbering', 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.example.com/api/v1/external/fiscal/numbering",
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.example.com/api/v1/external/fiscal/numbering"
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.example.com/api/v1/external/fiscal/numbering")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/external/fiscal/numbering")
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{
"success": true,
"data": {
"items": [
{
"fiscalRequestId": "9afef543-56ce-4911-a92e-5908366fa980",
"orderCode": "EC-K004-42-1786579046934",
"countryCode": "EC",
"requestStatus": "GENERATED",
"documentStatus": "AUTHORIZED",
"document": {
"documentType": "SALE_INVOICE",
"documentNumber": "005-004-000000045"
},
"failure": null
},
{
"fiscalRequestId": "c1d9e0a2-77b4-4f10-9f3e-2b0c5d6a1e88",
"orderCode": "EC-K004-42-1786579046934",
"countryCode": "EC",
"requestStatus": "GENERATED",
"documentStatus": "AUTHORIZED",
"document": {
"documentType": "CREDIT_NOTE",
"documentNumber": "005-004-000000046",
"compensates": { "documentNumber": "005-004-000000045" }
},
"failure": null
}
]
}
}
{
"success": true,
"data": { "items": [] }
}
Returns
The tenant comes from the key. You only see requests from your own account.
items[] with the same contract as
POST /numbering, one entry per request.
It is an array and not a single object for a concrete reason: an order can have
two documents — the invoice and the credit note that offsets it. If you assume
there is only one, the day a sale gets voided you will read the wrong document.
This is the one you use when you lost the response. The
orderCode is the
only thing you certainly hold: you chose it yourself before numbering. The
fiscalRequestId is something we returned to you, so if the network dropped you
do not have it.Authentication
| Header | x-api-key: pk_live_… |
| Scope | fiscal:write |
Query parameters
string
The order code the sale was numbered with. This is the filter you will use 99% of
the time.
string
The authority’s access key (
claveAcceso in Ecuador). Useful for the reverse
path: you have the number printed on a ticket and want to know which order it
came from.string
Filter by how the numbering act ended. One of:
REQUESTED, GENERATED,
PENDING, FAILED_RETRYABLE, FAILED_FINAL, UNAVAILABLE.string
Filter by the authority’s verdict. One of:
PENDING, AUTHORIZED, REJECTED,
CANCELLED.integer
default:"1"
Page, starting at 1.
integer
default:"20"
Results per page. Between 1 and 100.
For reconciliation, do not filter by
documentStatus. A sale whose numbering
failed never gets a verdict from the authority, so filtering by AUTHORIZED
leaves it out of the report — and that is precisely the one you need to look at.
Filter by orderCode and branch on requestStatus on your side.Response
{
"success": true,
"data": {
"items": [
{
"fiscalRequestId": "9afef543-56ce-4911-a92e-5908366fa980",
"orderCode": "EC-K004-42-1786579046934",
"countryCode": "EC",
"requestStatus": "GENERATED",
"documentStatus": "AUTHORIZED",
"document": {
"documentType": "SALE_INVOICE",
"documentNumber": "005-004-000000045"
},
"failure": null
},
{
"fiscalRequestId": "c1d9e0a2-77b4-4f10-9f3e-2b0c5d6a1e88",
"orderCode": "EC-K004-42-1786579046934",
"countryCode": "EC",
"requestStatus": "GENERATED",
"documentStatus": "AUTHORIZED",
"document": {
"documentType": "CREDIT_NOTE",
"documentNumber": "005-004-000000046",
"compensates": { "documentNumber": "005-004-000000045" }
},
"failure": null
}
]
}
}
{
"success": true,
"data": { "items": [] }
}
An order that was not numbered returns
items: [], not a 404. That is not
an error: it is the correct answer to “which documents does this order have?”
when it has none.Errors
| Code | When |
|---|---|
400 | No usable filter, or a value outside the enum |
401 | The API key is missing, unknown or revoked |
403 | The key lacks the fiscal:write scope |
Related
- Request fiscal numbering — the
POSTthat creates it - Get a fiscal request — when you have the
fiscalRequestId - Fiscal integration guide — the full end-to-end flow

