ExportFlowDevelopers
Sign inGet API keys

Reference

API reference

Version 1.1 of the ExportFlow API: 18 operations and 41 schemas. This page is generated from the API's own OpenAPI contract, so it cannot fall behind it.

Basics#

What every request and response has in common
Value
Base URLhttps://api.exportflow.app/public/v1
AuthenticationAuthorization: Bearer <API key>. See Authentication.
WritesEvery POST, PUT, PATCH and DELETE needs an Idempotency-Key header. See Idempotency.
VersionEvery response carries ExportFlow-Api-Version. See Versioning.
Errors{"error": {"code": "...", "message": "..."}}. See Errors.
FormatJSON in and out, UTF-8. Timestamps are ISO 8601 in UTC. Identifiers are UUIDs.

From the contract

Document processing and verification for trade documents, for integration into your own ERP, accounting or procurement software.

Authentication. Send your API key as a bearer token: Authorization: Bearer exfk_live_.... Keys are created in the developer console. A key beginning exfk_test_ works in the sandbox environment, one beginning exfk_live_ in production; the two never see each other's data.

Idempotency. Every POST, PUT, PATCH and DELETE needs an Idempotency-Key header. Repeating a request with the same key and the same body returns the original response and does the work once. The SDKs set it for you and reuse it when they retry.

Asynchronous work. Uploading a document and starting a verification both return at once. Poll the resource, or register a webhook endpoint and be told.

Versioning. This is version 1. Within it, fields and endpoints are only added, never removed or changed in meaning. Every response carries ExportFlow-Api-Version. A deprecated endpoint is announced at least six months ahead and answers with Deprecation and Sunset headers until it goes.

Errors. Every error is {"error": {"code": "...", "message": "..."}}. Branch on code; message is for people.

Rate limits. Every response carries RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset (seconds). A request over the limit is answered 429 with Retry-After.

Billing. Requests are not charged. Usage is recorded when work completes: a document accepted, a document processed, a verification completed. Each is recorded once however many times it is requested, retried or read. Sandbox usage is measured and never charged. GET /usage shows your month so far.

Operations#

Documents#

Fetch a document and its processing status

GET/public/v1/documents/{document_id}

Parameters

Parameters of Fetch a document and its processing status
ParameterInTypeDescription
document_idRequiredpathstring (uuid)No further detail.

Responses

Responses of Fetch a document and its processing status
StatusMeaningBody
200Successful ResponseDocument
400The request is malformed, or the upload was refused.ErrorEnvelope
401The API key is missing or invalid.ErrorEnvelope
403The key may not do this.ErrorEnvelope
404No such resource in this key's environment.ErrorEnvelope
409Not possible in the current state (for example `not_confirmed`), or an idempotency key in use or reused with a different request.ErrorEnvelope
422The request is well formed but not valid.ErrorEnvelope
426This SDK version is no longer supported.ErrorEnvelope
429A rate limit, quota or spending limit was reached.ErrorEnvelope
500ExportFlow failed. Safe to retry.ErrorEnvelope
503A dependency is unavailable. Safe to retry.ErrorEnvelope

The fields read from a document

GET/public/v1/documents/{document_id}/extraction

The current reading of every field, each with a value or the reason there is none. Empty until the document's status is processed.

Parameters

Parameters of The fields read from a document
ParameterInTypeDescription
document_idRequiredpathstring (uuid)No further detail.

Responses

Responses of The fields read from a document
StatusMeaningBody
200Successful ResponseExtraction
400The request is malformed, or the upload was refused.ErrorEnvelope
401The API key is missing or invalid.ErrorEnvelope
403The key may not do this.ErrorEnvelope
404No such resource in this key's environment.ErrorEnvelope
409Not possible in the current state (for example `not_confirmed`), or an idempotency key in use or reused with a different request.ErrorEnvelope
422The request is well formed but not valid.ErrorEnvelope
426This SDK version is no longer supported.ErrorEnvelope
429A rate limit, quota or spending limit was reached.ErrorEnvelope
500ExportFlow failed. Safe to retry.ErrorEnvelope
503A dependency is unavailable. Safe to retry.ErrorEnvelope

Process a document again

POST/public/v1/documents/{document_id}/process

Queues classification and reading for a document that failed.

A document is processed automatically when it is uploaded, so this is the recovery route. Calling it for a document that is being processed or has been read changes nothing and answers queued: false; it never buys the same reading twice.

Needs an Idempotency-Key header.

Parameters

Parameters of Process a document again
ParameterInTypeDescription
document_idRequiredpathstring (uuid)No further detail.
Idempotency-KeyRequiredheaderstringAny string of 1 to 255 characters, unique per operation you intend. Repeating a request with the same key and the same body returns the first response; the same key with a different body is refused with idempotency_key_reused. Keys do not expire. 1 to 255 characters.

Responses

Responses of Process a document again
StatusMeaningBody
202Successful ResponseProcessingAccepted
400The request is malformed, or the upload was refused.ErrorEnvelope
401The API key is missing or invalid.ErrorEnvelope
403The key may not do this.ErrorEnvelope
404No such resource in this key's environment.ErrorEnvelope
409Not possible in the current state (for example `not_confirmed`), or an idempotency key in use or reused with a different request.ErrorEnvelope
422The request is well formed but not valid.ErrorEnvelope
426This SDK version is no longer supported.ErrorEnvelope
429A rate limit, quota or spending limit was reached.ErrorEnvelope
500ExportFlow failed. Safe to retry.ErrorEnvelope
503A dependency is unavailable. Safe to retry.ErrorEnvelope

