Suparse

Document Extraction API

Last updated: 2026-05-12

Suparse API Specification

Suparse Document Processing API

Base URLs:

Email: Support

Authentication

  • HTTP Authentication, scheme: bearer
  • API Key (APIKeyHeader)
    • Parameter Name: X-API-Key, in: header.

Documents

Upload, process, and manage financial documents (invoices, receipts, bank statements, and more).

Create document upload URL

POST /api/v1/documents/upload-url

Initiate a two-step document upload by validating file metadata, generating a presigned storage URL, and returning the upload reference ID.

Body parameter

{
  "filename": "string",
  "content_type": "string",
  "size": 0
}

Parameters

NameInTypeRequiredDescription
bodybodyUploadUrlRequesttruenone

Example responses

200 Response

{
  "upload_url": "string",
  "upload_reference_id": "string",
  "expires_in": 0
}

Responses

StatusMeaningDescriptionSchema
200OKSuccessful ResponseUploadUrlResponse
400Bad RequestInvalid file type or file sizeErrorDetail
401UnauthorizedNot authenticatedErrorDetail
422Unprocessable EntityValidation ErrorHTTPValidationError
500Internal Server ErrorFailed to generate upload URLErrorDetail

Direct-to-Storage Document Uploads

Upload Flow

  1. Call the backend to create a presigned upload URL.
  2. Upload the file bytes directly to the returned upload_url with PUT.
  3. Call the backend to confirm the upload and start document processing.

1. Create an Upload URL

POST /api/v1/documents/upload-url
Authorization: Bearer <token>
Content-Type: application/json

API keys are also supported with X-API-Key.

Request body:

{
  "filename": "invoice.pdf",
  "content_type": "application/pdf",
  "size": 123456
}

Fields:

FieldTypeRequiredNotes
filenamestringyesOriginal filename. The backend uses the extension when creating the storage key.
content_typestringyesMust be one of the supported MIME types.
sizeintegeryesFile size in bytes. Must be greater than 0 and no more than 20MB.

Supported MIME types:

MIME typeFile type
application/pdfPDF
image/jpegJPEG
image/pngPNG
image/heicHEIC
image/heifHEIF

Example response:

{
  "upload_url": "https://<storage-endpoint>/<bucket>/<signed-object-key>?...",
  "upload_reference_id": "c4e6.../upload/2026/5/7b4d....pdf",
  "expires_in": 900
}

Response fields:

FieldTypeNotes
upload_urlstringPresigned storage URL. Upload the file to this URL with PUT.
upload_reference_idstringStorage object path. Send this unchanged to confirm-upload.
expires_inintegerURL lifetime in seconds. Current value is 900 seconds.

2. Upload the File to Object Storage

Use PUT against the returned upload_url.

The upload request is made to the external storage URL, not to the Suparse API domain. Do not include the Suparse bearer token or API key on this request. The signature embedded in the URL authorizes the upload.

PUT <upload_url>
Content-Type: application/pdf
Content-Length: 123456
 
<raw file bytes>

The Content-Type must match the content_type value sent to POST /api/v1/documents/upload-url.

The uploaded body must be the same file bytes whose size was sent as size. Browser APIs usually set Content-Length automatically. If using an HTTP client that lets you set it manually, set it to the same byte size.

cURL Example

curl -X PUT "$UPLOAD_URL" \
  -H "Content-Type: application/pdf" \
  --data-binary "@invoice.pdf"

Expected success response from S3-compatible storage is usually 200 OK. Some providers may return another 2xx status. Treat any 2xx response as a successful storage upload.

Common failure causes:

StatusLikely cause
403 ForbiddenURL expired, signature mismatch, wrong Content-Type, or modified URL.
400 Bad RequestInvalid signed headers or request shape.

3. Confirm the Upload

After the storage PUT succeeds, call the backend:

POST /api/v1/documents/confirm-upload
Authorization: Bearer <token>
Content-Type: application/json

