Programmatically upload documents for AI extraction via the Doc-Vision REST API - supports PDF, images, and spreadsheets
DocVision 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 API 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.doc-vision.com/api/webhook/{webhookId}/document/upload
Where {webhookId} is your unique webhook identifier.
Example:
POST https://app.doc-vision.com/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.doc-vision.com/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.doc-vision.com/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.doc-vision.com)file or url) are includedcontentType if needed)After uploading a document, you'll need to poll the Get API to check when processing is complete and retrieve the extracted data. See the Upload + Polling Example for complete implementation details and code examples.
URL-based uploads support files up to 50MB. For multipart uploads, the limit is the same. If you need to process larger files, split multi-page PDFs into smaller batches.
Average processing time is 30 seconds per page. The upload endpoint returns immediately with a documentId - extraction happens asynchronously in the background.
URL uploads (recommended) are the most reliable. The server fetches the file directly, avoiding client-side timeouts for large files. Use multipart for direct file uploads from forms or file systems. Use base64 only when you need to embed file data in a JSON payload.
The AI automatically classifies uploaded documents based on your configured Extraction Templates. You don't need to specify the document type - the system determines it automatically.
Each upload creates a new document with a unique ID. The system does not deduplicate automatically. Implement duplicate detection in your application if needed.
On This Page
OverviewHow It WorksWebhook URL FormatAPI ReferenceEndpointAuthenticationRequest FormatsResponse FormatSupported File TypesCode ExamplesTroubleshooting401 Unauthorized404 Not Found400 Bad RequestUpload + Polling PatternFrequently Asked QuestionsWhat file size limits apply?How long does processing take?Which upload method should I use?Can I specify the document type on upload?What happens if I upload a duplicate?Next Steps