Skip to main content

Getting started

The eCourtDate Document Generation API renders court-ready PDFs over plain HTTPS + JSON. You can generate a document with a single request (no setup, no stored template) and grow into reusable, versioned templates when you need them.

Base URL: https://api.pdfs.ecourtdate.com/v1

1. Create an API key

API keys are created and managed in the eCourtDate Console, on the APIs page. Each key carries scopes that gate what it may call. For this guide you need the generate scope (and templates:write for step 3).

Keys are secrets: store yours in a secrets manager and send it on every request in the x-api-key header. See Authentication for the key lifecycle and rotation guidance.

2. Generate your first document

One request, no template. The server synthesizes a blank letter-size page and renders a markdown field onto it:

curl -o hello.pdf "https://api.pdfs.ecourtdate.com/v1/documents" \
-H "x-api-key: $API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/pdf" \
-d '{
"page": { "size": "letter" },
"fields": [
{ "type": "text",
"content": "# Notice\n\nYour hearing is on **August 15, 2026**.",
"content_format": "markdown",
"x": 72, "y": 72, "width": 468, "height": 200 }
]
}'

Open hello.pdf. That's the whole loop. Positions are PDF points with a top-left origin (x: 72, y: 72 is one inch from the top-left corner); see Conventions.

Prefer HTML? The same endpoint accepts a whole document authored in HTML/CSS with real layout and pagination. See HTML documents.

3. Create a reusable template

Templates make a document repeatable: fields are laid out once, and each generation supplies only the data. Four calls take you from nothing to production. Write operations also require an X-On-Behalf-Of header naming the person the call is made for. It is recorded in the audit trail.

Create the template shell:

curl -s "https://api.pdfs.ecourtdate.com/v1/templates" \
-H "x-api-key: $API_KEY" \
-H "X-On-Behalf-Of: clerk@example.gov" \
-H "Content-Type: application/json" \
-d '{ "name": "Hearing Notice", "description": "Standard notice of hearing, English" }'

The response includes the template id. Use it below.

Add a version with fields bound to merge tags:

curl -s "https://api.pdfs.ecourtdate.com/v1/templates/$TEMPLATE_ID/versions" \
-H "x-api-key: $API_KEY" \
-H "X-On-Behalf-Of: clerk@example.gov" \
-H "Content-Type: application/json" \
-d '{
"fields": [
{ "type": "text", "merge_tag": "client_name", "x": 90, "y": 200, "width": 300, "height": 20 },
{ "type": "text", "merge_tag": "hearing_date", "x": 90, "y": 230, "width": 300, "height": 20 }
],
"merge_tags": [
{ "tag": "client_name", "type": "string", "required": true, "example": "Jordan Smith" },
{ "tag": "hearing_date", "type": "date", "required": true, "example": "2026-08-15" }
]
}'

A version can also carry a base PDF (your existing form), supplied inline or through a one-time upload, so fields draw on top of it. See Templates and versions.

Publish it. Generation always resolves the published version, so editing never silently changes production output:

curl -s -X POST "https://api.pdfs.ecourtdate.com/v1/templates/$TEMPLATE_ID/versions/1/publish" \
-H "x-api-key: $API_KEY" \
-H "X-On-Behalf-Of: clerk@example.gov"

Generate with data:

curl -o notice.pdf "https://api.pdfs.ecourtdate.com/v1/templates/$TEMPLATE_ID/generate" \
-H "x-api-key: $API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/pdf" \
-d '{
"data": { "client_name": "Jordan Smith", "hearing_date": "2026-08-15" },
"name": "hearing-notice-smith"
}'

Missing or mistyped data fails with a clear 422 before anything renders. That's strict validation, the default.

4. Go deeper

To…Read
Understand keys, scopes, and attributionAuthentication
Lay out every kind of contentFields
Author in HTML/CSSHTML documents
Generate hundreds of documents at onceBatch generation
Make retries safeIdempotency and retries
Handle every failure modeErrors and Warnings
Explore every endpointAPI reference