Request body:

{
  "upload_reference_id": "c4e6.../upload/2026/5/7b4d....pdf",
  "filename": "invoice.pdf",
  "template_id": null,
  "split": false,
  "auto_approve": false
}

Fields:

FieldTypeRequiredNotes
upload_reference_idstringyesUse the exact value returned by upload-url.
filenamestringyesOriginal filename to display and store in document metadata.
template_idUUID or nullnoOptional extraction template.
splitbooleannoWhether to run targeted splitting when a template is provided.
auto_approvebooleannoWhether eligible processing should be auto-approved.

Example success response:

{
  "task_id": "8b2e6f56-5f5f-4f52-8f8a-07e4628a5a08",
  "document_id": "8b2e6f56-5f5f-4f52-8f8a-07e4628a5a08",
  "status": "processing"
}

The backend verifies that the object exists in storage, samples the first bytes to validate the actual file type, checks credits and template access, creates the document record, and enqueues processing.

Important Client Rules

  • Use PUT for upload_url.
  • Upload raw file bytes, not multipart/form-data.
  • Send the same Content-Type used when creating the upload URL.
  • Complete the storage upload before calling confirm-upload.
  • Preserve upload_reference_id exactly as returned.
  • Do not send Suparse authorization headers to the external storage URL.
  • Retry by requesting a new upload_url if the URL expires.

Confirm document upload

POST /api/v1/documents/confirm-upload

Confirm a completed storage upload, validate uploaded content, check credits, create the document record, enqueue processing, and return the parent document ID as task_id for polling with GET /api/v1/tasks/{task_id}.

Body parameter

{
  "upload_reference_id": "string",
  "filename": "string",
  "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc",
  "split": false,
  "auto_approve": false
}

Parameters

NameInTypeRequiredDescription
bodybodyConfirmUploadRequesttruenone

Example responses

202 Response

{
  "task_id": "736fde4d-9029-4915-8189-01353d6982cb",
  "document_id": "b792e8ae-2cb4-4209-85b9-32be4c2fcdd6",
  "status": "processing"
}

Responses

StatusMeaningDescriptionSchema
202AcceptedSuccessful ResponseConfirmUploadResponse
400Bad RequestInvalid file content or user team stateErrorDetail
401UnauthorizedNot authenticatedErrorDetail
403ForbiddenInsufficient credits or invalid templateErrorDetail
404Not FoundUploaded file not foundErrorDetail
422Unprocessable EntityValidation ErrorHTTPValidationError
500Internal Server ErrorFailed to validate uploadErrorDetail

Bulk delete documents

DELETE /api/v1/documents/

Soft-delete one or more accessible documents, cascade deletion to descendants, deactivate storage records, and delete physical files from storage best-effort.

Body parameter

{
  "document_ids": [
    "497f6eca-6276-4993-bfeb-53cbbbba6f08"
  ]
}

Parameters

NameInTypeRequiredDescription
bodybodyDocumentBulkDeletetruenone

Example responses

401 Response

{
  "detail": "string"
}

Responses

StatusMeaningDescriptionSchema
204No ContentSuccessful ResponseNone
401UnauthorizedNot authenticatedErrorDetail
403ForbiddenUser has no team or cannot delete requested documentsErrorDetail
404Not FoundNo accessible documents foundErrorDetail
422Unprocessable EntityValidation ErrorHTTPValidationError

Get document extraction JSON

GET /api/v1/documents/{document_id}

Return the structured extraction JSON for one processed document. This is the single-document convenience equivalent of POST /api/v1/exports/documents?format=json with a body containing this document ID. The document must belong to the authenticated user's team, must be accessible, and must have a processing result.

Parameters

NameInTypeRequiredDescription
document_idpathstring(uuid)truenone

Example responses

200 Response

