Skip to main content

Error Handling

The Inspakt API always returns HTTP 200. Success or failure is determined by the success field in the response body, and the specific error by error.name.


Response structure

Success

{
"version": "1.X.X",
"success": true,
"payload": { ... }
}

Failure

{
"version": "1.X.X",
"success": false,
"error": {
"name": "Envelope.NotFound",
"description": "The requested envelope does not exist.",
"context": {}
}
}
FieldTypeDescription
error.namestringStable machine-readable error identifier. Use this for conditional logic.
error.descriptionstringHuman-readable explanation. Do not rely on this for logic — it may change.
error.contextobjectAdditional data specific to the error (e.g. current status). May be empty.
tip

Always check success first, then branch on error.name. Error names follow the Resource.ErrorType pattern and are guaranteed stable across API versions.


Error reference

Envelopes

NameDescriptionContext fields
Envelope.NotFoundThe envelope does not exist or does not belong to your team.
Envelope.NotDeletableThe envelope cannot be deleted in its current status. Only draft envelopes can be deleted.
Envelope.NotFinalizedThe audit log was requested but the envelope is still draft or sent. Available for finalized, voided, and expired envelopes.status
Envelope.ClosedA void was attempted on an envelope that is already closed (voided, finalized, or expired).
Envelope.AuditNotFoundThe audit log PDF could not be generated.

Templates

NameDescription
Template.NotFoundThe template does not exist or does not belong to your team.

Recipients

NameDescription
Recipient.NotFoundThe recipient does not exist on the specified envelope or template.
Recipient.HostRecipientBoundThe recipient cannot be removed because a host relationship depends on it.
Recipient.DelegatorRecipientBoundThe recipient cannot be removed because a delegator relationship depends on it.

Documents

NameDescription
Document.NotFoundThe document does not exist on the specified envelope or template.

Fields

NameDescriptionContext fields
Field.NotFoundThe field does not exist on the specified envelope or template.
Field.AssignmentInvalidThe recipientId does not belong to the envelope or template.
Field.ConfigurationInvalidThe config object contains invalid values for the given field type.
Field.IdentifierNotUniqueA field with the same identifier already exists.

General

NameDescription
BadRequestErrorThe request body is malformed or contains invalid values.

Handling errors in code

const response = await fetch(
'https://next.inspakt.com/api/v1/key/envelopes/env_01hx.../send',
{ headers: { 'X-Inspakt-Api-Key': apiKey } }
);

// HTTP status is always 200 — check the body
const body = await response.json();

if (!body.success) {
switch (body.error.name) {
case 'Envelope.NotFound':
// The envelopeId is invalid or was deleted
break;
case 'Envelope.Closed':
// Already finalized or voided — no action needed
break;
default:
// Unexpected error — log and alert
console.error('Unhandled API error:', body.error);
}
}

Network-level errors

The success: false pattern only applies to application-level errors returned by Inspakt. Standard HTTP errors (4xx, 5xx) may still occur for infrastructure reasons such as authentication failures, rate limiting, or transient outages.

HTTP CodeCauseAction
401Missing or invalid X-Inspakt-Api-Key header.Check your API key.
403Key exists but lacks permission for this resource.Contact your account manager.
429Rate limit exceeded.Back off and retry.
5xxTransient server error.Retry with exponential backoff.

Retry strategy for 5xx

AttemptWait before retry
11 s
22 s
34 s
48 s

Do not retry on 4xx — these indicate a problem with the request itself.