Get File Data

GET
/api/v1/document/get-file-data

Retrieve processed document data and check processing status. This endpoint supports both synchronous and asynchronous workflows, returning either the extracted data or processing status based on the job state.

Use Cases

Async Processing Status

Poll for processing status and results after submitting a job via the async process-file-async endpoint. Returns status updates during processing.

Webhook Data Retrieval

Fetch the actual extracted data using metadata from webhook events (fileId and extractionSchemaId from webhook payload).

Request Parameters

Query Parameters
required
fileIdstring

The unique identifier of the file (from upload response or webhook event payload).

required
extractionSchemaIdstring

The extraction schema ID used to process the file.

Headers
required
Authorizationstring

Bearer token for authentication.

Response Types

This endpoint returns different response formats based on the processing state and whether the file was processed using sync or async workflows.

PROCESSING Status (Async)

Returned when an async job is currently being processed. Continue polling until status changes.

processing-status.json
COMPLETED Status (Async) or Completed File (Sync)

Returned when processing completed successfully. Contains the full extracted data along with optional status information for async jobs.

completed-status.json
FAILED Status (Async)

Returned when async processing failed due to an error. Check the error message for details.

failed-status.json
Legacy Format (Backward Compatibility)

For files processed before async support or files without queue records, returns the data directly without status field.

legacy-format.json

Polling for Async Results

When using async processing, poll this endpoint to check status and retrieve results when processing completes.

Polling Implementation
Example implementations for polling async processing results
polling-implementation.js

💡 Polling Best Practices:

  • • Use 5-10 second intervals to balance responsiveness and server load
  • • Implement timeout logic to prevent infinite polling loops
  • • Handle network errors gracefully with retry logic
  • • Consider using webhooks for real-time notifications instead of polling
  • • Store the jobId from PROCESSING responses for debugging purposes

Webhook Integration

Use this endpoint to fetch actual data when receiving webhook notifications. Webhook events contain metadata, and this endpoint retrieves the processed content.

Webhook Handler with Data Fetching
Example webhook handlers that automatically fetch file data when receiving events
webhook-integration.js

Error Responses

Common Error Responses

Error responses you might encounter when calling this endpoint.

error-responses.json

Basic Usage Examples

basic-usage.js