Skip to content

Private API Examples

These examples use the production base URL:

https://html.contact

Use a private API key that starts with hc_live_. Keep private keys on trusted servers, jobs, scripts, and approved agents only.

For browser forms that use public hc_pub_ keys, see HTML Forms and Examples.

Set these variables before running the examples. Replace every value ending in _REPLACE with a real value from your account.

Terminal window
export HC_API_KEY="hc_live_REPLACE"
export FORM_ID="form_REPLACE"
export SUBMISSION_ID="sub_REPLACE"
export ATTACHMENT_ID="att_REPLACE"
VariableReplace with
HC_API_KEYA private API key from your account
FORM_IDA form ID returned by the Forms API
SUBMISSION_IDA submission ID returned by a submission list or detail response
ATTACHMENT_IDAn attachment ID from the submission detail response

Requires a Read only or Form manager key.

Terminal window
curl "https://html.contact/api/v1/forms" \
-H "Authorization: Bearer $HC_API_KEY"

Response shape:

{
"ok": true,
"forms": []
}

Each form includes its ID, public key, name, status, allowed domains, recipient settings, and generated HTML snippet.

Requires a Form manager key.

Terminal window
curl "https://html.contact/api/v1/forms" \
-H "Authorization: Bearer $HC_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Website contact",
"recipientEmail": "owner@example.com",
"ccEmail": "ops@example.com",
"bccEmail": null,
"allowedDomain": "example.com",
"defaultSubject": "New website inquiry",
"defaultIntro": "A new message arrived from your website.",
"defaultRedirectUrl": "https://example.com/thanks"
}'

recipientEmail, ccEmail, and bccEmail must already be verified recipient settings on the account.

Requires a Form manager key.

Terminal window
curl -X PATCH "https://html.contact/api/v1/forms/$FORM_ID" \
-H "Authorization: Bearer $HC_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Main contact form",
"allowedDomains": ["example.com", "www.example.com"],
"allowDirectPosts": false,
"status": "active"
}'

allowDirectPosts: true accepts trusted server or curl posts without browser source headers. Leave it off for normal website forms.

Requires a Form manager key.

Terminal window
curl -X POST "https://html.contact/api/v1/forms/$FORM_ID/duplicate" \
-H "Authorization: Bearer $HC_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Website contact backup"
}'

Duplicating copies recipients, allowed domains, defaults, and generated snippet behavior from the source form.

Requires a Form manager key.

Terminal window
curl -X POST "https://html.contact/api/v1/forms/$FORM_ID/test-email" \
-H "Authorization: Bearer $HC_API_KEY"

Test emails send to the verified primary recipient and any verified, healthy CC/BCC recipients.

Requires a Form manager key.

Terminal window
curl -X POST "https://html.contact/api/v1/forms/$FORM_ID/verify-recipient" \
-H "Authorization: Bearer $HC_API_KEY"

If the action is rate-limited, the response includes retry_after_seconds.

Requires a Read only or Form manager key.

Terminal window
curl "https://html.contact/api/v1/forms/$FORM_ID/submissions?folder=inbox&limit=50" \
-H "Authorization: Bearer $HC_API_KEY"

Workspace-wide submissions:

Terminal window
curl "https://html.contact/api/v1/forms/all/submissions?folder=spam&q=casino" \
-H "Authorization: Bearer $HC_API_KEY"

Response shape:

{
"ok": true,
"submissions": [],
"next_cursor": null,
"counts": {
"inbox": 0,
"spam": 0
}
}

Use next_cursor as the cursor query parameter to load the next page.

Requires a Read only or Form manager key.

Terminal window
curl -L "https://html.contact/api/v1/forms/all/submissions.csv?folder=inbox&limit=5000" \
-H "Authorization: Bearer $HC_API_KEY" \
-o submissions.csv

CSV exports include attachment count, filenames, sizes, and authenticated download links when attachments exist.

Requires a Read only or Form manager key.

Terminal window
curl "https://html.contact/api/v1/submissions/$SUBMISSION_ID" \
-H "Authorization: Bearer $HC_API_KEY"

Detail responses include submitted field data, source metadata, email status, events, and attachment metadata.

Requires a Read only or Form manager key.

Terminal window
curl -L "https://html.contact/api/v1/submissions/$SUBMISSION_ID/attachments/$ATTACHMENT_ID" \
-H "Authorization: Bearer $HC_API_KEY" \
-o attachment.bin

For safe previewable file types, request inline preview:

Terminal window
curl -L "https://html.contact/api/v1/submissions/$SUBMISSION_ID/attachments/$ATTACHMENT_ID?disposition=inline" \
-H "Authorization: Bearer $HC_API_KEY"

Attachment metadata is kept separately from the file content, and files are downloaded through authenticated attachment endpoints.

Requires a Read only or Form manager key.

Terminal window
curl "https://html.contact/api/v1/usage" \
-H "Authorization: Bearer $HC_API_KEY"

Response shape:

{
"ok": true,
"usage": {
"forms_count": 3,
"submissions_count": 187,
"used": 187,
"limit": 1000,
"plan": "starter",
"plan_label": "Starter",
"period_end": "2026-07-17T00:00:00.000Z",
"is_over_limit": false
}
}

Open raw OpenAPI JSON
View in Swagger UI