Skip to content

Documents API

Overview

The Documents API manages document images attached to a verification. Each verification can have one document per document type (e.g., one photo ID, one proof of address). Documents are uploaded as base64-encoded images, stored in S3, and returned via temporary signed URLs.

Try it live

Upload and manage documents in the Playground → — add your API token to get started.

Document Types

Context TypeLabelDescription
PHOTO_IDPhoto IDGovernment-issued photo identification (e.g., Passport, Driver License, ID Card)
PROOF_OF_ADDRESSProof of AddressUtility bill, bank statement, or other address verification document
SELFIESelfieLive selfie for face-match verification

Document Status Lifecycle

StatusAPI ValueLabelDescription
Uploaded1UploadedImage uploaded to S3, awaiting processing
In progress2In progressDocument is being processed
Approved3ApprovedAll validation rules passed
Rejected4RejectedOne or more validation rules failed
Double check5Double checkNeeds manual review
Canceled6CanceledDocument was canceled
Extracted7Extracteddata has been extracted from the document

Create Document

POST /api/v1/{flow}/documents

Description

Upload a document image for an existing verification. Accepts base64-encoded images, stores them and begins the verification pipeline.

Each verification can have at most one document per document type. The back_side_data field is excluded entirely for single-sided document types — omit it.

Path Parameters

ParameterTypeDescription
flowstringThe flow path name (e.g. usps1583)

Request Body

ParameterTypeRequiredDescription
verificationstringYesThe verification ID to attach the document to
documentobjectYesDocument details wrapper
document.context_typestringYesDocument context type. One of: PHOTO_ID, PROOF_OF_ADDRESS, SELFIE
document.typeintegerYesDocument type ID from the flow's configured types
document.countrystringYesISO3 country code of the issuing country
document.front_side_datastringYesBase64-encoded image data for the front of the document
document.back_side_datastringConditionalBase64-encoded image data for the back. Excluded for single-sided document types in the selected country.

Example Request

http
POST /api/v1/usps1583/documents
Authorization: Bearer {token}
Content-Type: application/json
Accept: application/json

{
  "verification": "ver_xxxxx",
  "document": {
    "context_type": "PHOTO_ID",
    "type": 5,
    "country": "USA",
    "front_side_data": "/9j/4AAQ...base64_encoded_image_data..."
  }
}

Response (201 Created)

json
{
  "data": {
    "id": "doc_xxxxx",
    "url_front": "https://...",
    "url_back": "https://...",
    "status_label": "Uploaded",
    "verification_id": "ver_xxxxx",
    "document_type": {
      "id": 5,
      "name": "Uniformed Service ID",
      "type_label": "Photo ID"
    },
    "country": {
      "name": "United States of America",
      "iso2": "US",
      "iso3": "USA"
    },
    "created_at": "2026-06-11T02:42:50.000000Z",
    "updated_at": "2026-06-11T02:42:50.000000Z",
    "extracted_data": []
  }
}

Possible Errors

StatusMeaning
400Flow mismatch, verification canceled, verification not in Started status, document type not allowed for flow, duplicate document type, or missing/invalid image data
401Missing or invalid authentication
404Verification not found
422Validation error

Business Rules

  • The verification must belong to the specified flow
  • The verification must be in Started status (not yet submitted)
  • The verification must not be Canceled
  • The document type must be configured for this flow
  • Each verification can have at most one document per document type (e.g., one photo ID, one proof of address)
  • The back_side_data is excluded (not just optional) for single-sided document types based on per-country configuration
  • Image data must be valid base64
  • On success, a DocumentUploaded event is fired to begin processing

Get Document

GET /api/v1/{flow}/documents/{document}

Description

Retrieve a single verification document with its extracted data, decisions, and document type/country information.

Path Parameters

ParameterTypeDescription
flowstringThe flow path name
documentstringThe document ID (e.g. doc_xxxxx)

Example Request

http
GET /api/v1/usps1583/documents/doc_xxxxx
Authorization: Bearer {token}
Accept: application/json

Example Response

json
{
  "data": {
    "id": "doc_xxxxx",
    "url_front": "https://...",
    "url_back": "https://...",
    "status_label": "Rejected",
    "verification_id": "ver_xxxxx",
    "created_at": "2026-06-11T17:14:46.000000Z",
    "updated_at": "2026-06-11T17:16:06.000000Z",
    "extracted_data": {
      "person": {
        "surname": "Simpson",
        "full_name": "Simpson Homer",
        "given_names": "Homer",
        "date_of_birth": "1988-07-23"
      },
      "address": {
        "zip": "92026",
        "city": "Springfield",
        "full": "742 Evergreen Terrace, Springfield, Tennessee 92026",
        "state": "Tennessee",
        "street": "742 Evergreen Terrace",
        "country": "USA"
      },
      "document": {
        "type": "Driver License",
        "number": "",
        "has_selfie": "1",
        "identified": "United States of America - Driver License",
        "country_code": "USA",
        "country_name": "United States of America",
        "issuing_entity": "Government",
        "expiration_date": "2028-07-23",
        "selfie_comparison": "99"
      }
    },
    "decisions": [
      {
        "id": "dec_xxxxx",
        "status_label": "Rejected",
        "validation_workflow": "Automatic",
        "created_at": "2026-06-11T17:15:25.000000Z",
        "updated_at": "2026-06-11T17:15:25.000000Z"
      }
    ]
  }
}

