Getting started
This walkthrough takes one emergency detention application from an empty draft
to a signed, downloadable warrant. It uses curl; every call is a plain
HTTPS request with a JSON body, so any client works.
Before you start
You need an API key for your agency. Keys are issued by eCourtDate and carry
scopes; this walkthrough needs
templates:read, warrants:write, warrants:submit, and warrants:sign.
export API_KEY="ecd_wk_..."
export BASE="https://api.warrants.ecourtdate.com/v1"
Keys are secrets. Keep them on a server you control, never in a browser, a mobile app, or source control.
1. Find a template
An application is always created from a template, which declares the fields it collects.
curl -s "$BASE/templates" -H "x-api-key: $API_KEY"
[
{
"id": "c47b2a91-5e3d-4f88-b0a2-7d1c6e9f4a53",
"name": "Emergency Detention (Form MH-101)",
"is_system_template": true,
"is_active": true,
"elements": [
{"id": "el_1", "type": "DYNAMIC_FIELD", "fieldId": "subject_name", "label": "Subject name", "dataType": "TEXT", "required": true}
]
}
]
The elements array is the contract for the next step: every fieldId marked
required has to appear in form_data. See form elements.
2. Create the application
curl -s -X POST "$BASE/warrants" \
-H "x-api-key: $API_KEY" \
-H "X-On-Behalf-Of: dr.chen@example.gov" \
-H "Content-Type: application/json" \
-d '{
"template_id": "c47b2a91-5e3d-4f88-b0a2-7d1c6e9f4a53",
"priority": "URGENT",
"form_data": {
"subject_name": "Jordan Rivera",
"subject_dob": "1994-03-11",
"facility": "Mercy General Hospital",
"grounds": "Subject presented in acute crisis and meets the statutory criteria.",
"physician_name": "Dr. Alex Chen",
"physician_license": "TX-448120"
}
}'
{
"id": "9d2b6e14-6f1a-4a1c-9c0e-6f5f4b3a2d10",
"warrant_number": "EW-2026-004182",
"status": "DRAFT",
"priority": "URGENT",
"created_at": "2026-08-19T14:32:07Z"
}
X-On-Behalf-Of names the person the call is made for. It is required on every
write and is what the audit trail records, so the application is attributed to
Dr. Chen rather than to an anonymous integration.
3. Attach the certificate
Attachments are uploaded straight to storage, not through this API. Ask for an
upload URL, PUT the bytes, then confirm.
curl -s -X POST "$BASE/files/presign" \
-H "x-api-key: $API_KEY" \
-H "X-On-Behalf-Of: dr.chen@example.gov" \
-H "Content-Type: application/json" \
-d '{
"filename": "physician-certificate.pdf",
"content_type": "application/pdf",
"resource_type": "ATTACHMENT",
"resource_id": "9d2b6e14-6f1a-4a1c-9c0e-6f5f4b3a2d10"
}'
The response carries upload_url, file_id, and storage_key. Upload, then
confirm:
curl -s -X PUT "$UPLOAD_URL" \
-H "Content-Type: application/pdf" \
--data-binary @physician-certificate.pdf
curl -s -X POST "$BASE/files/confirm" \
-H "x-api-key: $API_KEY" \
-H "X-On-Behalf-Of: dr.chen@example.gov" \
-H "Content-Type: application/json" \
-d '{"file_id": "51d3c8a4-9e2b-4d17-a6f0-3b8c5e1f7d29", "storage_key": "'"$STORAGE_KEY"'"}'
An attachment that is never confirmed does not appear on the application. The full flow is in files and attachments.
4. Submit for review
curl -s -X PATCH "$BASE/warrants/9d2b6e14-6f1a-4a1c-9c0e-6f5f4b3a2d10/submit" \
-H "x-api-key: $API_KEY" \
-H "X-On-Behalf-Of: dr.chen@example.gov" \
-H "Content-Type: application/json" \
-d '{"assigned_judge_id": "a83f5c07-2d19-4b6e-9f42-5c7a1e3d8b90"}'
The application moves to SUBMITTED. Omit the body to let your agency's
routing mode choose who is notified. Only the
person who created an application can submit it.
5. Sign it
A judge signs from the review queue:
curl -s -X PATCH "$BASE/warrants/9d2b6e14-6f1a-4a1c-9c0e-6f5f4b3a2d10/sign" \
-H "x-api-key: $API_KEY" \
-H "X-On-Behalf-Of: judge.alvarez@example.gov"
{
"status": "SIGNED",
"judge_name": "Hon. Maria Alvarez",
"signed_at": "2026-08-19T15:04:51Z",
"pdf_url": "https://files.warrants.ecourtdate.com/warrants/9d2b6e14/document.pdf?expires=…"
}
Signing applies the signing judge's stored signature and renders the document,
so X-On-Behalf-Of must name a person entitled to sign. A warrant can only be
signed once. If the judge rejects it instead, the application moves to
REJECTED with a reason, and can be
reopened for correction.
6. Read the history
curl -s "$BASE/audit/warrants/9d2b6e14-6f1a-4a1c-9c0e-6f5f4b3a2d10" \
-H "x-api-key: $API_KEY"
Every step above appears in order, with the person, the time, and the request context. See the audit trail.
Where to next
- Warrant lifecycle for every state and transition.
- Errors for the envelope your client should branch on.
- Interactive API reference to try calls in the browser.