ExportFlowDevelopers
Sign inGet API keys

Building reliably

Errors

Every failure has a stable code to branch on and a message written for a person. This page lists every code the API can answer with.

The error envelope#

An error is a JSON object with one member, in the same shape whatever went wrong:

Error
{
  "error": {
    "code": "not_confirmed",
    "message": "Confirm what the documents say before checking them. If extraction misread a field, every finding computed from it would be wrong."
  }
}
  • code is machine-readable and stable. Branch on it. A code is never renamed within version 1; new codes can be added.
  • message is a sentence for a person and says what to do. It can be reworded at any time, so never match on it. It is safe to show to your own users.

Every response, successful or not, carries an x-request-id header. Log it, and quote it to MeerTech when you ask about a request. The same id is beside the request in the console’s request log.

Malformed requests

A request that does not match the endpoint’s schema (an identifier that is not a UUID, a field that is too long, an unknown field, a missing body) is answered 422 with the code invalid_request, in the same envelope. The message names the first field at fault.

Handling errors#

With an SDK, catch the error type and read its code. Over HTTP, read the status and the code. Either way the decision is the same three-way one: fix the request, wait and retry, or ask a person to do something.

import time
import exportflow

try:
    client.verifications.create(shipment_id)
except exportflow.ConflictError as error:
    if error.code == "not_confirmed":
        ...                                   # ask the user to confirm the record
except exportflow.QuotaExceededError:
    ...                                       # the month's allowance is used up
except exportflow.RateLimitError as error:
    time.sleep(error.retry_after or 5)
except exportflow.APIConnectionError:
    ...                                       # safe to retry later
What to do for each HTTP status
StatusRetry?What it means
400, 422NoThe request is wrong. Fix it; sending it again unchanged will fail again.
401, 403NoThe key is not valid, or may not do this.
404NoNo such resource in this key's organisation and environment.
409DependsThe resource is not in a state that allows this. request_in_progress and idempotency_conflict are retried; not_confirmed needs a person.
426NoThe SDK is too old. Upgrade it.
429Dependsrate_limited: wait for Retry-After, then retry. The others are an allowance used up, and waiting a few seconds will not help.
5xxYesExportFlow's fault. Retry with backoff and the same Idempotency-Key.

What the SDKs raise#

Both SDKs raise the same set of error types, with the same names. Every one carries the API’s code, the HTTP status and the request id.

SDK error types
ErrorHTTPMeaning
AuthenticationError401Key missing, wrong, revoked or expired
PermissionDeniedError403Missing scope, suspended account, disabled application, network not allowed
NotFoundError404No such resource in this organisation and environment
ConflictError409Not possible in the current state, for example not_confirmed
InvalidRequestError400, 422The request is wrong; do not retry
RateLimitError429Slow down; see the retry-after value
QuotaExceededError429Allowance or spending limit reached for the period. Not a RateLimitError (since SDK 1.1)
SDKVersionUnsupportedError426Upgrade the SDK
ServerError5xxExportFlow's fault; retried automatically
APIConnectionError, APITimeoutErrornoneThe API could not be reached, or did not answer in time

The SDKs retry connection failures, timeouts, rate_limited, request_in_progress, idempotency_conflict and 5xx for you, twice by default, with backoff, sending the same idempotency key each time. When the API asks for a longer wait than the client allows (60 seconds by default: max_retry_wait in Python, maxRetryWait in TypeScript), the error is raised at once instead of blocking the call.

Every object an SDK call returns carries the request id of that call (request_id in Python, requestId in TypeScript), not only errors.

Code reference#

Grouped by where the error comes from. Within a group, in the order you are likely to meet them.

Authentication and access#

Decided before the request reaches a route. A missing, malformed, unknown, revoked or expired key all receive the same answer on purpose: saying which would tell somebody guessing keys that one of their guesses was once real.

Authentication and access error codes
CodeStatusMeaningWhat to do
invalid_api_key401No key was sent, or the key is not valid: malformed, unknown, revoked or expired.Send Authorization: Bearer followed by a current key. Check the key's status in the console.
insufficient_scope403The key is valid but was issued without the scope this call needs. The message names the scope.Use a key that holds the scope, or issue one that does.
account_suspended403The organisation's account is suspended.Contact MeerTech. The reason is shown in the console overview.
application_disabled403The application the key belongs to is disabled.Enable the application in the console.
application_owner_unavailable403The member who owns the application is no longer active, so its keys are refused.An owner of the organisation assigns the application to another member in the console.
ip_not_allowed403The account has an IP allowlist and the request came from an address outside it.Call from an allowed network, or ask MeerTech to change the allowlist.
sdk_version_unsupported426The request came from an ExportFlow SDK older than the oldest supported version.Upgrade the SDK. Requests that do not come from an SDK are never refused this way.

Rate limits and quotas#

All answered 429, and they mean different things. Only rate_limited goes away by waiting a few seconds.

Rate limits and quotas error codes
CodeStatusMeaningWhat to do
rate_limited429Too many requests in the current one-minute window for the key, the application or the organisation.Wait for the number of seconds in Retry-After, then repeat the request. The SDKs do this.
quota_exceeded429The account has used its allowance for the period on this meter. The message gives the allowance and the reset date.Wait for the reset date, or ask MeerTech about a larger plan. Retrying sooner will not help; afterwards, use a new Idempotency-Key.
spend_limit_reached429The account has reached its spending limit for the period.Wait for the reset date, or contact MeerTech to raise the limit.
too_many_documents_in_progress429The account already has the maximum number of documents waiting to be processed.Upload again, with a new Idempotency-Key, when some have finished. Poll, or wait for document.processing.completed.

