squiggli Get a free API key
Reference

Errors, retries and pagination

Every error code, how Idempotency-Key makes retries safe, and how to page through lists.

Error format

json
{
  "error": {
    "code": "card_required",
    "message": "Add a card to start sending. Your free documents are used up and this business has no card in Kiewa. Test envelopes (test: true) are still free.",
    "add_card_url": "https://bms.kiewa.com.au/..."
  }
}

code is stable: branch on it. message says what went wrong and how to fix it, written so an AI agent can act on it. Some errors carry extra fields, shown below.

Idempotency

Every write (POST, PATCH, DELETE) accepts an Idempotency-Key header, up to 255 characters. The first answer is stored for 24 hours; repeating the request with the same key returns that answer with Idempotent-Replayed: true, and does nothing again. Use something tied to your own record, like quote-1042-send, and send it on every attempt.

Pagination

Lists return has_more and next_cursor. Pass cursor to get the next page; limit is 1 to 100 (default 20).

bash
curl "https://squiggli.billy-965.workers.dev/v1/envelopes?status=sent,viewed&limit=50&cursor=env_..." -H "Authorization: Bearer $SQUIGGLI_API_KEY"

Error codes

StatusCodeMeans
400invalid_requestThe body or query failed validation. field names the first bad one.
400invalid_jsonThe body is not valid JSON.
400invalid_monthmonth must be YYYY-MM.
400invalid_idempotency_keyIdempotency-Key is longer than 255 characters.
401unauthorizedNo key, or the key is wrong or revoked.
401access_code_requiredThis signer needs to enter their access code.
402card_requiredFree documents are used up and there is no card. add_card_url is where the business adds one. Test envelopes still work.
403squiggli_not_enabledThe business doesn't have squiggli in Kiewa.
403forbiddenThis credential can't do that (for example, an embed token outside its scope).
403wrong_access_codeThe access code is wrong.
403cross_siteA cookie-authenticated write came from another site.
404not_foundNo such envelope, template, webhook or key in this account.
404invalid_linkThe signing link isn't valid, or the envelope hasn't been sent.
404not_linkedThe business's billing isn't through Kiewa.
409already_sentIt's not a draft any more.
409not_openIt's signed, declined, voided or expired, so it can't change.
409is_draftDrafts are deleted, not voided.
409not_draftOnly drafts can be deleted.
409not_your_turnA sequential signer tried to sign before their turn.
409not_viewedThe signer must open the document before signing.
409already_signedThis signer has signed.
409already_declinedThis signer declined.
409document_changedA document no longer matches its hash from sending, so it can't be signed.
409not_signedThe signed PDF exists once everyone has signed.
409idempotency_in_progressA request with this Idempotency-Key is still running. Retry shortly.
409own_keyYou can't revoke the key the request is using.
410voidedThe sender cancelled it.
410declinedSomeone declined it.
410expiredThe deadline passed.
410link_expiredThe download link is over 7 days old. Get a new one from the envelope.
413file_too_largePDFs can be up to 10 MB.
413signature_too_largeSignature images can be up to 500 KB.
413logo_too_largeLogos can be up to 500 KB.
422missing_documentsAdd documents or template_id.
422missing_emailAn email-delivery signer has no email.
422duplicate_signerTwo signers have the same email.
422unknown_signerA field's signer isn't an index, role or email in signers.
422unknown_documentA field's document index doesn't exist.
422invalid_fieldA field is on a page the document does not have.
422field_off_pageA field runs off the page. The message gives the page size.
422missing_fieldsA signer has nothing to fill.
422missing_variablesA template variable has no value. missing lists them.
422unfilled_roleA template role has no signer. roles lists them.
422invalid_templateSend blocks or a PDF, not both; fields go with a PDF.
422invalid_pdfThe file isn't a readable PDF.
422encrypted_pdfThe PDF is password-protected.
422too_many_pagesPDFs can have at most 200 pages.
422invalid_base64file_base64 isn't valid base64.
422missing_fileSend file_base64 or file_url.
422file_unreachablefile_url couldn't be downloaded.
422invalid_urlURLs must be public https.
422invalid_deadlineThe deadline is in the past.
422invalid_metadatametadata has more than 20 keys.
422invalid_logoThe logo must be a PNG.
422missing_valueA required field is empty. field_id says which.
422missing_signatureThe signer has signature fields but sent no signature.
422invalid_signatureThe signature must be a PNG data URL.
422idempotency_key_reusedThis Idempotency-Key was used for a different request.
422missing_envelope_idAn envelope embed token needs envelope_id.
429test_limit_reachedThis business sent 100 test envelopes today.
429access_code_lockedToo many wrong access codes. Wait 15 minutes.
500internal_errorSomething unexpected. Retrying with the same Idempotency-Key is safe.