Identity#

Who this API key is

GET/public/v1/me

Responses

Responses of Who this API key is
StatusMeaningBody
200Successful ResponseIdentity
400The request is malformed, or the upload was refused.ErrorEnvelope
401The API key is missing or invalid.ErrorEnvelope
403The key may not do this.ErrorEnvelope
404No such resource in this key's environment.ErrorEnvelope
409Not possible in the current state (for example `not_confirmed`), or an idempotency key in use or reused with a different request.ErrorEnvelope
422The request is well formed but not valid.ErrorEnvelope
426This SDK version is no longer supported.ErrorEnvelope
429A rate limit, quota or spending limit was reached.ErrorEnvelope
500ExportFlow failed. Safe to retry.ErrorEnvelope
503A dependency is unavailable. Safe to retry.ErrorEnvelope

Shipments#

List shipments

GET/public/v1/shipments

Parameters

Parameters of List shipments
ParameterInTypeDescription
limitOptionalqueryinteger1 to 200; default 50.
referenceOptionalquerystringAt most 120 characters.

Responses

Responses of List shipments
StatusMeaningBody
200Successful ResponseShipmentPage
400The request is malformed, or the upload was refused.ErrorEnvelope
401The API key is missing or invalid.ErrorEnvelope
403The key may not do this.ErrorEnvelope
404No such resource in this key's environment.ErrorEnvelope
409Not possible in the current state (for example `not_confirmed`), or an idempotency key in use or reused with a different request.ErrorEnvelope
422The request is well formed but not valid.ErrorEnvelope
426This SDK version is no longer supported.ErrorEnvelope
429A rate limit, quota or spending limit was reached.ErrorEnvelope
500ExportFlow failed. Safe to retry.ErrorEnvelope
503A dependency is unavailable. Safe to retry.ErrorEnvelope

Create a shipment

POST/public/v1/shipments

Needs an Idempotency-Key header.

Parameters

Parameters of Create a shipment
ParameterInTypeDescription
Idempotency-KeyRequiredheaderstringAny string of 1 to 255 characters, unique per operation you intend. Repeating a request with the same key and the same body returns the first response; the same key with a different body is refused with idempotency_key_reused. Keys do not expire. 1 to 255 characters.

Request body application/json

Schema: NewShipment. A body is required.

Request body of Create a shipment
FieldTypeDescription
commodityOptionalstring | nullAt most 120 characters.
destination_countryOptionalstring | nullISO 3166-1 alpha-2 country code, for example IN. Exactly 2 characters.
destination_portOptionalstring | nullUN/LOCODE of the port of discharge: five characters, country then place, no space. For example INNSA (Nhava Sheva). Exactly 5 characters.
exporter_nameOptionalstring | nullAt most 200 characters.
hs_codeOptionalstring | nullHarmonized System code, digits only, for example 180100. At most 12 characters.
origin_countryOptionalstring | nullISO 3166-1 alpha-2 country code, for example NG. Exactly 2 characters.
referenceOptionalstring | nullYour own identifier for the shipment, for example an order number. At most 120 characters.

Responses

Responses of Create a shipment
StatusMeaningBody
201Successful ResponseShipment
400The request is malformed, or the upload was refused.ErrorEnvelope
401The API key is missing or invalid.ErrorEnvelope
403The key may not do this.ErrorEnvelope
404No such resource in this key's environment.ErrorEnvelope
409Not possible in the current state (for example `not_confirmed`), or an idempotency key in use or reused with a different request.ErrorEnvelope
422The request is well formed but not valid.ErrorEnvelope
426This SDK version is no longer supported.ErrorEnvelope
429A rate limit, quota or spending limit was reached.ErrorEnvelope
500ExportFlow failed. Safe to retry.ErrorEnvelope
503A dependency is unavailable. Safe to retry.ErrorEnvelope

Fetch a shipment

GET/public/v1/shipments/{shipment_id}

Parameters

Parameters of Fetch a shipment
ParameterInTypeDescription
shipment_idRequiredpathstring (uuid)No further detail.

Responses

Responses of Fetch a shipment
StatusMeaningBody
200Successful ResponseShipment
400The request is malformed, or the upload was refused.ErrorEnvelope
401The API key is missing or invalid.ErrorEnvelope
403The key may not do this.ErrorEnvelope
404No such resource in this key's environment.ErrorEnvelope
409Not possible in the current state (for example `not_confirmed`), or an idempotency key in use or reused with a different request.ErrorEnvelope
422The request is well formed but not valid.ErrorEnvelope
426This SDK version is no longer supported.ErrorEnvelope
429A rate limit, quota or spending limit was reached.ErrorEnvelope
500ExportFlow failed. Safe to retry.ErrorEnvelope
503A dependency is unavailable. Safe to retry.ErrorEnvelope

List a shipment's documents

GET/public/v1/shipments/{shipment_id}/documents

Parameters

Parameters of List a shipment's documents
ParameterInTypeDescription
shipment_idRequiredpathstring (uuid)No further detail.

Responses

