Enquiries API
Open an application from what a person sent through your own website form or portal
Use enquiries when a person already filled in a form on your site, such as a contact form, a form tool or a portal, and should continue on a Klarefi form. Klarefi opens an application for one workflow and keeps what they sent with it.
Call it from your server, never from the browser: the request carries your API key. Your form posts to your backend, and your backend calls Klarefi.
POST /api/v1/enquiries
Required scope: intake:enquiries:create
curl -X POST "https://www.klarefi.com/api/v1/enquiries" \
-H "Authorization: Bearer $KLAREFI_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: form_submission_8812" \
-d '{
"from": "ada@example.com",
"workflow_id": "business_loan.workflow",
"text": "We need 40,000 euros for a new delivery van.",
"fields": {
"Company name": "Lovelace Logistics",
"Requested amount": 40000
}
}'Request body
| Field | Required | Description |
|---|---|---|
from | Yes | One email address or one phone number the person gave |
workflow_id | One of | The workflow to open |
case_type_id | One of | A case type, instead of workflow_id |
text | One of | What the person wrote, up to 10,000 characters |
fields | One of | Your question names mapped to answers |
reply | No | none (default) or link |
idempotency_key | Yes | Up to 200 characters on one line, or the Idempotency-Key header |
Send exactly one of workflow_id and case_type_id, and send text, fields
or both.
fromis one bare email address such asada@example.com, at most 254 characters, or one phone number of at most 32 characters with 6 to 15 digits and only digits, spaces,+,(,),.and-.- An email address has no name, angle brackets, quotes or second address. The
part before the
@has no dot at its start or end and no two dots in a row. The domain has no dot at its end and ends in a real top-level label, such ascomornl. International domains are accepted. fieldsholds at most 50 answers. A name is 1 to 100 characters and is used once. An answer is a string, number or boolean of at most 2,000 characters; an empty ornullanswer is dropped.workflow_idandcase_type_idare 1 to 200 characters on one line.- Enquiries do not take files: the person adds documents on the form.
- The body is at most 64 KB.
Reply
With reply: "none", the response holds signed_url. Redirect the person to
it in the same browser. Klarefi reads what they sent only after they agree on
the form, then fills in the answers it finds and asks them to check.
With reply: "link", Klarefi emails the person a link to an empty form, and
your team sees what they sent on the case. from must be an email address, and
the workspace needs a reply address under Settings → Email and
notifications. A test key sends nothing: the enquiry records the delivery
status not_sent_test.
Response
201 means the application opened. 202 means it opened and the link email is
queued. 200 means an idempotent replay.
{
"enquiry_id": "enq_6f1c0f3e9b6b4f0f8c1d2a3b4c5d6e7f",
"status": "opened",
"channel": "form",
"reply": "none",
"session_id": "550e8400-e29b-41d4-a716-446655440000",
"expires_at": "2026-12-04T10:30:00.000Z",
"signed_url": "https://www.klarefi.com/s/550e8400-e29b-41d4-a716-446655440000?token=...",
"idempotent_replay": false
}For reply: "link" the response has delivery instead of signed_url:
queued, accepted, not_sent_test, failed or uncertain.
Retries
A replay is matched on the idempotency key within one environment and one key, including the key's rotated replacement. Another key with the same idempotency key opens a new enquiry.
- The same content returns
200with the same enquiry and session, and never sends a second email. - Different content returns
400 idempotency_key_conflict. - Once the form has expired or been closed, a replay returns
status: "closed"and no link. Forreply: "none"this also happens once the person has sent the form. Areply: "link"replay after submission returns the enquiry with its delivery status. - When the form expires, Klarefi forgets what the person sent and keeps only a
receipt. A replay after that returns
status: "closed".
Limits
| Limit | Counted per |
|---|---|
| 20 enquiries a day | sender, in each workspace |
| 3 link emails a day | recipient, in each workspace |
| 3 link emails a day | recipient, across all of Klarefi |
| 60 link emails an hour | workspace |
The link email limits apply to live keys. Each limit is a fixed window: a day or an hour from when its first request was counted. A link email counts when Klarefi queues it, whether or not it is delivered later.
The daily limit per recipient across all of Klarefi is shared between
workspaces. If other workspaces already sent the same person three links
today, your request for that person returns 429 even though your own
workspace sent none.
Klarefi counts a recipient by its address in lower case, with an international
domain in its ASCII form. gmail.com and googlemail.com count as one domain,
and for them Klarefi also ignores dots and anything from + in the part before
the @, so ada.lovelace+loans@googlemail.com and adalovelace@gmail.com
count as one. Other providers' tags and dots count as different addresses. A
request over one of these limits returns 429 rate_limit_exceeded with
Retry-After.
Test keys share the monthly cap on new test sessions described in
Sessions. Reaching it returns
429 test_usage_cap_exceeded without Retry-After.
Errors
| Status | Code | Cause |
|---|---|---|
400 | invalid_json | The body is not a JSON object |
400 | missing_from | No from |
400 | invalid_from | from is not one bare email address or one phone number |
400 | invalid_text | text is not a string, or is longer than 10,000 characters |
400 | invalid_fields | fields breaks one of the limits above |
400 | duplicate_field | Two answers name the same question |
400 | empty_enquiry | Neither text nor fields holds anything |
400 | files_not_supported | The body has files |
400 | invalid_reply | reply is not none or link |
400 | link_needs_email | reply: "link" without an email address in from |
400 | invalid_route | workflow_id or case_type_id is empty or too long |
400 | missing_workflow | Neither or both of workflow_id and case_type_id |
400 | invalid_idempotency_key | The idempotency key is empty or too long |
400 | missing_idempotency_key | No idempotency key in the body or the header |
400 | idempotency_key_conflict | The key was used for a different enquiry |
404 | unknown_workflow_id | The workflow is not in this workspace |
404 | unknown_case_type_id | The case type is not in this workspace |
402 | billing_required | A live key, and the workspace has no active pilot or contract |
402 | live_usage_cap_exceeded | A live key, and the workspace reached its live usage cap |
413 | request_too_large | The body is larger than 64 KB |
428 | legal_acceptance_required | A live key, and the current terms were not accepted |
428 | reply_address_required | reply: "link" and no reply address is set |
428 | workflow_not_published | The workflow_id has no published version (live key) or neither a published version nor a saved draft (test key), or a live key names a case type whose workflow is not published |
428 | draft_check_unavailable | A test key's workflow_id falls back to the draft with the latest updated_at, and the test connector cannot run its checks: a missing function, more than 20 connectors, or connectors too large to check at once |
428 | too_many_drafts | A test key's workflow_id has more than 100 saved drafts, or drafts too large to compare in one request, so the latest cannot be chosen |
429 | test_usage_cap_exceeded | The monthly test session cap is reached |
429 | rate_limit_exceeded | A limit above, or the per-key request rate, was reached; see Retry-After |