POST/document/extract

post extract

Extract and validate information from documents

Request attributes

document_typeRequiredstring

The type of document to extract information from

Enum values

identityorganisation_docproof_of_addresstax_docinvoice
payloadConditionalstring

Base64 encoded document payload (required if source is base64)

  • Required when `source=base64`
sourceRequiredstring

The source of the document

Enum values

base64url
validationsOptionalobject

Validations to perform on the extracted information

Child attributes (2)
expiryOptionalobject

Document expiry validation. This is used to validate that the document is not expired or will not expire within a certain number of months.

Child attributes (2)
minimum_months_until_expiryOptionalinteger

Minimum number of months until the document expires

  • Format: int64
  • Minimum: 1
validate_not_expiredOptionalboolean

Whether to validate that the document is not expired

fieldsOptionalarray<object>

Field-level validations. These are used to validate the extracted information against some expected values.

Child attributes (3)
validations.fields[].expected_valueConditionalstring

The expected value for the field

  • Required when parent `fields` is present
validations.fields[].fieldConditionalstring

The field name to validate

Enum values

document_numbersurnamegiven_name
  • Required when parent `fields` is present
  • Allowed values depend on the selected example context
validations.fields[].match_typeConditionalstring

The type of match to perform

Enum values

exactfuzzy
  • Required when parent `fields` is present

Response attributes

date_of_birthOptionalstring

The date of birth of the holder of the document. Could be YYYY-MM-DD, YYYY-MM, or YYYY.

document_date_of_issueOptionalstring

The date the document was issued. Could be YYYY-MM-DD, YYYY-MM, or YYYY.

document_expiry_dateOptionalstring

The date the document expires. Could be YYYY-MM-DD, YYYY-MM, or YYYY.

document_issuing_authorityOptionalstring

Authority that issued the document

document_numberOptionalstring

The document number

document_typeRequiredstring

The type of document that was extracted

Enum values

identityorganisation_docproof_of_addresstax_docinvoice
given_nameOptionalstring

The given name of the holder of the document

idRequiredstring

The unique identifier of the object

issuing_countryOptionalstring

The country that issued the document in ISO 3166-1 alpha-2 format

  • Min length: 2
  • Max length: 2
livemodeRequiredboolean

Indicates whether the object was created in live mode (true) or sandbox mode (false)

objectRequiredstring

The type of object

place_of_birthConditionalstring

The place of birth of the holder of the document

  • Required when `document_type=identity`
surnameOptionalstring

The surname of the holder of the document

validation_resultOptionalobject

The result of the validations performed on the extracted information

Child attributes (4)
checksRequiredarray<object>

The individual checks that were performed

Child attributes (9)
validation_result.checks[].check_nameConditionalstring

The name of the specific expiry check

Enum values

validate_document_not_expiredminimum_months_until_expiry
  • Required when `check_type=expiry_validation`
validation_result.checks[].check_typeRequiredstring

The type of check performed

Enum values

field_validationexpiry_validationrecency_validationstatement_coverage_validationstatement_recency_validation
validation_result.checks[].document_expiry_dateConditionalstring

The expiry date of the document

  • Required when `check_type=expiry_validation`
validation_result.checks[].expected_valueConditionalstring

The expected value for the field

  • Required when `check_type=field_validation`
validation_result.checks[].extracted_valueConditionalstring

The actual value that was extracted from the document

  • Required when `status=passed,failed`
validation_result.checks[].fieldConditionalstring

The field that was validated

  • Required when `check_type=field_validation`
validation_result.checks[].match_typeConditionalstring

The type of match performed

Enum values

exactfuzzy
  • Required when `check_type=field_validation`
validation_result.checks[].months_until_expiryConditionalinteger

The number of months until the document expires

  • Format: int64
  • Required when `check_name=minimum_months_until_expiry`
validation_result.checks[].statusRequiredstring

The status of the check

Enum values

passedfailedskipped
number_of_checks_failedRequiredinteger

The number of checks that failed

  • Format: int64
  • Minimum: 0
number_of_checks_passedRequiredinteger

The number of checks that passed

  • Format: int64
  • Minimum: 0
number_of_checks_skippedRequiredinteger

The number of checks that were skipped

  • Format: int64
  • Minimum: 0

Request and response examples

Base URL: https://api.infraredaml.com

Document type

Request source

Extracting from Identity Document using base64 payload

POST /document/extract
{
  "document_type": "identity",
  "payload": "JVBERi0xLjYNJeLjz9MNCjg1NDU1IDAgb2JqDTw8L0xpbm",
  "source": "base64",
  "validations": {
    "expiry": {
      "minimum_months_until_expiry": 6,
      "validate_not_expired": true
    },
    "fields": [
      {
        "expected_value": "ABC123456",
        "field": "document_number",
        "match_type": "exact"
      },
      {
        "expected_value": "Banks",
        "field": "surname",
        "match_type": "fuzzy"
      },
      {
        "expected_value": "Jordan",
        "field": "given_name",
        "match_type": "exact"
      }
    ]
  }
}

Extraction result for an identity document

Response 200
{
  "date_of_birth": "1960-02-06",
  "document_date_of_issue": "2025-02-06",
  "document_expiry_date": "2035-02-06",
  "document_issuing_authority": "San Francisco",
  "document_number": "ABC123456",
  "document_type": "identity",
  "given_name": "Jordan",
  "id": "dxr_V1StGXR8Z5jdHi6BmyT",
  "issuing_country": "US",
  "livemode": true,
  "object": "document_extraction",
  "place_of_birth": "San Francisco, CA",
  "surname": "Banks",
  "validation_result": {
    "checks": [
      {
        "check_type": "field_validation",
        "expected_value": "Banks",
        "extracted_value": "Banks",
        "field": "surname",
        "match_type": "fuzzy",
        "status": "passed"
      },
      {
        "check_type": "field_validation",
        "expected_value": "Jordan",
        "extracted_value": "Jordan",
        "field": "given_name",
        "match_type": "exact",
        "status": "passed"
      },
      {
        "check_type": "field_validation",
        "expected_value": "ABC123456",
        "extracted_value": "ABC123456",
        "field": "document_number",
        "match_type": "exact",
        "status": "passed"
      },
      {
        "check_name": "validate_document_not_expired",
        "check_type": "expiry_validation",
        "document_expiry_date": "2025-02-06",
        "status": "passed"
      },
      {
        "check_name": "minimum_months_until_expiry",
        "check_type": "expiry_validation",
        "document_expiry_date": "2025-02-06",
        "months_until_expiry": 48,
        "status": "passed"
      }
    ],
    "number_of_checks_failed": 0,
    "number_of_checks_passed": 5,
    "number_of_checks_skipped": 0
  }
}

Responses

  • 200OK response.