Responses of List a shipment's documents
StatusMeaningBody
200Successful ResponseDocumentPage
400The request is malformed, or the upload was refused.ErrorEnvelope
401The API key is missing or invalid.ErrorEnvelope
403The key may not do this.ErrorEnvelope
404No such resource in this key's environment.ErrorEnvelope
409Not possible in the current state (for example `not_confirmed`), or an idempotency key in use or reused with a different request.ErrorEnvelope
422The request is well formed but not valid.ErrorEnvelope
426This SDK version is no longer supported.ErrorEnvelope
429A rate limit, quota or spending limit was reached.ErrorEnvelope
500ExportFlow failed. Safe to retry.ErrorEnvelope
503A dependency is unavailable. Safe to retry.ErrorEnvelope

Upload a document

POST/public/v1/shipments/{shipment_id}/documents

Scans, stores and queues the document for processing.

Processing is asynchronous. Poll GET /documents/{id} or subscribe to document.processing.completed. Uploading the same file to the same shipment twice returns the first document with duplicate: true.

A file that holds several documents is split: the upload's status becomes split and each part appears in GET /shipments/{id}/documents as a document of its own, with parent_document_id naming the upload. Read and confirm the parts; the split upload itself has no reading.

Accepted: PDF, PNG, JPEG, TIFF and WebP, one file per request. Refusals are 400 with a code beginning upload_.

Needs an Idempotency-Key header.

Parameters

Parameters of Upload a document
ParameterInTypeDescription
shipment_idRequiredpathstring (uuid)No further detail.
document_typeOptionalquerystringWhat you say the document is. At most 64 characters.
Idempotency-KeyRequiredheaderstringAny string of 1 to 255 characters, unique per operation you intend. Repeating a request with the same key and the same body returns the first response; the same key with a different body is refused with idempotency_key_reused. Keys do not expire. 1 to 255 characters.

Request body multipart/form-data

Schema: Upload form. A body is required.

Request body of Upload a document
FieldTypeDescription
fileRequiredfileA PDF or an image of one document.

Responses

Responses of Upload a document
StatusMeaningBody
201Successful ResponseDocument
400The request is malformed, or the upload was refused.ErrorEnvelope
401The API key is missing or invalid.ErrorEnvelope
403The key may not do this.ErrorEnvelope
404No such resource in this key's environment.ErrorEnvelope
409Not possible in the current state (for example `not_confirmed`), or an idempotency key in use or reused with a different request.ErrorEnvelope
422The request is well formed but not valid.ErrorEnvelope
426This SDK version is no longer supported.ErrorEnvelope
429A rate limit, quota or spending limit was reached.ErrorEnvelope
500ExportFlow failed. Safe to retry.ErrorEnvelope
503A dependency is unavailable. Safe to retry.ErrorEnvelope

What the shipment's documents say

GET/public/v1/shipments/{shipment_id}/record

Parameters

Parameters of What the shipment's documents say
ParameterInTypeDescription
shipment_idRequiredpathstring (uuid)No further detail.

Responses

Responses of What the shipment's documents say
StatusMeaningBody
200Successful ResponseRecord
400The request is malformed, or the upload was refused.ErrorEnvelope
401The API key is missing or invalid.ErrorEnvelope
403The key may not do this.ErrorEnvelope
404No such resource in this key's environment.ErrorEnvelope
409Not possible in the current state (for example `not_confirmed`), or an idempotency key in use or reused with a different request.ErrorEnvelope
422The request is well formed but not valid.ErrorEnvelope
426This SDK version is no longer supported.ErrorEnvelope
429A rate limit, quota or spending limit was reached.ErrorEnvelope
500ExportFlow failed. Safe to retry.ErrorEnvelope
503A dependency is unavailable. Safe to retry.ErrorEnvelope

Confirm what the documents say

PUT/public/v1/shipments/{shipment_id}/record

Confirm the values a person has checked against the documents.

Verification will not start until the record is confirmed, and that is deliberate: if a field was misread, every finding computed from it would be wrong. Confirm what the document says, not what it should say; the verification is what finds the error.

Needs an Idempotency-Key header.

Parameters

Parameters of Confirm what the documents say
ParameterInTypeDescription
shipment_idRequiredpathstring (uuid)No further detail.
Idempotency-KeyRequiredheaderstringAny string of 1 to 255 characters, unique per operation you intend. Repeating a request with the same key and the same body returns the first response; the same key with a different body is refused with idempotency_key_reused. Keys do not expire. 1 to 255 characters.

Request body application/json

Schema: RecordConfirmation. A body is required.

Request body of Confirm what the documents say
FieldTypeDescription
fieldsRequiredarray of ConfirmedField1 to 200 items.

Responses

Responses of Confirm what the documents say
StatusMeaningBody
200Successful ResponseRecord
400The request is malformed, or the upload was refused.ErrorEnvelope
401The API key is missing or invalid.ErrorEnvelope
403The key may not do this.ErrorEnvelope
404No such resource in this key's environment.ErrorEnvelope
409Not possible in the current state (for example `not_confirmed`), or an idempotency key in use or reused with a different request.ErrorEnvelope
422The request is well formed but not valid.ErrorEnvelope
426This SDK version is no longer supported.ErrorEnvelope
429A rate limit, quota or spending limit was reached.ErrorEnvelope
500ExportFlow failed. Safe to retry.ErrorEnvelope
503A dependency is unavailable. Safe to retry.ErrorEnvelope

