Extract schemas

Built-in schemas, and defining your own fields.

dev · https://api.dev.oprag.ai

A schema decides which fields come back. Built-ins cover common documents; custom schemas let you describe your own and are versioned as you refine them.

Built-in schemas

20 schemas ship with Extract. Pass one as `schemaId`, or `"auto"` to have the document classified.
schemaIdDocumentPrimary fields
invoiceInvoice — Accounts-payable invoices with vendor, dates, totals, and line items.vendorName, invoiceNumber, invoiceDate, dueDate, totalAmount, lineItems[]
receiptReceipt — Retail and expense receipts with merchant, payment, and itemized totals.merchantName, receiptNumber, receiptDate, paymentMethod, totalAmount, lineItems[]
purchase_orderPurchase order — Procurement POs with buyer, vendor, delivery dates, and ordered lines.poNumber, buyerName, vendorName, orderDate, totalAmount, lineItems[]
credit_noteCredit note — Credit memos linked to original invoices with reason and credited lines.creditNoteNumber, originalInvoiceNumber, creditDate, reason, totalAmount, lineItems[]
delivery_noteDelivery note — Packing slips and delivery notes with carrier, tracking, and shipped items.deliveryNoteNumber, shipperName, recipientName, carrier, trackingNumber, lineItems[]
bank_statementBank statement — Account statements with period, balances, and transaction rows.bankName, accountNumber, statementPeriodStart, statementPeriodEnd, closingBalance, transactions[]
payslipPayslip — Payroll slips with employer, pay period, gross/net pay, and deductions.employerName, employeeName, payPeriodStart, payPeriodEnd, grossPay, netPay, deductions[]
utility_billUtility bill — Electric, gas, water, and telecom bills with account, period, and itemized charges.providerName, accountNumber, billingPeriodStart, billingPeriodEnd, totalAmountDue, lineItems[]
ticketTicket — Event tickets and boarding passes with issuer, event, seat, and fare.issuerName, ticketNumber, eventName, venue, eventDate, passengerName, price
tax_formTax form — Tax certificates and compliance forms (W-9, 1099, VAT) with taxpayer ID and signature date.formType, taxpayerName, taxId, address, signatureDate, exemptPayeeCode
contractContract — Commercial agreements with parties, effective dates, and key terms.contractTitle, contractNumber, effectiveDate, expiryDate, governingLaw, parties[], keyTerms[]
gst_invoiceGST invoice — Indian GST tax invoices with seller/buyer GSTIN, CGST/SGST/IGST breakdown, and HSN/SAC lines.sellerGstin, buyerGstin, invoiceNumber, invoiceDate, placeOfSupply, totalAmount, lineItems[]
id_documentID document — Passports, driver licenses, and national IDs — identity fields only.documentType, fullName, documentNumber, dateOfBirth, expiryDate, issuingAuthority
remittance_adviceRemittance advice — Payment remittance documents with payee, payment reference, and linked invoice rows.remittanceNumber, payeeName, paymentDate, paymentReference, totalAmountPaid, lineItems[]
packing_slipPacking slip — Packing lists and shipping manifests with SKUs, quantities, and carrier details (no pricing).packingSlipNumber, poNumber, recipientName, carrier, trackingNumber, lineItems[]
quoteQuote — Sales quotes and estimates with line items, tax, and expiry dates.quoteNumber, sellerName, quoteDate, expiryDate, totalAmount, lineItems[]
business_cardBusiness card — Contact details from business card images — name, title, company, phone, email.fullName, jobTitle, companyName, email, phone, website
bank_checkBank check — Bank checks and cheques with payee, amount, MICR line, and routing details.checkNumber, payeeName, amount, checkDate, bankName, micrLine
w2W-2 — US IRS Form W-2 wage and tax statements with employer/employee IDs and withholding boxes.taxYear, employerName, employeeName, wagesTipsOther, federalIncomeTaxWithheld, socialSecurityWages
e_way_billE-way bill — India GST e-way bills with EWB number, GSTINs, validity window, and CGST/SGST/IGST breakdown.ewayBillNumber, validUntil, generatorGstin, taxableValue, cgstAmount, sgstAmount, igstAmount

Listing what is available

Shell
curl 'https://api.dev.oprag.ai/v1/extract/schemas' -H 'X-Oprag-Key: sk_live_...'

# Custom schemas only
curl 'https://api.dev.oprag.ai/v1/extract/schemas?includeBuiltin=false' -H 'X-Oprag-Key: sk_live_...'
Query parameterDefaultMeaning
includeBuiltintrueSet false to list only this workspace's own schemas.
statusactiveactive, archived, or all.

Defining one

Shell
curl -X POST 'https://api.dev.oprag.ai/v1/extract/schemas' \
  -H 'X-Oprag-Key: sk_live_...' \
  -H 'Content-Type: application/json' \
  -d '{
    "schemaId": "custom_purchase_order",
    "displayName": "Purchase order",
    "documentDescription": "A supplier purchase order with line items and totals.",
    "extractionHints": "Totals are on the last page.",
    "fields": [
      { "key": "poNumber", "type": "string", "description": "Purchase order number" },
      { "key": "total", "type": "number", "description": "Order total including tax" }
    ]
  }'
  • schemaId must be custom_-prefixed; built-in ids are rejected with 409.
  • displayName up to 128 characters; documentDescription and extractionHints up to 512.
  • extractionHints is where document quirks belong — it is prompt context, not validation.
  • Fields compile into a prompt with a size ceiling, so a very large schema is refused with 400.

Changing one

PATCH updates a custom schema and bumps its version. An archived schema cannot be edited — create a new schemaId instead.

Archiving

Full request and response shapes are on the Extract reference.

Ready to ship?

Get started free