{
  "task_id": "736fde4d-9029-4915-8189-01353d6982cb",
  "original_file": "string",
  "total_documents_extracted": 0,
  "documents": [
    {
      "document_id": "b792e8ae-2cb4-4209-85b9-32be4c2fcdd6",
      "file_name": "string",
      "page_start": 0,
      "page_end": 0,
      "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc",
      "credits_used": 0,
      "extracted_data": {}
    }
  ]
}

Responses

StatusMeaningDescriptionSchema
200OKSuccessful ResponseDocumentExtractionResponse
400Bad RequestUser is not part of a teamErrorDetail
401UnauthorizedNot authenticatedErrorDetail
404Not FoundDocument not found, access denied, or no extraction result existsErrorDetail
422Unprocessable EntityValidation ErrorHTTPValidationError
500Internal Server ErrorDatabase error occurredErrorDetail

Templates

Create and manage custom document parsing templates for repeatable extraction workflows.

List templates

GET /api/v1/templates

List active system templates and active templates belonging to the authenticated user's team with explicit team filtering.

Example responses

200 Response

[
  {
    "name": "string",
    "description": "stringst",
    "template_language": "str",
    "schema_definition": {
      "general_part": {
        "property1": {
          "name": "string",
          "prompt": "string",
          "field_type": "general",
          "format_type": "text",
          "format_options": [
            "string"
          ],
          "position": 0,
          "char_limit": 15000,
          "is_editable": true,
          "is_displayed": true,
          "qbo_mapping": "string"
        },
        "property2": {
          "name": "string",
          "prompt": "string",
          "field_type": "general",
          "format_type": "text",
          "format_options": [
            "string"
          ],
          "position": 0,
          "char_limit": 15000,
          "is_editable": true,
          "is_displayed": true,
          "qbo_mapping": "string"
        }
      },
      "table_part": {
        "property1": {
          "name": "string",
          "prompt": "string",
          "field_type": "general",
          "format_type": "text",
          "format_options": [
            "string"
          ],
          "position": 0,
          "char_limit": 15000,
          "is_editable": true,
          "is_displayed": true,
          "qbo_mapping": "string"
        },
        "property2": {
          "name": "string",
          "prompt": "string",
          "field_type": "general",
          "format_type": "text",
          "format_options": [
            "string"
          ],
          "position": 0,
          "char_limit": 15000,
          "is_editable": true,
          "is_displayed": true,
          "qbo_mapping": "string"
        }
      }
    },
    "prompt_set": {
      "global_instructions": "string",
      "general_prompt": "string",
      "table_prompt": "string"
    },
    "validation_rules": {
      "rules": [
        {
          "rule_name": "string",
          "rule_type": "required",
          "targets": [
            "string"
          ],
          "config": {
            "set_1": [
              "string"
            ],
            "set_2": [
              "string"
            ],
            "tolerance": 0,
            "alternatives": [
              {
                "set_2": [
                  "string"
                ],
                "label": "string"
              }
            ]
          }
        }
      ]
    },
    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
    "template_group_id": "d11c98e2-fc64-4f02-9eed-d318de7100fa",
    "parent_template_id": "f3fd427a-ba48-458c-bcf9-3018d926ddce",
    "version": 0,
    "team_id": "810007d0-bec5-486c-b5d1-28fcd8a079ba",
    "is_active": true,
    "is_system_template": true,
    "created_at": "2019-08-24T14:15:22Z",
    "created_by_user_id": "209f54c4-4c33-43bc-9c6a-ef4c65ad7473"
  }
]

Responses

StatusMeaningDescriptionSchema
200OKSuccessful ResponseInline
401UnauthorizedNot authenticatedErrorDetail
500Internal Server ErrorFailed to retrieve templatesErrorDetail

Response Schema

Status Code 200

Response List Templates Api V1 Templates Get

