Skip to content

Developer Quickstart

Get up and running with the DataParse API in minutes. This guide will walk you through extracting structured data from a document with a complete working example.

Create API Key

Create an API key in the dashboard - you’ll need this to authenticate your requests.

Here’s a complete example that extracts invoice data from a PDF:

Terminal window
curl -X POST https://api.datapar.se/v1/ \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"schema": {
"type": "object",
"properties": {
"invoice_number": {
"type": "string",
"description": "The unique invoice number or reference ID, typically found at the top of the invoice"
},
"vendor_name": {
"type": "string",
"description": "The name of the company or individual who issued the invoice"
},
"total_amount": {
"type": "number",
"description": "The final amount due including all taxes and fees, usually shown as 'Total' or 'Amount Due'"
},
"date": {
"type": "string",
"description": "The invoice date in YYYY-MM-DD format"
}
},
"required": ["invoice_number", "total_amount", "date"]
},
"contents": [{
"filename": "invoice.pdf",
"mimeType": "application/pdf",
"data": "BASE64_ENCODED_PDF_DATA"
}]
}'
const fs = require("fs");
// Read and encode your PDF file
const pdfBuffer = fs.readFileSync("invoice.pdf");
const base64Data = pdfBuffer.toString("base64");
// Make the API request
const response = await fetch("https://api.datapar.se/v1/", {
method: "POST",
headers: {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
schema: {
type: "object",
properties: {
invoice_number: {
type: "string",
description:
"The unique invoice number or reference ID, typically found at the top of the invoice",
},
vendor_name: {
type: "string",
description:
"The name of the company or individual who issued the invoice",
},
total_amount: {
type: "number",
description:
"The final amount due including all taxes and fees, usually shown as 'Total' or 'Amount Due'",
},
date: {
type: "string",
description: "The invoice date in YYYY-MM-DD format",
},
},
required: ["invoice_number", "total_amount", "date"],
},
contents: [
{
filename: "invoice.pdf",
mimeType: "application/pdf",
data: base64Data,
},
],
}),
});
const extractedData = await response.json();
console.log("Extracted data:", extractedData);
import requests
import base64
# Read and encode your PDF file
with open('invoice.pdf', 'rb') as file:
base64_data = base64.b64encode(file.read()).decode('utf-8')
# Make the API request
response = requests.post(
'https://api.datapar.se/v1/',
headers={
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
json={
'schema': {
'type': 'object',
'properties': {
'invoice_number': {
'type': 'string',
'description': 'The unique invoice number or reference ID, typically found at the top of the invoice'
},
'vendor_name': {
'type': 'string',
'description': 'The name of the company or individual who issued the invoice'
},
'total_amount': {
'type': 'number',
'description': 'The final amount due including all taxes and fees, usually shown as \'Total\' or \'Amount Due\''
},
'date': {
'type': 'string',
'description': 'The invoice date in YYYY-MM-DD format'
}
},
'required': ['invoice_number', 'total_amount', 'date']
},
'contents': [{
'filename': 'invoice.pdf',
'mimeType': 'application/pdf',
'data': base64_data
}]
}
)
extracted_data = response.json()
print('Extracted data:', extracted_data)

You’ll receive structured JSON data matching your schema:

{
"invoice_number": "INV-2024-001",
"vendor_name": "Acme Corporation",
"total_amount": 1250.5,
"date": "2024-01-15"
}
  • Invoice Processing: Extract vendor, amount, date, line items
  • Receipt Parsing: Get merchant, total, items, tax information
  • Form Data: Extract structured data from filled forms
  • Business Cards: Parse contact information from images
  • Contracts: Extract key terms, dates, and parties

Ready to get started? Create your API key and try the examples above!