Skip to main content

Errors

The Pritset API uses standard HTTP status codes. Error bodies can be either JSON or plain text, so check the response Content-Type header before parsing the body.

Status codesโ€‹

StatusMeaningRecommended action
400 Bad RequestA required value is missing, a field is invalid, or template validation failed.Read the field errors, correct the request, and try again.
401 UnauthorizedAuthentication credentials are missing, invalid, or expired.Check the Authorization and X-Secret headers.
403 ForbiddenThe credentials are valid, but the account cannot access the requested operation.Check account verification and permissions.
404 Not FoundThe requested template or other resource does not exist for the authenticated account.Check the resource ID.
409 ConflictThe API encountered an unexpected error while handling the operation.Do not retry automatically unless the operation is idempotent and the failure is known to be temporary.
413 Payload Too LargeAn uploaded file exceeds the endpoint's size limit.Upload a smaller file. Template files are limited to 5,000 KiB.
415 Unsupported Media TypeThe request body uses an unsupported media type.Use the content type required by the endpoint, such as multipart/form-data.
429 Too Many RequestsThe account has reached an operation, quota, or concurrency limit.Wait before retrying or check the account's limits.

Field validation errorsโ€‹

Field validation errors use 400 Bad Request and return a JSON object. Each property identifies an invalid field:

{
"Data": "Data is required"
}

Another example is a duplicate template name:

{
"Name": "Template with same name already exist"
}

The property names and messages depend on the endpoint. Display the messages to a developer or map the properties to the corresponding form fields.

Request model errorsโ€‹

Requests rejected by automatic model validation can use the ASP.NET validation problem format. Its errors object maps fields to one or more messages:

{
"type": "https://tools.ietf.org/html/rfc9110#section-15.5.1",
"title": "One or more validation errors occurred.",
"status": 400,
"errors": {
"Name": [
"The Name field is required."
]
},
"traceId": "00-example-trace-id-00"
}

Your client should support both this format and the simpler field-error object shown above.

Plain-text errorsโ€‹

Other failures return a plain-text response body.

Resource not foundโ€‹

Template with id a1b2c3d4e5f6 not found

File too largeโ€‹

File is to big. File should be not more then 5MB

Operation limit reachedโ€‹

You are not allowed to operate more

Unexpected errorโ€‹

Contact support [email protected]

An unexpected error currently uses 409 Conflict. If it persists, contact support and include the endpoint, request time, status code, and response body. Do not include access tokens, secrets, uploaded documents, or sensitive JSON data.

Handling errorsโ€‹

Check the status code before parsing a successful response such as a PDF or file download:

async function readPritsetResponse(response) {
if (response.ok) {
return response;
}

const contentType = response.headers.get("content-type") || "";
const error = contentType.includes("application/json")
? await response.json()
: await response.text();

throw new Error(
`Pritset API request failed (${response.status}): ${JSON.stringify(error)}`,
);
}

Retry guidanceโ€‹

  • Do not retry 400, 401, 403, 404, 413, or 415 responses without changing the request or credentials.
  • Retry 429 responses with exponential backoff and jitter.
  • Retry an unexpected 409 only when the operation is safe to repeat and the failure appears temporary.
  • Set a maximum retry count and log the final status and response body without recording credentials or document data.

Return to the API overview, Template Management API, or Template Processing API.