Stable Pro API · v1
Connect invoicing software
From API key to invoice: read charges, reserve amounts, and record documents without duplicates.
Stable Pro provides the data needed for invoicing. Your software issues the documents and sends their references back to Stable Pro. Test the flow in the test environment, with sample data, before using it with real data.
Set up the connection
- The owner opens Settings → API & integrations in Stable Pro, chooses Test environment and creates a connection for your software. They can also invite you as a developer, so that you create it yourself.
- Enable
charges:read,customers:readandexternal-documents:write. If you need customer addresses and tax identifiers, also enablecustomers.fiscal:read. Reconciliation of payments requirespayments:read. - Create a test key
sp_test_…and copy it immediately: Stable Pro shows it only once. Use it withhttps://app.stable-pro.com/api/v1.
When you move to real data, the owner creates a connection in the Live environment, with its own permissions, and an sp_live_… key. The address does not change; the test key keeps reading only the sample data. IDs and cursors saved during testing are not valid in the real stable.
Call GET /connection to check permissions and to learn from sandbox whether you are in the test environment, then GET /organization for the centre's currency, country and time zone.
curl https://app.stable-pro.com/api/v1/connection \
-H "Authorization: Bearer $STABLE_PRO_API_KEY"
Find amounts to invoice
Read GET /charges with covered=false to find charges that still have an amount to invoice, including partially invoiced charges. Narrow the list with accounting_month if needed. Use GET /adjustments with the same filters for adjustments. Do not use invoiced=false: that parameter does not exist, and the request returns 400.
curl "https://app.stable-pro.com/api/v1/charges?accounting_month=2026-11&covered=false&limit=25" \
-H "Authorization: Bearer $STABLE_PRO_API_KEY"
Continue with starting_after until has_more is false. Check amount_to_invoice on the selected charge or adjustment: it is the amount still available for a document. Amounts are integers in the currency's minor units: for EUR, 3500 means €35.00. For a closed month, use month_end only when finalized is true; adjustments from the same month are already included in the charge's closing snapshot.
If tax_calculated_by is external, the connected software must determine tax under the applicable rules. tax_treatment: not_calculated does not mean a zero rate. Recording a document does not change payments in Stable Pro.
Reserve before issuing
In this example, charge 11111111-1111-4111-8111-111111111111 has 3500 minor units left to invoice. Replace the invented identifiers with values read from the API. Use a new Idempotency-Key for this operation.
curl -i https://app.stable-pro.com/api/v1/external-documents/reservations \
-H "Authorization: Bearer $STABLE_PRO_API_KEY" \
-H "Idempotency-Key: 66666666-6666-4666-8666-666666666666" \
-H "Content-Type: application/json" \
-d '{"key":"invoice-demo-001","covers":[{"object":"charge","id":"11111111-1111-4111-8111-111111111111","amount":3500}]}'
A new reservation returns 201 with status: reserved. This sample response follows the schema. Keep the reservation id for the next steps:
{"object":"document_reservation","id":"33333333-3333-4333-8333-333333333333","key":"invoice-demo-001","status":"reserved","connection_id":"44444444-4444-4444-8444-444444444444","customer_id":"22222222-2222-4222-8222-222222222222","covers":[{"object":"charge","id":"11111111-1111-4111-8111-111111111111","amount":3500}],"created_at":"2026-11-20T09:00:00.000Z","sending_at":null,"closed_at":null,"document_id":null,"release_reason":null}
Immediately before asking your software to issue the invoice, call POST /external-documents/reservations/{id}/sending with {} and a new Idempotency-Key. Ask it to issue the invoice only after a 200 response. If the reservation was superseded, 409 reservation_closed means you must stop and reread the amounts.
curl -i https://app.stable-pro.com/api/v1/external-documents/reservations/33333333-3333-4333-8333-333333333333/sending \
-H "Authorization: Bearer $STABLE_PRO_API_KEY" \
-H "Idempotency-Key: 77777777-7777-4777-8777-777777777777" \
-H "Content-Type: application/json" \
-d '{}'
Issue and record the invoice
Your software issues the invoice once, assigns its number and stable identifier, and delivers it to the customer under its own rules. Stable Pro neither issues the invoice nor stores its PDF or XML.
After issuing it, send POST /external-documents with the same covers, the reservation id in reservation_id, and a new Idempotency-Key. external_id must be the document's actual identifier in your software.
curl -i https://app.stable-pro.com/api/v1/external-documents \
-H "Authorization: Bearer $STABLE_PRO_API_KEY" \
-H "Idempotency-Key: 88888888-8888-4888-8888-888888888888" \
-H "Content-Type: application/json" \
-d '{"external_id":"invoice-demo-001","kind":"invoice","number":"FT-2026-001","issue_date":"2026-11-20","currency":"EUR","reservation_id":"33333333-3333-4333-8333-333333333333","covers":[{"object":"charge","id":"11111111-1111-4111-8111-111111111111","amount":3500}]}'
A new record returns 201 with an external_document object and its Stable Pro id. Repeating the same request with the same Idempotency-Key returns 201 again; using a new key with the same external_id and identical data returns 200. Neither creates a duplicate. Save the id for later updates. The reservation becomes completed in the same operation.
Recover from errors
The next action depends on where the flow stopped. Before repeating a call, check the reservation and the document in your connected software.
| Situation | Check | What to do |
|---|---|---|
| Lost response after a Stable Pro request | You do not know whether the reservation or document was recorded. | Repeat the same request with the same body and Idempotency-Key. If a document with the same external_id already exists, Stable Pro does not create another. |
Uncertain outcome after sending | Your software may have issued the document. | Look for it in your software. If it exists, record it with reservation_id. If you cannot establish the outcome, leave the reservation in sending and ask the owner to check. Do not issue again or release the reservation. |
| Issue never requested or definitely rejected | You know the document does not exist. | Call POST /external-documents/reservations/{id}/release with reason: not_sent while the reservation is still reserved, or reason: rejected if your software definitely refused the issue request. |
409 fact_reserved | Another execution has reserved the amount. | Stop. Read reservation_id in the response and check the document's status. Do not issue a second invoice. |
422 | The customer, currency, coverage or another value violates a rule. | Read reason, fetch the charge again and correct the request. Use a new Idempotency-Key for a changed operation. |
429 or 503 | The API tells you when to retry. | Respect Retry-After and repeat the same body with the same key. Do not request another issue from your software. |
A reserved reservation can be superseded before it moves to sending. A sending reservation does not expire automatically: it stays blocked until the document is recorded or its outcome is verified. See Document reservations and Errors for the full rules.
Stay in sync
For the first synchronization, read lists with limit and starting_after, then call GET /events without after. Each event has a data.url: read the object, process it and save next_cursor only after completing the page. Later use GET /events?after=<next_cursor>; treat an event id you have already processed as a harmless duplicate.
External document events require external-documents:write. If you add a permission to an existing key, reread events from the beginning to recover those previously hidden. For partial coverages, credit notes and status changes, continue with Documents from connected software. An n8n workflow used in tests with Fatture in Cloud is experimental, not a ready-made commercial connector.