FieldTypeRequiredDescription
Response List Templates Api V1 Templates GetExtractionTemplateRead[]no
-ExtractionTemplateReadExtractionTemplateReadno
--namestringyesTemplate name
--descriptionstring | nullnoShort description
--template_languagestringyes
--schema_definitionSchemaDefinitionyesThe complete, validatable schema definition for an extraction template.
---general_partobjectnoDictionary of general fields.
----FieldMetadataFieldMetadatanoDefines the validated structure for the metadata of a single user-defined field.
-----namestringyesUser-facing display name.
-----promptstring | nullnoSpecific prompt instructions for this field.
-----field_typestringyes
-----format_typestringyes
-----format_optionsstring[] | nullnoChoices for 'multiple_choice' type.
-----positionintegeryesThe display order in the UI.
-----char_limitintegernoCharacter limit for the field description.
-----is_editablebooleannoControls if the value can be manually corrected.
-----is_displayedbooleannoControls UI visibility of this field.
-----qbo_mappingstring | nullnoSemantic tag for QuickBooks mapping.
---table_partobject | nullnoDictionary of table columns.
-----FieldMetadataFieldMetadatanoDefines the validated structure for the metadata of a single user-defined field.
--prompt_setPromptSetyesContains the prompt templates for general and table extraction.
---global_instructionsstring | nullnoOptional instructions prepended to all prompts.
---general_promptstringyesMain prompt for general data extraction.
---table_promptstringyesPrompt for extracting table rows.
--validation_rulesValidationRulesyes
---rulesValidationRule[]no
----ValidationRuleValidationRuleno
-----rule_namestringyesUser-friendly name for the validation rule.
-----rule_typestringyes
-----targetsstring[]noList of field paths (e.g., 'general_part.invoice_date').
-----configValidationRuleConfignoConfiguration parameters for validation rules.
------set_1string[] | nullnoList of field paths for LHS of equation (compare_totals).
------set_2string[] | nullnoList of field paths for RHS of equation (compare_totals).
------tolerancenumber | string | nullnoAllowed difference for float comparison.
------alternativesComparisonAlternative[] | nullnoAlternative comparisons to try if primary fails. Passes if ANY succeeds.
--------ComparisonAlternativeComparisonAlternativenoA single alternative comparison for OR logic in compare_totals.
---------set_2string[]yesAlternative set_2 field paths to try if primary comparison fails.
---------labelstring | nullnoOptional label for this alternative (e.g., 'vs subtotal').
--idstring(uuid)yes
--template_group_idstring(uuid)yes
--parent_template_idstring(uuid) | nullyes
--versionintegeryes
--team_idstring(uuid) | nullyes
--is_activebooleanyes
--is_system_templatebooleanyes
--created_atstring(date-time)yes
--created_by_user_idstring(uuid)yes

Enumerated Values

PropertyValue
field_typegeneral
field_typetable
format_typetext
format_typenumber
format_typedate
format_typeboolean
format_typemultiple_choice
rule_typerequired
rule_typecompare_totals

Exports

Export extracted data as CSV, Excel, or Google Sheets.

Export documents

POST /api/v1/exports/documents

Export processed data for one or more documents in the chosen format. Supports original mode (each document with its processing template) and unified mode (groups by template group, projecting all data onto the latest active template schema). For json, csv, and xlsx, the response body is the generated export file returned directly from this request with a Content-Disposition attachment filename. If the export produces multiple files, the response is a ZIP archive. For google_sheets, the response is JSON containing the created spreadsheet URL(s) or Drive folder URL.

Body parameter

{
  "document_ids": [
    "497f6eca-6276-4993-bfeb-53cbbbba6f08"
  ]
}

Parameters

NameInTypeRequiredDescription
formatqueryExportFormattrueDownload format: json, csv, xlsx, or google_sheets
export_typequeryExportTypefalseExport type: 'original' for full data, 'unified' for standardized data.
bodybodyDownloadRequesttruenone

Enumerated Values

ParameterValue
formatjson
formatcsv
formatxlsx
formatquickbooks_csv
formatgoogle_sheets
export_typeoriginal
export_typeunified

Example responses

200 Response

[
  {}
]

Responses