A shipment's verifications, newest first

GET/public/v1/shipments/{shipment_id}/verifications

Parameters

Parameters of A shipment's verifications, newest first
ParameterInTypeDescription
shipment_idRequiredpathstring (uuid)No further detail.

Responses

Responses of A shipment's verifications, newest first
StatusMeaningBody
200Successful ResponseVerificationPage
400The request is malformed, or the upload was refused.ErrorEnvelope
401The API key is missing or invalid.ErrorEnvelope
403The key may not do this.ErrorEnvelope
404No such resource in this key's environment.ErrorEnvelope
409Not possible in the current state (for example `not_confirmed`), or an idempotency key in use or reused with a different request.ErrorEnvelope
422The request is well formed but not valid.ErrorEnvelope
426This SDK version is no longer supported.ErrorEnvelope
429A rate limit, quota or spending limit was reached.ErrorEnvelope
500ExportFlow failed. Safe to retry.ErrorEnvelope
503A dependency is unavailable. Safe to retry.ErrorEnvelope

Verify a shipment's documents

POST/public/v1/shipments/{shipment_id}/verifications

Checks the confirmed record against the published rule set.

Asynchronous: poll GET /verifications/{id} or subscribe to verification.completed. Answers 409 not_confirmed until the record has been confirmed.

Needs an Idempotency-Key header.

Parameters

Parameters of Verify a shipment's documents
ParameterInTypeDescription
shipment_idRequiredpathstring (uuid)No further detail.
Idempotency-KeyRequiredheaderstringAny string of 1 to 255 characters, unique per operation you intend. Repeating a request with the same key and the same body returns the first response; the same key with a different body is refused with idempotency_key_reused. Keys do not expire. 1 to 255 characters.

Responses

Responses of Verify a shipment's documents
StatusMeaningBody
202Successful ResponseVerificationAccepted
400The request is malformed, or the upload was refused.ErrorEnvelope
401The API key is missing or invalid.ErrorEnvelope
403The key may not do this.ErrorEnvelope
404No such resource in this key's environment.ErrorEnvelope
409Not possible in the current state (for example `not_confirmed`), or an idempotency key in use or reused with a different request.ErrorEnvelope
422The request is well formed but not valid.ErrorEnvelope
426This SDK version is no longer supported.ErrorEnvelope
429A rate limit, quota or spending limit was reached.ErrorEnvelope
500ExportFlow failed. Safe to retry.ErrorEnvelope
503A dependency is unavailable. Safe to retry.ErrorEnvelope

Usage#

What this application used in a month

GET/public/v1/usage

This application's usage in this key's environment. Charges are estimates until an invoice is issued; quotas are for the whole account.

Parameters

Parameters of What this application used in a month
ParameterInTypeDescription
periodOptionalquerystringYYYY-MM; the current month if omitted.

Responses

Responses of What this application used in a month
StatusMeaningBody
200Successful ResponseUsage
400The request is malformed, or the upload was refused.ErrorEnvelope
401The API key is missing or invalid.ErrorEnvelope
403The key may not do this.ErrorEnvelope
404No such resource in this key's environment.ErrorEnvelope
409Not possible in the current state (for example `not_confirmed`), or an idempotency key in use or reused with a different request.ErrorEnvelope
422The request is well formed but not valid.ErrorEnvelope
426This SDK version is no longer supported.ErrorEnvelope
429A rate limit, quota or spending limit was reached.ErrorEnvelope
500ExportFlow failed. Safe to retry.ErrorEnvelope
503A dependency is unavailable. Safe to retry.ErrorEnvelope

Verifications#

A verification's status, findings and coverage

GET/public/v1/verifications/{verification_id}

Parameters

Parameters of A verification's status, findings and coverage
ParameterInTypeDescription
verification_idRequiredpathstring (uuid)No further detail.

Responses

Responses of A verification's status, findings and coverage
StatusMeaningBody
200Successful ResponseVerification
400The request is malformed, or the upload was refused.ErrorEnvelope
401The API key is missing or invalid.ErrorEnvelope
403The key may not do this.ErrorEnvelope
404No such resource in this key's environment.ErrorEnvelope
409Not possible in the current state (for example `not_confirmed`), or an idempotency key in use or reused with a different request.ErrorEnvelope
422The request is well formed but not valid.ErrorEnvelope
426This SDK version is no longer supported.ErrorEnvelope
429A rate limit, quota or spending limit was reached.ErrorEnvelope
500ExportFlow failed. Safe to retry.ErrorEnvelope
503A dependency is unavailable. Safe to retry.ErrorEnvelope

Webhook endpoints#

This application's webhook endpoints

GET/public/v1/webhook_endpoints

Responses

Responses of This application's webhook endpoints
StatusMeaningBody
200Successful ResponseWebhookEndpointPage
400The request is malformed, or the upload was refused.ErrorEnvelope
401The API key is missing or invalid.ErrorEnvelope
403The key may not do this.ErrorEnvelope
404No such resource in this key's environment.ErrorEnvelope
409Not possible in the current state (for example `not_confirmed`), or an idempotency key in use or reused with a different request.ErrorEnvelope
422The request is well formed but not valid.ErrorEnvelope
426This SDK version is no longer supported.ErrorEnvelope
429A rate limit, quota or spending limit was reached.ErrorEnvelope
500ExportFlow failed. Safe to retry.ErrorEnvelope
503A dependency is unavailable. Safe to retry.ErrorEnvelope

