1Flow provides a webhook endpoint that allows you to retrieve document status and extracted data by document ID. This is useful for polling document processing status or retrieving parsed results after upload.
When you request document data:
Documents are processed asynchronously. If extraction is not yet complete, the document field will be null and you can check the status.extractionStatus field to see the current processing state.
GET https://app.1flow.io/api/webhook/{webhookId}/document/get?docId={docId}
Where {webhookId} is your unique webhook identifier.
Example:
GET https://app.1flow.io/api/webhook/abc123xyz/document/get?docId=doc_123
You can optionally include includeSchema=true as a query parameter to receive the document type schema in the response. This is useful when you need to understand the structure of the extracted data fields.
GET /api/webhook/{webhookId}/document/get
If a webhook secret is configured, include it in the Authorization header:
Authorization: {your-webhook-secret}
| Field | Type | Required | Description |
|---|---|---|---|
docId | String | Yes | The document ID to retrieve |
includeSchema | Boolean | No | If true, includes the document type schema in the response. Defaults to false |
Success Response (200):
{
"success": true,
"documentId": "doc_abc123xyz",
"status": {
"extractionStatus": "INDEXED",
"docType": "INVOICE",
...
},
"document": {
"description": "Invoice from Acme Corp",
"totalAmount": 1500.00,
"documentDate": "2025-01-10"
},
"extraction": {
"fields": {
...
},
"tables": {
"items": [
{
...
}
]
}
}
}
Note:
document field contains summary information and will be null if the document has not been extracted yetextraction field contains the full extracted data (fields for header data, tables for line items) and will be null if extraction is not completeschema field is only included when includeSchema=true is specifiedstatus.extractionStatus to see the current state:
PENDING - Document uploaded but not yet processedPARTIAL - Document classified but not yet extractedEXTRACTED - Document extracted but not yet indexedINDEXED - Document fully processed and readyError Responses:
401 Unauthorized - Invalid or missing webhook secret404 Not Found - Invalid webhook ID or document not found400 Bad Request - Missing or invalid docId parameterExample Error Response:
{
"error": "Missing or invalid docId"
}
async function getDocument(
docId: string,
webhookId: string,
secret: string
) {
const response = await fetch(
`https://app.1flow.io/api/webhook/${webhookId}/document/get?docId=${docId}`,
{
method: 'GET',
headers: {
'Authorization': secret,
},
}
);
const result = await response.json();
if (result.success) {
console.log('Document status:', result.status.extractionStatus);
if (result.extraction) {
console.log('Extracted fields:', result.extraction.fields);
console.log('Extracted tables:', result.extraction.tables);
} else {
console.log('Document not yet extracted');
}
}
return result;
}
import requests
def get_document(doc_id, webhook_id, secret):
url = f"https://app.1flow.io/api/webhook/{webhook_id}/document/get"
params = {
'docId': doc_id
}
headers = {
'Authorization': secret
}
response = requests.get(url, params=params, headers=headers)
result = response.json()
if result.get('success'):
print(f"Document status: {result['status']['extractionStatus']}")
if result.get('extraction'):
print(f"Extracted fields: {result['extraction']['fields']}")
print(f"Extracted tables: {result['extraction']['tables']}")
else:
print("Document not yet extracted")
return result
curl -X GET "https://app.1flow.io/api/webhook/{webhookId}/document/get?docId=your-document-id" \
-H "Authorization: {your-webhook-secret}"
status.extractionStatus to determine when extraction is completeextraction field will be null until extraction completesstatus.extractionErrors if extraction failsThe extraction process is powered by AI and can take up to a minute per document. Poll the endpoint periodically to check when extraction is complete.
Authorization header is included in the requestdocId query parameter is included in the URLdocId is a valid stringstatus.extractionStatus to see the current processing stateINDEXED before expecting document datastatus.extractionErrors if extraction has failed