๐Ÿ“„ How to Retrieve Extracted Documents via Clara API

This guide outlines the use of the GET /api/v3/transactions/{uuid}/extracted-documents endpoint to retrieve extracted documents related to a specific transaction in the Clara API

๐Ÿ” Authentication Requirements

To access this endpoint, ensure the following:

  • Use mutual TLS (MTLS) for secure two-way certificate validation.
  • Obtain an OAuth2 access token via the /oauth/token endpoint.
  • Include the Bearer token in the Authorization header of your request.

๐Ÿ”— Endpoint

GET /api/v3/transactions/{uuid}/extracted-documents
  • Base URL examples:
    • https://public-api.mx.clara.com
    • https://public-api.br.clara.com
    • https://public-api.co.clara.com

๐Ÿ”ง Path Parameter

NameTypeRequiredDescription
uuidstringโœ… YesUUID of the transaction

๐Ÿงพ Query Parameters (Optional)

NameTypeDescription
pageintegerPage index, zero-based. Default: 0
sizeintegerItems per page. Default: 20
uuiduuidFilter by extracted document UUID
typeenumFilter by document type: MEXICAN_FISCAL_INVOICE, INVOICE, RECEIPT, OTHER
validationStatusenumFilter by validation status: VALIDATED_BY_CLARA, VALIDATED_BY_USER, NOT_VERIFIED

โœ… Response

Returns a paginated list of extracted documents associated with the transaction. Each document includes metadata and content such as:

Example Document Object

{
  "uuid": "123e4567-e89b-12d3-a456-426614174000",
  "type": "INVOICE",
  "userUuid": "cd22be0b-c074-41d3-8645-77e1507c8562",
  "data": {
    "folioFiscalUuid": "123e4567-e89b-12d3-a456-426614174000",
    "invoiceId": "INV-2023-001",
    "receiptDate": "2023-10-15",
    "issueDate": "2023-10-15",
    "billingDate": "2023-10-31",
    "country": "MX",
    "issuer": {
      "legalName": "ACME Corporation",
      "taxIdentifier": "ABC123456XYZ"
    },
    "items": [
      {
        "name": "Office Chair",
        "unitPrice": 149.99,
        "quantity": 2,
        "total": 299.98
      }
    ],
    "itemsDescription": "Office supplies",
    "amount": {
      "currency": "USD",
      "subTotal": 100.0,
      "taxesAmount": 16.0,
      "tipAmount": 10.0,
      "total": 126.0,
      "taxPercentage": 16.0,
      "tipPercentage": 10.0
    }
  },
  "fileValidation": {
    "status": "VALIDATED_BY_CLARA",
    "date": "2023-10-15T14:30:00",
    "user": "John Doe",
    "userUuid": "123e4567-e89b-12d3-a456-426614174000"
  }
}

๐Ÿงพ Validation Status Details

StatusDescription
VALIDATED_BY_CLARAAutomatically validated successfully
VALIDATED_BY_USERValidated manually by a user
NOT_VERIFIEDDocument could not be validated

โ˜‘๏ธ Successful Response

StatusMeaning
200OK - List of extracted documents returned

โŒ Error Responses

StatusMeaning
400Bad Request
401Unauthorized
403Forbidden

๐Ÿ“˜ Example cURL Request

curl --location --request GET 'https://public-api.mx.clara.com/api/v3/transactions/{uuid}/extracted-documents' \
--header 'Authorization: Bearer {your_access_token}' \
--cert {client_cert_path} \
--key {client_key_path}

Replace {uuid}, {your_access_token}, {client_cert_path}, and {client_key_path} with actual values.


๐Ÿ”š Summary

This endpoint enables retrieval of structured, validated financial documents (invoices, receipts, etc.) tied to a transaction. It supports robust filtering and pagination, and enforces secure access through MTLS and OAuth2.