StatusMeaningDescriptionSchema
200OKExport file bytes for json/csv/xlsx formats, a ZIP archive when multiple files are generated, or a JSON object with Google Sheets URL(s) for format=google_sheets.string
401UnauthorizedNot authenticatedErrorDetail
404Not FoundNo accessible documents found for the given IDsErrorDetail
422Unprocessable EntityValidation ErrorHTTPValidationError
500Internal Server ErrorFailed to generate export filesErrorDetail

Response Headers

StatusHeaderTypeFormatDescription
200Content-DispositionstringAttachment filename for direct file downloads.

Tasks

Check the status of background document processing tasks.

Get task status

GET /api/v1/tasks/{task_id}

Get the aggregated status of a document processing task. The task_id is the document_id of the parent document from the initial upload. Designed to be polled by clients to track progress from classification through completion.

Parameters

NameInTypeRequiredDescription
task_idpathstring(uuid)truenone

Example responses

200 Response

{
  "task_id": "736fde4d-9029-4915-8189-01353d6982cb",
  "overall_status": "uploading",
  "created_at": "2019-08-24T14:15:22Z",
  "completed_at": "2019-08-24T14:15:22Z",
  "error_message": "string",
  "sub_documents": [],
  "internal_details": {}
}

Responses

StatusMeaningDescriptionSchema
200OKSuccessful ResponseTaskStatusResponse
401UnauthorizedNot authenticatedErrorDetail
404Not FoundTask not foundErrorDetail
422Unprocessable EntityValidation ErrorHTTPValidationError
500Internal Server ErrorInternal server errorErrorDetail

Schemas

ComparisonAlternative

{
  "set_2": [
    "string"
  ],
  "label": "string"
}
 

Properties

FieldTypeRequiredDescription
set_2string[]yesAlternative set_2 field paths to try if primary comparison fails.
labelstring | nullnoOptional label for this alternative (e.g., 'vs subtotal').

ConfirmUploadRequest

{
  "upload_reference_id": "string",
  "filename": "string",
  "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc",
  "split": false,
  "auto_approve": false
}
 

Properties

FieldTypeRequiredDescription
upload_reference_idstringyes
filenamestringyes
template_idstring(uuid) | nullno
splitbooleanno
auto_approvebooleanno

ConfirmUploadResponse

{
  "task_id": "736fde4d-9029-4915-8189-01353d6982cb",
  "document_id": "b792e8ae-2cb4-4209-85b9-32be4c2fcdd6",
  "status": "processing"
}
 

Properties

FieldTypeRequiredDescription
task_idstring(uuid)yesID to poll via GET /api/v1/tasks/{task_id}. This is the parent document_id.
document_idstring(uuid)yesParent document ID created for the upload. Same value as task_id.
statusstringyes

DocumentBulkDelete

{
  "document_ids": [
    "497f6eca-6276-4993-bfeb-53cbbbba6f08"
  ]
}
 

Properties

FieldTypeRequiredDescription
document_idsstring[]yes

DocumentExtractionItem

{
  "document_id": "b792e8ae-2cb4-4209-85b9-32be4c2fcdd6",
  "file_name": "string",
  "page_start": 0,
  "page_end": 0,
  "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc",
  "credits_used": 0,
  "extracted_data": {}
}
 

Properties

FieldTypeRequiredDescription
document_idstring(uuid)yesDocument ID that produced this extraction result.
file_namestringyesStored document filename.
page_startintegeryesOne-based start page for this extracted document.
page_endintegeryesOne-based end page for this extracted document.
template_idstring(uuid) | nullyesTemplate used to process the document.
credits_usedintegeryesCredits consumed by this document, currently equal to page count.
extracted_dataobjectyesStructured extraction result for the document.

DocumentExtractionResponse