Possible Errors

StatusMeaning
400Document's verification does not belong to the specified flow
401Missing or invalid authentication
404Document not found

Business Rules

  • Document images are served via temporary signed URLs (30-minute expiry)
  • Extracted data is only available after the document has been processed
  • Decisions are only available after a decision has been made

Update Document

PATCH /api/v1/{flow}/documents/{document}

Description

Update an existing verification document's metadata or image files. Only provided fields are updated; omitted fields retain their current values. Accepts base64-encoded images for replacement.

Path Parameters

ParameterTypeDescription
flowstringThe flow path name
documentstringThe document ID

Request Body

ParameterTypeRequiredDescription
verificationstringYesThe verification ID this document belongs to
statusintegerNoNew document status (1–7). Only valid when current status is Uploaded
documentobjectNoDocument details to update
document.context_typestringNoOne of: PHOTO_ID, PROOF_OF_ADDRESS, SELFIE
document.typeintegerNoDocument type ID from the flow's configured types
document.countrystringNoISO3 country code
document.front_side_datastringNoBase64-encoded image data to replace the front image
document.back_side_datastringNoBase64-encoded image data to replace the back image

Example Request

http
PATCH /api/v1/usps1583/documents/doc_xxxxx
Authorization: Bearer {token}
Content-Type: application/json
Accept: application/json

{
  "verification": "ver_xxxxx",
  "document": {
    "context_type": "PHOTO_ID",
    "type": 5,
    "country": "USA",
    "front_side_data": "/9j/4AAQ...new_base64_image..."
  }
}

Example Response

json
{
  "data": {
    "id": "doc_xxxxx",
    "url_front": "https://...",
    "url_back": "https://...",
    "status_label": "Uploaded",
    "verification_id": "ver_xxxxx",
    "created_at": "2026-06-11T02:42:50.000000Z",
    "updated_at": "2026-06-11T03:41:52.000000Z",
    "extracted_data": []
  }
}

Possible Errors

StatusMeaning
400Flow mismatch, document already verified (not in Uploaded status), parent verification not in Started status, or document type not allowed
401Missing or invalid authentication
404Document not found
422Validation error

Business Rules

  • The document must still have status Uploaded — documents that have entered the extraction pipeline cannot be modified
  • The parent verification must still have status Started — submitted verifications cannot have their documents replaced
  • Image data replaces the existing image in S3
  • On success, a DocumentUploaded event is fired

Delete Document

DELETE /api/v1/{flow}/documents/{document}

Description

Delete a verification document. Once deleted, a new document of the same type can be uploaded.

Path Parameters

ParameterTypeDescription
flowstringThe flow path name
documentstringThe document ID

Example Request

http
DELETE /api/v1/usps1583/documents/doc_xxxxx
Authorization: Bearer {token}
Accept: application/json

Response (204 No Content)

No response body.

Possible Errors

StatusMeaning
400Document's verification does not belong to the specified flow
401Missing or invalid authentication
404Document not found

Business Rules

  • After deletion, a new document of the same type can be uploaded
  • Useful when a user provides the wrong document or a low-quality image

Download Document PDF

GET /api/v1/{flow}/documents/{document}/pdf

Description

Generate a PDF containing the document images. Returns a JSON object with the PDF content as a base64-encoded string.

The verification must be in Approved status.

Path Parameters

ParameterTypeDescription
flowstringThe flow path name
documentstringThe document ID

Example Request

http
GET /api/v1/usps1583/documents/doc_xxxxx/pdf
Authorization: Bearer {token}
Accept: application/json

Example Response

json
{
  "data": "JVBERi0xLjQKMSAwIG9iago8PCA..."
}

Possible Errors

StatusMeaning
400Document's verification does not belong to the specified flow
400The verification is not in Approved status
401Missing or invalid authentication
404Document not found

Business Rules

  • The parent verification must be in Approved status
  • The response is a JSON object containing the PDF as a base64-encoded string — NOT a binary stream
  • Useful for record-keeping and audit purposes

Business Rules Summary

  • Documents are scoped to a flow via their parent verification
  • Documents can only be uploaded while the verification is in Started status
  • At most one document per document type per verification
  • A DocumentUploaded event is fired after successful create or update
  • Image URLs are temporary signed URLs with a 30-minute expiry
  • The PDF download endpoint requires the verification to be Approved

Notes

  • For decisions and extracted data updates after processing, use the dedicated Decisions and Extracted Data endpoints

Built for virtual address providers requiring USPS 1583 compliance.