1Flow provides a webhook endpoint that allows you to programmatically upload documents via HTTP POST requests. This is ideal for integrating with external systems, automated workflows, or custom applications.
When you send a document to your webhook URL:
The upload endpoint returns immediately with a document ID.
Store this ID and use the get endpoint to check processing status and retrieve the extracted data once processing is complete.
The extraction process is powered by AI and can take up to a minute per document.
POST https://app.1flow.io/api/webhook/{webhookId}/document/upload
Where {webhookId} is your unique webhook identifier.
Example:
POST https://app.1flow.io/api/webhook/abc123xyz/document/upload
POST /api/webhook/{webhookId}/document/upload
If a webhook secret is configured, include it in the Authorization header:
Authorization: {your-webhook-secret}
You can send documents in three ways:
Fetch files from a remote URL. The system will download the file automatically. This is the recommended method for better reliability.
curl -X POST https://app.1flow.io/api/webhook/{webhookId}/document/upload \
-H "Authorization: {your-webhook-secret}" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/documents/invoice.pdf"
}'Request Parameters:
| Field | Type | Required | Description |
|---|---|---|---|
url | String | Yes | HTTP/HTTPS URL to fetch file from |
fileName | String | No | Filename (inferred from URL or Content-Disposition header if not provided) |
contentType | String | No | MIME type (inferred from extension or Content-Type header if not provided) |
Success Response (200):
{
"success": true,
"message": "Document uploaded successfully",
"documentId": "doc_abc123xyz"
}
Error Responses:
401 Unauthorized - Invalid or missing webhook secret404 Not Found - Invalid webhook ID400 Bad Request - Missing or invalid file data, unsupported file type, or unable to determine content typeExample Error Response:
{
"success": false,
"error": "Unable to determine content type. Please provide 'contentType' in the request body or ensure the file has a recognized extension."
}
async function uploadDocumentFromUrl(
url: string,
webhookId: string,
secret: string
) {
const response = await fetch(
`https://app.1flow.io/api/webhook/${webhookId}/document/upload`,
{
method: 'POST',
headers: {
'Authorization': secret,
'Content-Type': 'application/json',
},
body: JSON.stringify({
url: url,
}),
}
);
const result = await response.json();
return result.documentId;
}Authorization header is included in the request/api/webhook/{webhookId}/document/uploadhttps://app.1flow.io)file or url) are includedcontentType if needed)After uploading a document, you'll need to poll the get endpoint to check when processing is complete and retrieve the extracted data. See the Upload + Polling Pattern guide for complete implementation details and code examples.