{
  "task_id": "736fde4d-9029-4915-8189-01353d6982cb",
  "original_file": "string",
  "total_documents_extracted": 0,
  "documents": [
    {
      "document_id": "b792e8ae-2cb4-4209-85b9-32be4c2fcdd6",
      "file_name": "string",
      "page_start": 0,
      "page_end": 0,
      "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc",
      "credits_used": 0,
      "extracted_data": {}
    }
  ]
}
 

Properties

FieldTypeRequiredDescription
task_idstring(uuid)yesParent task/document ID. For standalone documents this is the requested document ID.
original_filestringyesOriginal parent upload filename.
total_documents_extractedintegeryesNumber of extracted documents included in this response.
documentsDocumentExtractionItem[]yesExtraction result entries. This endpoint returns entries for the requested document only.

DownloadRequest

{
  "document_ids": [
    "497f6eca-6276-4993-bfeb-53cbbbba6f08"
  ]
}
 

Properties

FieldTypeRequiredDescription
document_idsstring[]yes

ErrorDetail

{
  "detail": "string"
}
 

Properties

FieldTypeRequiredDescription
detailstringyes

ExportFormat

"json"
 

Properties

FieldTypeRequiredDescription
ExportFormatstringno

Enumerated Values

PropertyValue
ExportFormatjson
ExportFormatcsv
ExportFormatxlsx
ExportFormatquickbooks_csv
ExportFormatgoogle_sheets

ExportType

"original"
 

Properties

FieldTypeRequiredDescription
ExportTypestringno

Enumerated Values

PropertyValue
ExportTypeoriginal
ExportTypeunified

ExtractionTemplateRead

{
  "name": "string",
  "description": "stringst",
  "template_language": "str",
  "schema_definition": {
    "general_part": {
      "property1": {
        "name": "string",
        "prompt": "string",
        "field_type": "general",
        "format_type": "text",
        "format_options": [
          "string"
        ],
        "position": 0,
        "char_limit": 15000,
        "is_editable": true,
        "is_displayed": true,
        "qbo_mapping": "string"
      },
      "property2": {
        "name": "string",
        "prompt": "string",
        "field_type": "general",
        "format_type": "text",
        "format_options": [
          "string"
        ],
        "position": 0,
        "char_limit": 15000,
        "is_editable": true,
        "is_displayed": true,
        "qbo_mapping": "string"
      }
    },
    "table_part": {
      "property1": {
        "name": "string",
        "prompt": "string",
        "field_type": "general",
        "format_type": "text",
        "format_options": [
          "string"
        ],
        "position": 0,
        "char_limit": 15000,
        "is_editable": true,
        "is_displayed": true,
        "qbo_mapping": "string"
      },
      "property2": {
        "name": "string",
        "prompt": "string",
        "field_type": "general",
        "format_type": "text",
        "format_options": [
          "string"
        ],
        "position": 0,
        "char_limit": 15000,
        "is_editable": true,
        "is_displayed": true,
        "qbo_mapping": "string"
      }
    }
  },
  "prompt_set": {
    "global_instructions": "string",
    "general_prompt": "string",
    "table_prompt": "string"
  },
  "validation_rules": {
    "rules": [
      {
        "rule_name": "string",
        "rule_type": "required",
        "targets": [
          "string"
        ],
        "config": {
          "set_1": [
            "string"
          ],
          "set_2": [
            "string"
          ],
          "tolerance": 0,
          "alternatives": [
            {
              "set_2": [
                "string"
              ],
              "label": "string"
            }
          ]
        }
      }
    ]
  },
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "template_group_id": "d11c98e2-fc64-4f02-9eed-d318de7100fa",
  "parent_template_id": "f3fd427a-ba48-458c-bcf9-3018d926ddce",
  "version": 0,
  "team_id": "810007d0-bec5-486c-b5d1-28fcd8a079ba",
  "is_active": true,
  "is_system_template": true,
  "created_at": "2019-08-24T14:15:22Z",
  "created_by_user_id": "209f54c4-4c33-43bc-9c6a-ef4c65ad7473"
}
 

Properties