Register a webhook endpoint

POST/public/v1/webhook_endpoints

Needs an Idempotency-Key header.

Parameters

Parameters of Register a webhook endpoint
ParameterInTypeDescription
Idempotency-KeyRequiredheaderstringAny string of 1 to 255 characters, unique per operation you intend. Repeating a request with the same key and the same body returns the first response; the same key with a different body is refused with idempotency_key_reused. Keys do not expire. 1 to 255 characters.

Request body application/json

Schema: NewWebhookEndpoint. A body is required.

Request body of Register a webhook endpoint
FieldTypeDescription
descriptionOptionalstring | nullAt most 300 characters.
event_typesOptionalarray of stringEmpty subscribes to every event type. At most 20 items.
urlRequiredstring12 to 2000 characters.

Responses

Responses of Register a webhook endpoint
StatusMeaningBody
201Successful ResponseWebhookEndpointCreated
400The request is malformed, or the upload was refused.ErrorEnvelope
401The API key is missing or invalid.ErrorEnvelope
403The key may not do this.ErrorEnvelope
404No such resource in this key's environment.ErrorEnvelope
409Not possible in the current state (for example `not_confirmed`), or an idempotency key in use or reused with a different request.ErrorEnvelope
422The request is well formed but not valid.ErrorEnvelope
426This SDK version is no longer supported.ErrorEnvelope
429A rate limit, quota or spending limit was reached.ErrorEnvelope
500ExportFlow failed. Safe to retry.ErrorEnvelope
503A dependency is unavailable. Safe to retry.ErrorEnvelope

Remove a webhook endpoint

DELETE/public/v1/webhook_endpoints/{endpoint_id}

Needs an Idempotency-Key header.

Parameters

Parameters of Remove a webhook endpoint
ParameterInTypeDescription
endpoint_idRequiredpathstring (uuid)No further detail.
Idempotency-KeyRequiredheaderstringAny string of 1 to 255 characters, unique per operation you intend. Repeating a request with the same key and the same body returns the first response; the same key with a different body is refused with idempotency_key_reused. Keys do not expire. 1 to 255 characters.

Responses

Responses of Remove a webhook endpoint
StatusMeaningBody
204Successful ResponseNo body
400The request is malformed, or the upload was refused.ErrorEnvelope
401The API key is missing or invalid.ErrorEnvelope
403The key may not do this.ErrorEnvelope
404No such resource in this key's environment.ErrorEnvelope
409Not possible in the current state (for example `not_confirmed`), or an idempotency key in use or reused with a different request.ErrorEnvelope
422The request is well formed but not valid.ErrorEnvelope
426This SDK version is no longer supported.ErrorEnvelope
429A rate limit, quota or spending limit was reached.ErrorEnvelope
500ExportFlow failed. Safe to retry.ErrorEnvelope
503A dependency is unavailable. Safe to retry.ErrorEnvelope

Webhook events#

The events a webhook endpoint can receive, from the contract. The webhooks guide covers the payload, signatures and retries. Deliveries are signed in the ExportFlow-Signature header.

Webhook event types
EventWhen it is sentBillable meter
document.uploadedA document was accepted, scanned and stored.document.upload
document.processing.startedClassification began.Not billable
document.processing.completedThe document was classified and read. Fetch its extraction.document.processing
document.processing.failedProcessing stopped. Fetch the document for the reason.Not billable
verification.completedA verification finished. Fetch it for the findings.verification.run
verification.failedA verification could not run. Fetch it for the reason.Not billable
usage.threshold.reachedThe account reached 80% or 100% of a monthly allowance. Sent once for each threshold in a period.Not billable
billing.invoice.generatedAn invoice was issued to your organisation.Not billable
webhook.testYou sent a test event from the console. Never sent for any other reason.Not billable

Schemas#

Every object the API accepts or returns. For an object you send, each field is marked required or optional. A response always carries every field listed; a field that has no value is null.

Upload form

Named Body_upload_document in the contract.

Fields of Upload form
FieldTypeDescription
fileRequiredfileA PDF or an image of one document.

Upload form

Named Body_upload_document_public_v1_shipments__shipment_id__documents_post in the contract.

Fields of Upload form
FieldTypeDescription
filefileA PDF or an image of one document.

ConfirmedField

Fields of ConfirmedField
FieldTypeDescription
absence_reasonOptional"not_applicable" | "missing_from_documents" | "illegible" | nullSupply a value or an absence reason, never both and never neither. Returned on the record as confirmed_absence. illegible added in 1.1.
nameRequiredstring1 to 120 characters.
source_extraction_idOptionalstring (uuid) | nullThe extraction_id of the reading you confirmed, to keep the machine's reading beside the person's answer.
valueOptionalstring | nullAt most 2000 characters.

Document

