Suppose you sent two invoices with the keys order-41 and order-42 to POST /v1/invoice-receivables/batch-create and asked Light to open them. The Create invoices in bulk operation returns a 202 with an id. Save it as OPERATION_ID. Invoice Receivables API reference
Check the operation
Poll as the API user that submitted the batch. If status is IN_PROGRESS, wait before polling again. Increase the interval between polls and honor Retry-After when present. A pending item can finish after items from a later batch.
curl --silent --show-error --fail \
-H "Authorization: Basic $LIGHT_API_KEY" \
"https://api.light.inc/v1/batch-operations/$OPERATION_ID"
Suppose the final counts show one completed item and one failed item. Request the failed item to find out which invoice needs attention.
curl --silent --show-error --fail --get \
-H "Authorization: Basic $LIGHT_API_KEY" \
--data-urlencode 'filter=status:eq:FAILED' \
"https://api.light.inc/v1/batch-operations/$OPERATION_ID/items"
If the response includes a nextCursor, pass it as cursor on the next request with the same filter. Omit the filter to read all results. Match each item to its input by idempotencyKey. Items are listed in submission order, but invoices can finish and receive numbers out of order. When another request depends on an invoice, wait for its item to complete and use its recordId.
Recover a failed or uncertain submission
If order-42 failed, read its failureContext. When creation succeeded but opening failed, the item keeps its recordId. Use that ID to check the invoice before retrying the open.
If you lost the original submission response, first check which invoices already exist. Resend only outstanding records, using their original payloads and keys as the same API user. The retry returns a new operation ID. A previously created invoice keeps its ID on replay while the worker can still read the cached creation result. Cached results expire after 24 hours.