Stable Pro API · v1
Document reservations
Reserve amounts before issuing an invoice to prevent concurrent runs from creating duplicates.
If your connection runs several operations at once, it could issue two invoices for the same charge. To prevent this, reserve the amounts of the charges or adjustments before issuing the document. Only one operation can proceed with issuance.
It needs the external-documents:write permission, the same one used to record documents.
The examples on this page use fictional data and a test environment key (sp_test_…). With the real stable the address is the same: only the key changes, sp_live_….
How reservations work
1. Reserve the amounts. Call POST /external-documents/reservations with an Idempotency-Key and the same covers list the document will have: { "covers": [{ "object": "charge", "id": "…", "amount": 3500 }] }. A 201 response returns a document_reservation with status: reserved.
curl https://app.stable-pro.com/api/v1/external-documents/reservations \
-H "Authorization: Bearer $STABLE_PRO_API_KEY" \
-H "Idempotency-Key: 33333333-3333-4333-8333-333333333333" \
-H "Content-Type: application/json" \
-d '{"key":"ordine-2026-114","covers":[{"object":"charge","id":"11111111-1111-4111-8111-111111111111","amount":3500}]}'
key is optional: it is your reference for finding the reservation after an interruption. The charges and adjustments in covers must belong to one customer, or you receive 422 mixed_customers.
2. Mark the start of issuance. Call POST /external-documents/reservations/{id}/sending with an empty body and a new Idempotency-Key, right before asking your software to issue the document. Ask for issuance only if this call returns 200. If the reservation has been superseded or closed, you receive 409 reservation_closed: do not issue.
3. Create the document in your software.
4. Record it. Call POST /external-documents with the document details and reservation_id. The charges and adjustments in covers must be in the reservation, or you receive 422 reservation_mismatch. The document and the closing of the reservation are saved together. If the reservation is closed, you receive 409 reservation_closed; if it does not exist or belongs to another customer, 422 reservation_mismatch. reservation_id is not part of the document's identity: sending the same details again without it returns 200 with the existing document.
5. If no document will exist, release the reservation. POST /external-documents/reservations/{id}/release with { "reason": "not_sent" } if you never requested the creation, or { "reason": "rejected" } if your software refused it for certain. not_sent is accepted only while the reservation is reserved: after step 2 you get 409 reservation_sending, because the creation may have started.
GET /external-documents/reservations/{id} reads the reservation and its status at any time.
When the outcome is uncertain
Timeout, network error, lost answer: do not retry the creation and do not release the reservation. The document may exist in your software even though you never received the answer.
The reservation stays in sending and does not expire automatically. The stable owner finds it under Payments → Accounting → Checks → Invoicing documents. They first check in the connected software whether the document exists. If it does, the connection must record it with that reservation; if it does not, the owner can release the amounts after checking. Another run or another connection of the same stable can resume the registration.
The statuses
reserved → no issuance request has been sent; a newer reservation can reserve the same amounts.
sending → the creation may have been requested; only the document, your refusal or the stable owner closes it.
completed → the document is recorded. released → freed, with its reason: not_sent, rejected, superseded, verified_absent.
completed and released are final.
The rules that matter
- Only one open reservation per charge or adjustment across the stable, even when a document covers only part of the amount.
- If another reservation is in
sendingfor the same charge or adjustment, you receive409 fact_reservedwithreservation_id: do not issue. Look for the document in your software; if it exists, record it with thatreservation_id. Otherwise, stop. - A reservation still
reservedis superseded by a newer one: this is why you must callsendingbefore issuing the document. - Step 2 works only on the id you received with your own
201. With a differentIdempotency-Keyon a reservation already in sending you get409 reservation_sending; with the same key you get the answer already given. - A reservation of another connection cannot be moved to sending or released:
409 reservation_held_by_another_connection. One of another stable does not exist:404. - Even without
reservation_id, recording a document for charges or adjustments already insendingis refused with409 fact_reserved. If they are onlyreserved, the new registration supersedes the reservation. The same applies toPOST /external-documents/{id}/coverages.
What it does not guarantee
The reservation protects the connectors that reserve, not your software: once step 2 has answered 200, the creation must happen once only. If your software retries that call by itself, it is the one creating duplicates, and Stable Pro cannot notice.
The fields and responses, one by one, are in the Reference. To record documents, continue with Documents from the connected software.