Fields of Document
FieldTypeDescription
declared_typestring | nullThe type you sent with the upload, if any.
detected_typestring | nullThe type ExportFlow detected.
document_typestring | nullThe type in use: the one you declared, otherwise the one detected. Open text, not a closed list. Types with rules today are bill_of_lading, commercial_invoice, packing_list, certificate_of_origin, phytosanitary_certificate and fpis_certificate; any other type is still read and cross-checked against the shipment's other documents, and reported as cross_checked_only in a verification's coverage. Null until classified, or when the type could not be identified.
duplicatebooleanTrue when this exact file was already on the shipment: the existing document is returned, nothing new is stored and nothing is charged. Default false.
errorstring | nullWhy processing failed, when status is failed.
filenamestring | nullNo further detail.
idstring (uuid)No further detail.
media_typestringNo further detail.
page_countinteger | nullNo further detail.
parent_document_idstring (uuid) | nullSet on a document split out of a larger file. When an upload holds several documents (for example a bill of lading and an invoice scanned into one PDF), the upload becomes split and each part becomes its own document on the same shipment, with this field naming the upload. The parts are processed, listed and verified like any other document; the split upload itself is not read.
sha256stringNo further detail.
shipment_idstring (uuid)No further detail.
status"classifying" | "reading" | "processed" | "failed" | "split"No further detail.
type_confidencenumber | null0 to 1: how sure the detection is.
uploaded_atstring (date-time)No further detail.

DocumentPage

Fields of DocumentPage
FieldTypeDescription
dataarray of DocumentNo further detail.

ErrorDetail

Fields of ErrorDetail
FieldTypeDescription
codestringStable and machine-readable. Branch on this, never on the message. Every code, its HTTP status and what to do about it are listed under x-exportflow.error_codes in this document. New codes may be added.
messagestringFor people. It may be reworded at any time.

ErrorEnvelope

Fields of ErrorEnvelope
FieldTypeDescription
errorErrorDetailNo further detail.

ExtractedField

Fields of ExtractedField
FieldTypeDescription
confidencenumber | null0 to 1, when the reading method gives one.
extraction_idstring (uuid)Cite this when confirming the field, to keep the reading it came from.
methodstringHow the value was read, for example text_layer or vision.
namestringNo further detail.
pageinteger | nullThe page the value was read from, counting from 1.
unavailable_reasonstring | nullWhy there is no value, when there is none: not_present, illegible or provider_failed. A field is never returned as an empty string: it has a value or a reason.
valuestring | nullNo further detail.

Extraction

Fields of Extraction
FieldTypeDescription
document_idstring (uuid)No further detail.
document_typestring | nullNo further detail.
fieldsarray of ExtractedFieldNo further detail.
status"classifying" | "reading" | "processed" | "failed" | "split"No further detail.

Finding

Fields of Finding
FieldTypeDescription
document_idstring (uuid) | nullNo further detail.
expectedstring | nullNo further detail.
fieldstring | nullNo further detail.
foundstring | nullNo further detail.
idstring (uuid)No further detail.
messagestringNo further detail.
rulestringNo further detail.
rule_versionintegerNo further detail.
severity"critical" | "verify" | "clean" | "uncovered" | "unavailable"critical: will cause rejection. verify: inconsistent, and may be intentional; a person should look. clean: a rule ran and passed. uncovered: no rule covers this. unavailable: a value the rule needed could not be read. uncovered and unavailable are not passes: show them differently from clean.

HTTPValidationError

Fields of HTTPValidationError
FieldTypeDescription
detailarray of ValidationErrorNo further detail.

Identity

Who a key is, as the server sees it. The SDK's connection check.

Fields of Identity
FieldTypeDescription
api_versionstringNo further detail.
application_idstring (uuid)No further detail.
application_namestringNo further detail.
environment"sandbox" | "production"No further detail.
key_prefixstringNo further detail.
organisation_idstring (uuid)No further detail.
organisation_namestringNo further detail.
scopesarray of stringEmpty means every scope.

MeterUsage

Fields of MeterUsage
FieldTypeDescription
billable_unitsintegerNo further detail.
estimated_charge_microintegerMillionths of currency. An estimate until an invoice is issued.
failedintegerNo further detail.
meterstringNo further detail.
namestringNo further detail.
quotainteger | nullUnits allowed this period on your plan; null means no limit.
succeededintegerNo further detail.
unitstringNo further detail.

NewShipment

Fields of NewShipment
FieldTypeDescription
commodityOptionalstring | nullAt most 120 characters.
destination_countryOptionalstring | nullISO 3166-1 alpha-2 country code, for example IN. Exactly 2 characters.
destination_portOptionalstring | nullUN/LOCODE of the port of discharge: five characters, country then place, no space. For example INNSA (Nhava Sheva). Exactly 5 characters.
exporter_nameOptionalstring | nullAt most 200 characters.
hs_codeOptionalstring | nullHarmonized System code, digits only, for example 180100. At most 12 characters.
origin_countryOptionalstring | nullISO 3166-1 alpha-2 country code, for example NG. Exactly 2 characters.
referenceOptionalstring | nullYour own identifier for the shipment, for example an order number. At most 120 characters.

NewWebhookEndpoint

Fields of NewWebhookEndpoint
FieldTypeDescription
descriptionOptionalstring | nullAt most 300 characters.
event_typesOptionalarray of stringEmpty subscribes to every event type. At most 20 items.
urlRequiredstring12 to 2000 characters.

ProcessingAccepted

Fields of ProcessingAccepted
FieldTypeDescription
document_idstring (uuid)No further detail.
queuedbooleanFalse when the document was already being processed or already read.
status"classifying" | "reading" | "processed" | "failed" | "split"No further detail.