FieldTypeRequiredDescription
namestringyesTemplate name
descriptionstring | nullnoShort description
template_languagestringyes
schema_definitionSchemaDefinitionyesThe complete, validatable schema definition for an extraction template.
prompt_setPromptSetyesContains the prompt templates for general and table extraction.
validation_rulesValidationRulesyes
idstring(uuid)yes
template_group_idstring(uuid)yes
parent_template_idstring(uuid) | nullyes
versionintegeryes
team_idstring(uuid) | nullyes
is_activebooleanyes
is_system_templatebooleanyes
created_atstring(date-time)yes
created_by_user_idstring(uuid)yes

FieldMetadata

{
  "name": "string",
  "prompt": "string",
  "field_type": "general",
  "format_type": "text",
  "format_options": [
    "string"
  ],
  "position": 0,
  "char_limit": 15000,
  "is_editable": true,
  "is_displayed": true,
  "qbo_mapping": "string"
}
 

Properties

FieldTypeRequiredDescription
namestringyesUser-facing display name.
promptstring | nullnoSpecific prompt instructions for this field.
field_typestringyes
format_typestringyes
format_optionsstring[] | nullnoChoices for 'multiple_choice' type.
positionintegeryesThe display order in the UI.
char_limitintegernoCharacter limit for the field description.
is_editablebooleannoControls if the value can be manually corrected.
is_displayedbooleannoControls UI visibility of this field.
qbo_mappingstring | nullnoSemantic tag for QuickBooks mapping.

Enumerated Values

PropertyValue
field_typegeneral
field_typetable
format_typetext
format_typenumber
format_typedate
format_typeboolean
format_typemultiple_choice

HTTPValidationError

{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}
 

Properties

FieldTypeRequiredDescription
detailValidationError[]no

OverallTaskStatus

"uploading"
 

Properties

FieldTypeRequiredDescription
OverallTaskStatusstringno

Enumerated Values

PropertyValue
OverallTaskStatusuploading
OverallTaskStatusclassifying
OverallTaskStatusawaiting_approval
OverallTaskStatusprocessing
OverallTaskStatuspartially_completed
OverallTaskStatuscompleted
OverallTaskStatusfailed
OverallTaskStatusinsufficient_credits

PromptSet

{
  "global_instructions": "string",
  "general_prompt": "string",
  "table_prompt": "string"
}
 

Properties

FieldTypeRequiredDescription
global_instructionsstring | nullnoOptional instructions prepended to all prompts.
general_promptstringyesMain prompt for general data extraction.
table_promptstringyesPrompt for extracting table rows.

SchemaDefinition

{
  "general_part": {
    "property1": {
      "name": "string",
      "prompt": "string",
      "field_type": "general",
      "format_type": "text",
      "format_options": [
        "string"
      ],
      "position": 0,
      "char_limit": 15000,
      "is_editable": true,
      "is_displayed": true,
      "qbo_mapping": "string"
    },
    "property2": {
      "name": "string",
      "prompt": "string",
      "field_type": "general",
      "format_type": "text",
      "format_options": [
        "string"
      ],
      "position": 0,
      "char_limit": 15000,
      "is_editable": true,
      "is_displayed": true,
      "qbo_mapping": "string"
    }
  },
  "table_part": {
    "property1": {
      "name": "string",
      "prompt": "string",
      "field_type": "general",
      "format_type": "text",
      "format_options": [
        "string"
      ],
      "position": 0,
      "char_limit": 15000,
      "is_editable": true,
      "is_displayed": true,
      "qbo_mapping": "string"
    },
    "property2": {
      "name": "string",
      "prompt": "string",
      "field_type": "general",
      "format_type": "text",
      "format_options": [
        "string"
      ],
      "position": 0,
      "char_limit": 15000,
      "is_editable": true,
      "is_displayed": true,
      "qbo_mapping": "string"
    }
  }
}
 

Properties

