Skip to main content

Error format

Most error responses have ok: false and an error object with a machine-readable code and a human-readable message.
Branch on code, not message. Messages can change.
The duplicate idempotency key error is the exception. It returns 409 with error as a plain string, for example { "error": "Duplicate request: idempotency key already used" }. Read the HTTP status first, then parse the body defensively.

HTTP status codes

Each endpoint page lists the exact errors it can return.

Fixing common errors

Send the key as Authorization: Api-Key YOUR_API_KEY. Check for a missing Api-Key prefix, extra whitespace, or a key that was deleted. You can create a new key in the Pazy app under Settings → Developer.
The key is valid but lacks permission for this resource and action. Endpoint pages state what they need, for example Payment with Create. Create a key with the right permissions.
The message names the failing field. Compare your payload with the endpoint’s parameter table, paying attention to formats such as YYYY-MM-DD dates, uppercase state codes like MAHARASHTRA, and 15-character GSTINs.
Use the identifier returned by the create call: vendorId for vendors, poId for purchase orders, and id for invoices.

What to retry

For 429, wait for the number of seconds in the Retry-After header. For 500 and network errors, use exponential backoff with some random jitter, for example waiting 1, 2, 4, then 8 seconds, and stop after a handful of attempts.
This page covers requests you send to Pazy. For how Pazy retries webhook deliveries to your server, see Delivery and retries.

Retrying writes safely

GET requests are always safe to retry. Writes need care, because a timeout doesn’t tell you whether the request was applied.
  • Mark Invoice as Paid requires an x-idempotency-key. Sending the same key again within 5 minutes returns 409 Conflict and is not processed, which protects you from double payments. If a request times out, don’t resend it blindly. Check the invoice with Invoice Details to see whether the payment was recorded. Only send a new payment, with a new key, if it wasn’t.
  • Vendor Advance Creation accepts an optional x-idempotency-key, and we recommend it. A repeat of the same key within 5 minutes returns 409 Conflict instead of creating a second advance.
  • Other create endpoints don’t document idempotency. Before retrying after a timeout, look up what you were creating, for example with Vendor Search, to avoid duplicates. Vendor creation also rejects duplicate names and GSTINs.