Reading

One document's reading of a field.

Fields of Reading
FieldTypeDescription
confidencenumber | null0 to 1, when the reading method gives one. Added in 1.1.
document_absencestring | nullWhat a person recorded about this field on this one document, if anything. Added in 1.1.
document_idstring (uuid)No further detail.
extraction_idstring (uuid)Cite this as source_extraction_id when confirming the field.
methodstring | nullHow the value was read. Added in 1.1.
pageinteger | nullThe page the value was read from, counting from 1. Added in 1.1.
unavailable_reasonstring | nullnot_present, illegible or provider_failed when there is no value.
valuestring | nullNo further detail.

Record

What the shipment's documents say, and what has been confirmed.

Fields of Record
FieldTypeDescription
confirmedbooleanTrue once at least one field is confirmed. Verification requires it.
fieldsarray of RecordFieldNo further detail.
shipment_idstring (uuid)No further detail.

RecordConfirmation

Fields of RecordConfirmation
FieldTypeDescription
fieldsRequiredarray of ConfirmedField1 to 200 items.

RecordField

Fields of RecordField
FieldTypeDescription
confirmed_absencestring | nullWhen a person confirmed the field has no value: why. It is the absence_reason sent to PUT /shipments/{id}/record: one of not_applicable, missing_from_documents or illegible.
confirmed_atstring (date-time) | nullWhen the field was confirmed. Null means not confirmed yet.
confirmed_valuestring | nullThe value a person confirmed. Null when not confirmed, or confirmed absent.
namestringNo further detail.
readingsarray of ReadingEvery document's reading of this field. More than one distinct value is the disagreement verification exists to find.

Shipment

A set of documents that travel together and are checked against each other.

Fields of Shipment
FieldTypeDescription
commoditystring | nullNo further detail.
created_atstring (date-time)No further detail.
destination_countrystring | nullNo further detail.
destination_portstring | nullNo further detail.
environment"sandbox" | "production"No further detail.
exporter_namestring | nullNo further detail.
hs_codestring | nullNo further detail.
idstring (uuid)No further detail.
origin_countrystring | nullNo further detail.
referencestring | nullNo further detail.

ShipmentPage

Fields of ShipmentPage
FieldTypeDescription
dataarray of ShipmentNo further detail.

Usage

Fields of Usage
FieldTypeDescription
currencystringNo further detail.
environment"sandbox" | "production"No further detail.
estimated_charge_microintegerNo further detail.
metersarray of MeterUsageNo further detail.
period_endstring (date)Exclusive: the first day of the next period.
period_startstring (date)No further detail.
planstringNo further detail.

ValidationError

Fields of ValidationError
FieldTypeDescription
ctxobjectNo further detail.
inputanyNo further detail.
locarray of (string | integer)No further detail.
msgstringNo further detail.
typestringNo further detail.

Verification

Fields of Verification
FieldTypeDescription
completed_atstring (date-time) | nullNo further detail.
coverageobject | nullWhat was checked and what was not. Evidence of inconsistency is reported; a specification is never certified as met. Null until the verification completes. Keys: rule_set_version, engine_version, rules_effective_on (a date) and effective_date_source; documents, a list of {document_id, type, validation, rules_applied, reason?} where validation is checked (rules for its type ran) or cross_checked_only (its type has no rules: it was only compared with the other documents, which is not a pass); fields_unavailable, a list of {field, reason, document_id}; and, when no shipped-on-board date was confirmed, effective_date_note.
created_atstring (date-time)No further detail.
failure_reasonstring | nullNo further detail.
findingsarray of FindingNo further detail.
idstring (uuid)No further detail.
rule_set_versionintegerNo further detail.
severity_countsmap of string to integerHow many findings of each severity.
shipment_idstring (uuid)No further detail.
status"queued" | "running" | "complete" | "failed"No further detail.

VerificationAccepted

A verification was queued. Fetch it, or wait for verification.completed.

Fields of VerificationAccepted
FieldTypeDescription
idstring (uuid)No further detail.
shipment_idstring (uuid)No further detail.
status"queued"No further detail.

VerificationPage

Fields of VerificationPage
FieldTypeDescription
dataarray of VerificationSummaryNo further detail.

VerificationSummary

Fields of VerificationSummary
FieldTypeDescription
completed_atstring (date-time) | nullNo further detail.
created_atstring (date-time)No further detail.
failure_reasonstring | nullNo further detail.
idstring (uuid)No further detail.
rule_set_versionintegerNo further detail.
severity_countsmap of string to integerHow many findings of each severity.
shipment_idstring (uuid)No further detail.
status"queued" | "running" | "complete" | "failed"No further detail.

WebhookEndpoint

Fields of WebhookEndpoint
FieldTypeDescription
application_idstring (uuid)No further detail.
created_atstring (date-time)No further detail.
descriptionstring | nullNo further detail.
disabled_reasonstring | nullNo further detail.
event_typesarray of stringNo further detail.
idstring (uuid)No further detail.
last_failure_atstring (date-time) | nullNo further detail.
last_success_atstring (date-time) | nullNo further detail.
status"enabled" | "disabled"No further detail.
urlstringNo further detail.

WebhookEndpointCreated