Idempotency#

From the idempotency check that every POST, PUT, PATCH and DELETE passes through.

Idempotency error codes
CodeStatusMeaningWhat to do
idempotency_key_required400A request that changes something was sent without an Idempotency-Key header.Send the header. The SDKs set it for you.
idempotency_key_too_long400The Idempotency-Key is longer than 255 characters.Use a shorter key.
idempotency_key_reused409The key was already used for a different request: another method, path or body.Use a new key for a new request. This is a bug in the caller, not a transient fault.
request_in_progress409The first request with this key has not finished yet.Wait briefly and repeat the request with the same key. The SDKs do this.
idempotency_conflict409The first request with this key was released between two checks. Rare.Repeat the request with the same key.

Not found#

A resource that exists in the other environment, or in another organisation, is answered exactly like one that does not exist.

Not found error codes
CodeStatusMeaningWhat to do
shipment_not_found404No such shipment in this key's organisation and environment.Check the identifier, and that the key is for the environment the shipment was created in.
document_not_found404No such document in this key's organisation and environment.Check the identifier and the key's environment.
verification_not_found404No such verification in this key's organisation and environment.Check the identifier and the key's environment.
document_not_on_shipment404A confirmation names a document that is not on this shipment.Use a document_id from this shipment's own record.
run_not_found404No such verification in this key's organisation and environment.Check the identifier and the key's environment. Same meaning as verification_not_found.
webhook_endpoint_not_found404No such webhook endpoint on this key's application.List the application's endpoints and use an identifier from that list.

Malformed requests#

From checking a request against the endpoint's schema, before anything else runs.

Malformed requests error codes
CodeStatusMeaningWhat to do
invalid_request422The request does not match the endpoint's schema: a missing or unknown field, a value too long, an identifier that is not a UUID. The message names the first field at fault.Correct the field the message names. Do not retry unchanged.

Shipments#

From creating a shipment.

Shipments error codes
CodeStatusMeaningWhat to do
invalid_shipment422A field of the shipment is not acceptable. The message says which and why.Correct the field. Do not retry unchanged.
port_without_country422A destination port was given with no destination country.Send destination_country with destination_port.
port_not_in_country422The destination port is not a port in the destination country.Send a UN/LOCODE that belongs to the destination country.

Uploads#

A file is checked before it is scanned or stored, and a refused file is not stored and not charged. The message always says what to do with the file.

Uploads error codes
CodeStatusMeaningWhat to do
upload_empty400The uploaded file has no content.Send the file in a multipart field named file.
upload_too_small400The file is under 32 bytes, too small to be a document.Check that the whole file was sent.
upload_too_large400The file is larger than 25 MB.Split or compress the file.
upload_unrecognised_format400The content is not a PDF, PNG, JPEG, TIFF or WebP file. The content decides, not the file name.Convert the file to PDF or a supported image.
upload_declared_type_mismatch400The part's Content-Type says one format and the content is another.Send the Content-Type the content really is, or leave it out.
upload_password_protected400The PDF is password-protected and cannot be read.Save a copy without the password and upload that.
upload_unreadable_pdf400The PDF is damaged and cannot be opened.Export or scan the document again.
upload_unreadable_image400The image is damaged and cannot be opened.Take the photograph again, or upload a PDF.
upload_too_many_pages400The file has more than 40 pages.Split it into the separate documents it contains and upload those.
upload_infected400The virus scanner rejected the file.Do not retry with the same file.
scanner_unavailable503The file could not be scanned, so it was not stored.Retry shortly with the same Idempotency-Key.

Records and verification#

From confirming a shipment's record and starting a verification.

Records and verification error codes
CodeStatusMeaningWhat to do
invalid_confirmation422A confirmed field is not acceptable. The message says which and why.Correct the confirmation. Do not retry unchanged.
source_extraction_not_on_shipment422A confirmation cites a reading that does not belong to this shipment's documents.Cite an extraction_id from this shipment's own record.
not_confirmed409Verification was requested before the shipment's record was confirmed.Show the record to a person, send their confirmation, then start the verification.
no_documents409The shipment has no documents, so there is nothing to read or verify.Upload the shipment's documents first.
document_busy409The document is being processed; it cannot be processed again until that finishes.Wait for document.processing.completed or failed, then try again.
document_is_bundle409The document was split into the documents it held, so it is not processed itself.Act on its parts: the documents whose parent_document_id is this one.
no_rule_set409No rule set is published, so a verification has nothing to check against.This is on ExportFlow's side. Retry later, and tell MeerTech if it persists.

Webhook endpoints and usage#

From registering a webhook endpoint and reading usage.

Webhook endpoints and usage error codes
CodeStatusMeaningWhat to do
invalid_webhook_url422The URL cannot be a webhook endpoint: not https, no host name, credentials in the URL, or an address that is not reachable from the internet.Use a public https URL with no user name or password in it.
unknown_event_type422One or more event types are not ones ExportFlow sends. The message lists them.Subscribe only to the event types in the webhooks guide.
invalid_period422The usage period is not a month written YYYY-MM.Send a period such as 2026-11, or leave it out for the current month.

Server errors#

ExportFlow's fault. Safe to retry with the same Idempotency-Key: a 5xx never uses the key up.

Server errors error codes
CodeStatusMeaningWhat to do
internal_error500The request could not be completed.Retry with backoff. If it persists, send MeerTech the request id.
document_unreadable502The stored file could not be read back to process it.Retry with backoff. If it persists, send MeerTech the request id.