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:

ParameterTypeRequiredDescription
sourcestringRecommendedThe source of the upload. Use "Connect" for Connect API uploads
document-collection-idstringNoCustom collection ID. If not provided, a new UUID will be generated
external-idstringNoYour external identifier for the document. Required when using If-None-Match for duplicate detection
external-content-hashstringNoExternal content hash for comparison

Headers:

HeaderRequiredDescription
AuthorizationYesBearer token from Connect API OAuth2 flow
If-None-MatchNoContent 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-TypeYesMust 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:

  1. File part (required): The document file to upload

    • Content-Disposition must include filename parameter
    • Only one file is supported per upload
    • Any MIME type is accepted
  2. Details part (optional): JSON metadata for document features

    • Content-Disposition name must be details
    • Content-Type must be application/json
    • Body should contain a DocumentUploadDetails JSON object

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, VendorWebsite
  • InvoiceId, InvoiceDate, DueDate, TotalAmount
  • PayerName, PayerAddress, PayerEmail, PayerPhoneNumber
  • Memo, Terms, AccountNumber
  • BankStatementLineItem, 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:

  1. Include the If-None-Match header with the document's content hash
  2. Provide the external-id query parameter
  3. If a matching document exists, the API returns 304 Not Modified
  4. Otherwise, the document is uploaded normally

Supported Methods

  • POST: Upload a new document
  • PUT: Upload or replace a document