FieldTypeRequiredDescription
general_partobjectnoDictionary of general fields.
-additionalPropertiesFieldMetadatanoDefines the validated structure for the metadata of a single user-defined field.
table_partobject | nullnoDictionary of table columns.
--additionalPropertiesFieldMetadatanoDefines the validated structure for the metadata of a single user-defined field.

SubDocumentStatus

{
  "document_id": "b792e8ae-2cb4-4209-85b9-32be4c2fcdd6",
  "status": "string",
  "assigned_template_name": "string"
}
 

Properties

FieldTypeRequiredDescription
document_idstring(uuid)yes
statusstringyes
assigned_template_namestring | nullno

TaskStatusResponse

{
  "task_id": "736fde4d-9029-4915-8189-01353d6982cb",
  "overall_status": "uploading",
  "created_at": "2019-08-24T14:15:22Z",
  "completed_at": "2019-08-24T14:15:22Z",
  "error_message": "string",
  "sub_documents": [],
  "internal_details": {}
}
 

Properties

FieldTypeRequiredDescription
task_idstring(uuid)yes
overall_statusOverallTaskStatusyes
created_atstring(date-time)yes
completed_atstring(date-time) | nullno
error_messagestring | nullno
sub_documentsSubDocumentStatus[]no
internal_detailsobject | nullno

UploadUrlRequest

{
  "filename": "string",
  "content_type": "string",
  "size": 0
}
 

Properties

FieldTypeRequiredDescription
filenamestringyes
content_typestringyes
sizeintegeryesFile size in bytes.

UploadUrlResponse

{
  "upload_url": "string",
  "upload_reference_id": "string",
  "expires_in": 0
}
 

Properties

FieldTypeRequiredDescription
upload_urlstringyes
upload_reference_idstringyes
expires_inintegeryes

ValidationError

{
  "loc": [
    "string"
  ],
  "msg": "string",
  "type": "string",
  "input": null,
  "ctx": {}
}
 

Properties

FieldTypeRequiredDescription
locstring | integeryes
msgstringyes
typestringyes
inputanyno
ctxobjectno

ValidationRule

{
  "rule_name": "string",
  "rule_type": "required",
  "targets": [
    "string"
  ],
  "config": {
    "set_1": [
      "string"
    ],
    "set_2": [
      "string"
    ],
    "tolerance": 0,
    "alternatives": [
      {
        "set_2": [
          "string"
        ],
        "label": "string"
      }
    ]
  }
}
 

Properties

FieldTypeRequiredDescription
rule_namestringyesUser-friendly name for the validation rule.
rule_typestringyes
targetsstring[]noList of field paths (e.g., 'general_part.invoice_date').
configValidationRuleConfignoRule-specific configuration parameters.

Enumerated Values

PropertyValue
rule_typerequired
rule_typecompare_totals

ValidationRuleConfig

{
  "set_1": [
    "string"
  ],
  "set_2": [
    "string"
  ],
  "tolerance": 0,
  "alternatives": [
    {
      "set_2": [
        "string"
      ],
      "label": "string"
    }
  ]
}
 

Properties

FieldTypeRequiredDescription
set_1string[] | nullnoList of field paths for LHS of equation (compare_totals).
set_2string[] | nullnoList of field paths for RHS of equation (compare_totals).
tolerancenumber | string | nullnoAllowed difference for float comparison.
alternativesComparisonAlternative[] | nullnoAlternative comparisons to try if primary fails. Passes if ANY succeeds.

ValidationRules

{
  "rules": [
    {
      "rule_name": "string",
      "rule_type": "required",
      "targets": [
        "string"
      ],
      "config": {
        "set_1": [
          "string"
        ],
        "set_2": [
          "string"
        ],
        "tolerance": 0,
        "alternatives": [
          {
            "set_2": [
              "string"
            ],
            "label": "string"
          }
        ]
      }
    }
  ]
}
 

Properties

FieldTypeRequiredDescription
rulesValidationRule[]no