ExDocApi/ Docs

Document types and fields

ExDocApi works with any document. You define the fields — the system finds them.


How fields work

In the extract JSON, the fields object maps field names to descriptions:

{
  "fields": {
    "your_field_name": "plain English description of what to find"
  }
}

The key appears in your result. The value tells the extraction engine what to look for.


Built-in document types

Use GET /api/v1/document-types to list all types, and GET /api/v1/fields?type=slug to get suggested fields for each.

| Slug | Label | Category | |------|-------|----------| | invoice | Invoice | Finance | | bank_statement | Bank Statement | Finance | | payslip | Payslip / Salary Slip | Finance | | medical_consultation | Medical Consultation | Medical | | medical_lab_report | Medical Lab Report | Medical | | medical_prescription | Medical Prescription | Medical | | contract | Contract / Agreement | Legal | | passport | Passport | Identity | | purchase_order | Purchase Order | Logistics |


Field examples by document type

Invoice

{
  "document_type": "invoice",
  "fields": {
    "invoice_number": "invoice or bill reference number",
    "vendor_name":    "name of the seller or vendor",
    "client_name":    "name of the buyer or client",
    "date":           "date the invoice was issued",
    "due_date":       "payment due date",
    "subtotal":       "amount before tax",
    "tax":            "tax amount",
    "total":          "final total amount due",
    "currency":       "currency code like INR, USD, EUR"
  }
}

Medical Consultation

{
  "document_type": "medical consultation",
  "fields": {
    "patient_name":    "full name of the patient",
    "patient_age":     "age of the patient",
    "doctor_name":     "name of the consulting doctor",
    "visit_date":      "date of the consultation",
    "chief_complaint": "main reason for the visit",
    "diagnosis":       "disease or condition diagnosed",
    "prescription":    "medicines prescribed",
    "follow_up":       "next appointment or follow-up date"
  }
}

Lab Report

{
  "document_type": "medical lab report",
  "fields": {
    "patient_name":    "full name of the patient",
    "test_name":       "name of the test performed",
    "sample_date":     "date sample was collected",
    "report_date":     "date report was issued",
    "results":         "test result values",
    "reference_range": "normal reference range",
    "lab_name":        "name of the laboratory"
  }
}

Employment Contract / Offer Letter

{
  "document_type": "employment contract",
  "fields": {
    "employee_name":  "full name of the employee",
    "designation":    "job title or role",
    "department":     "department or team",
    "joining_date":   "start date of employment",
    "salary":         "compensation or CTC offered",
    "notice_period":  "notice period required",
    "probation":      "probation period duration"
  }
}

Bank Statement

{
  "document_type": "bank statement",
  "fields": {
    "account_holder":   "name of the account holder",
    "account_number":   "bank account number",
    "bank_name":        "name of the bank",
    "statement_period": "period covered by the statement",
    "opening_balance":  "balance at start of period",
    "closing_balance":  "balance at end of period",
    "total_credits":    "total amount deposited",
    "total_debits":     "total amount withdrawn"
  }
}

Passport

{
  "document_type": "passport",
  "fields": {
    "full_name":       "full name as on passport",
    "passport_number": "passport document number",
    "nationality":     "country of citizenship",
    "date_of_birth":   "date of birth",
    "issue_date":      "date passport was issued",
    "expiry_date":     "date passport expires",
    "gender":          "gender M or F"
  }
}

Purchase Order

{
  "document_type": "purchase order",
  "fields": {
    "po_number":     "purchase order reference number",
    "po_date":       "date the PO was issued",
    "buyer_name":    "company placing the order",
    "supplier_name": "company fulfilling the order",
    "delivery_date": "expected delivery date",
    "total_amount":  "total order value",
    "payment_terms": "payment terms and conditions"
  }
}

Tips for better accuracy

Be specific in descriptions. Instead of "date", write "date the invoice was issued". More context = better results.

Use document_type. Even though it's optional, it helps the extraction engine understand the document context.

Field names can be anything. Use snake_case for consistency — patient_name, not PatientName or patient name.

Fields not found return null. If a field doesn't exist in the document, the result will have null for that key — not an error.

Custom fields work too. You're not limited to the built-in types. Pass any field name with any description for any document.

← PreviousCredits & billingNext →File formats