Skip to content
Concepts

FISCALISTO / API

Expanding objects

Ask with expand[] for other objects' ids to come as those objects, in the same answer, without one more call for each.

Open in ChatGPTOpen in ClaudeOpen in Cursor

Many objects keep another's id: an invoice has its issuer and its recurring_invoice, a recurring invoice its last_invoice, a ticket its invoice. With expand[] that id comes as the whole object, in the same answer:

curl "https://api.fiscalisto.com/v1/invoices/inv_OufpKqnrvx9p1?expand[]=issuer&expand[]=recurring_invoice" \
  -H "Authorization: Bearer $FISCALISTO_API_KEY"
{
  "id": "inv_OufpKqnrvx9p1",
  "object": "invoice",
  "issuer": { "id": "iss_OufpKqnrvx9p", "object": "issuer", "legal_name": "ESCUELA KEMPER URGATE", "…": "…" },
  "recurring_invoice": { "id": "rin_OufpKqnrvx9p1", "object": "recurring_invoice", "…": "…" }
}

Without expand[], ids stay ids.

How to write it

  • One expand[] parameter per field (expand[]=issuer&expand[]=invoice), or several separated by commas (expand=issuer,invoice).
  • Dots go into an expanded object: expand[]=recurring_invoice.last_invoice. Up to 4 levels.
  • In a list, each item is expanded: expand[]=data.issuer, or just expand[]=issuer.
  • Up to 10 fields per request, and up to 200 objects per answer (each id is read once, even if it repeats on the page).
  • It works on GET and on POST: POST /v1/products?expand[]=issuer answers the created product with its issuer.

Any field that keeps another object's id can be expanded (iss_, inv_, cus_, prd_, rin_, quo_, tkt_, btx_, emp_, ret_, bat_, sdl_, sat_, stc_, cdr_, whe_, evt_, sbx_). Each object is read with the same key, as its GET would: a key restricted to some issuers sees nothing outside them.

A field the answer doesn't have, or that isn't another object's id, answers 400 with expand_invalid on a GET. On a POST what you asked for was already done, so the answer comes unexpanded. If the object no longer exists, its id stays. A null field stays null.

In the SDKs

const invoice = await fiscalisto.invoices.get("inv_…", { expand: ["issuer", "recurring_invoice"] });
invoice = fiscalisto.invoices.get("inv_…", expand=["issuer", "recurring_invoice"])
$invoice = $fiscalisto->invoices->get('inv_…', [], ['expand' => ['issuer', 'recurring_invoice']]);

The SDKs' types say the id (issuer: string); with expand the field carries the object. In Go, Java and .NET, which convert each field to its type, read the related object with its own get.

Was this page helpful?