Fields of WebhookEndpointCreated
FieldTypeDescription
application_idstring (uuid)No further detail.
created_atstring (date-time)No further detail.
descriptionstring | nullNo further detail.
disabled_reasonstring | nullNo further detail.
event_typesarray of stringNo further detail.
idstring (uuid)No further detail.
last_failure_atstring (date-time) | nullNo further detail.
last_success_atstring (date-time) | nullNo further detail.
signing_secretstringShown once. Use it to verify the signature on every delivery.
status"enabled" | "disabled"No further detail.
urlstringNo further detail.

WebhookEndpointPage

Fields of WebhookEndpointPage
FieldTypeDescription
dataarray of WebhookEndpointNo further detail.

WebhookEvent

The body of every delivery, signed with ExportFlow-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256 of '<t>.<raw body>'>. Deliveries are at least once: de-duplicate on id. Answer 2xx within 10 seconds. There are no shipment events: a shipment changes only through its documents and verifications.

Fields of WebhookEvent
FieldTypeDescription
api_versionstringNo further detail.
application_idstring,null (uuid)Null for account-level events.
created_atstring (date-time)No further detail.
dataobjectNo further detail.
environment"sandbox" | "production"No further detail.
idstring (uuid)No further detail.
type"document.uploaded" | "document.processing.started" | "document.processing.completed" | "document.processing.failed" | "verification.completed" | "verification.failed" | "usage.threshold.reached" | "billing.invoice.generated" | "webhook.test"No further detail.

WebhookEvent_billing_invoice_generated

The billing.invoice.generated event.

Fields of WebhookEvent_billing_invoice_generated
FieldTypeDescription
api_versionstringNo further detail.
application_idstring,null (uuid)Null for account-level events.
created_atstring (date-time)No further detail.
dataobjectNo further detail.
environment"sandbox" | "production"No further detail.
idstring (uuid)No further detail.
type"billing.invoice.generated"No further detail.

WebhookEvent_document_processing_completed

The document.processing.completed event.

Fields of WebhookEvent_document_processing_completed
FieldTypeDescription
api_versionstringNo further detail.
application_idstring,null (uuid)Null for account-level events.
created_atstring (date-time)No further detail.
dataobjectNo further detail.
environment"sandbox" | "production"No further detail.
idstring (uuid)No further detail.
type"document.processing.completed"No further detail.

WebhookEvent_document_processing_failed

The document.processing.failed event.

Fields of WebhookEvent_document_processing_failed
FieldTypeDescription
api_versionstringNo further detail.
application_idstring,null (uuid)Null for account-level events.
created_atstring (date-time)No further detail.
dataobjectNo further detail.
environment"sandbox" | "production"No further detail.
idstring (uuid)No further detail.
type"document.processing.failed"No further detail.

WebhookEvent_document_processing_started

The document.processing.started event.

Fields of WebhookEvent_document_processing_started
FieldTypeDescription
api_versionstringNo further detail.
application_idstring,null (uuid)Null for account-level events.
created_atstring (date-time)No further detail.
dataobjectNo further detail.
environment"sandbox" | "production"No further detail.
idstring (uuid)No further detail.
type"document.processing.started"No further detail.

WebhookEvent_document_uploaded

The document.uploaded event.

Fields of WebhookEvent_document_uploaded
FieldTypeDescription
api_versionstringNo further detail.
application_idstring,null (uuid)Null for account-level events.
created_atstring (date-time)No further detail.
dataobjectNo further detail.
environment"sandbox" | "production"No further detail.
idstring (uuid)No further detail.
type"document.uploaded"No further detail.

WebhookEvent_usage_threshold_reached

The usage.threshold.reached event.

Fields of WebhookEvent_usage_threshold_reached
FieldTypeDescription
api_versionstringNo further detail.
application_idstring,null (uuid)Null for account-level events.
created_atstring (date-time)No further detail.
dataobjectNo further detail.
environment"sandbox" | "production"No further detail.
idstring (uuid)No further detail.
type"usage.threshold.reached"No further detail.

WebhookEvent_verification_completed

The verification.completed event.

Fields of WebhookEvent_verification_completed
FieldTypeDescription
api_versionstringNo further detail.
application_idstring,null (uuid)Null for account-level events.
created_atstring (date-time)No further detail.
dataobjectNo further detail.
environment"sandbox" | "production"No further detail.
idstring (uuid)No further detail.
type"verification.completed"No further detail.

WebhookEvent_verification_failed

The verification.failed event.

Fields of WebhookEvent_verification_failed
FieldTypeDescription
api_versionstringNo further detail.
application_idstring,null (uuid)Null for account-level events.
created_atstring (date-time)No further detail.
dataobjectNo further detail.
environment"sandbox" | "production"No further detail.
idstring (uuid)No further detail.
type"verification.failed"No further detail.

WebhookEvent_webhook_test

The webhook.test event.

Fields of WebhookEvent_webhook_test
FieldTypeDescription
api_versionstringNo further detail.
application_idstring,null (uuid)Null for account-level events.
created_atstring (date-time)No further detail.
dataobjectNo further detail.
environment"sandbox" | "production"No further detail.
idstring (uuid)No further detail.
type"webhook.test"No further detail.

A complete request#

The first call to make with a new key. It needs no parameters and changes nothing.

curl
curl https://api.exportflow.app/public/v1/me \
  -H "Authorization: Bearer $EXPORTFLOW_API_KEY"