Documents
AI document extraction for Bills, Statements, Receipts, and more
Digits automates entire accounting process from a file upload:
- Attach receipts to transactions
- Perform automatic reconciliations from a statement
- Create bills to be paid
Upload Documents
To upload a document to Digits, perform a well-formed multipart MIME file upload to the document upload endpoint. Note that this endpoint is hosted at a different subdomain than the Connect API.
Endpoint
POST https://vault.digits.com/document-upload
Authentication
Use your Connect API OAuth2 access token in the Authorization header. The destination is automatically extracted from your access token, so you do not need to provide it as a query parameter.
Request Parameters
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
source | string | Recommended | The source of the upload. Use "Connect" for Connect API uploads |
document-collection-id | string | No | Custom collection ID. If not provided, a new UUID will be generated |
external-id | string | No | Your external identifier for the document. Required when using If-None-Match for duplicate detection |
external-content-hash | string | No | External content hash for comparison |
Headers:
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer token from Connect API OAuth2 flow |
If-None-Match | No | Content hash to check if document already exists. Returns 304 if a document with matching external-id and content hash exists. Must also provide external-id query parameter |
Content-Type | Yes | Must be multipart/form-data with boundary |
Request Body
The request body must be a multipart MIME upload containing one or both of the following parts:
-
File part (required): The document file to upload
- Content-Disposition must include
filenameparameter - Only one file is supported per upload
- Any MIME type is accepted
- Content-Disposition must include
-
Details part (optional): JSON metadata for document features
- Content-Disposition name must be
details - Content-Type must be
application/json - Body should contain a
DocumentUploadDetailsJSON object
- Content-Disposition name must be
DocumentUploadDetails Schema
The optional details part accepts a JSON object with the following structure:
{
"features": [
{
"kind": "VendorName",
"feature_page": 1,
"text_feature_value": {
"text_value": "ACME Corporation"
}
}
]
}Feature Kinds for document classification include:
VendorName,VendorAddress,VendorEmail,VendorPhoneNumber,VendorWebsiteInvoiceId,InvoiceDate,DueDate,TotalAmountPayerName,PayerAddress,PayerEmail,PayerPhoneNumberMemo,Terms,AccountNumberBankStatementLineItem,InstitutionName,InstitutionAccountNumber- And many more document-specific features
Response
Success (200 OK):
{
"collection_id": "550e8400-e29b-41d4-a716-446655440000",
"document_id": "660e8400-e29b-41d4-a716-446655440001"
}Document Already Exists (304 Not Modified):
Returned when If-None-Match header is provided and the document with matching external-id and content hash already exists.
Example Request
Basic Upload:
curl -X POST "https://vault.digits.com/document-upload?source=Connect" \
-H "Authorization: Bearer YOUR_CONNECT_ACCESS_TOKEN" \
-F "[email protected];type=application/pdf"Upload with Document Features:
curl -X POST "https://vault.digits.com/document-upload?source=Connect" \
-H "Authorization: Bearer YOUR_CONNECT_ACCESS_TOKEN" \
-F "[email protected];type=application/pdf" \
-F 'details={"features":[{"kind":"VendorName","text_feature_value":{"text_value":"ACME Corp"}}]};type=application/json'Upload with Duplicate Detection:
curl -X POST "https://vault.digits.com/document-upload?source=Connect&external-id=invoice-12345" \
-H "Authorization: Bearer YOUR_CONNECT_ACCESS_TOKEN" \
-H "If-None-Match: abc123def456789..." \
-F "[email protected];type=application/pdf"Duplicate Detection
To avoid uploading duplicate documents:
- Include the
If-None-Matchheader with the document's content hash - Provide the
external-idquery parameter - If a matching document exists, the API returns 304 Not Modified
- Otherwise, the document is uploaded normally
Supported Methods
POST: Upload a new documentPUT: Upload or replace a document
Updated 13 days ago
