Skip to Content
Klarefi
API reference

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

FieldRequiredDescription
fromYesOne email address or one phone number the person gave
workflow_idOne ofThe workflow to open
case_type_idOne ofA case type, instead of workflow_id
textOne ofWhat the person wrote, up to 10,000 characters
fieldsOne ofYour question names mapped to answers
replyNonone (default) or link
idempotency_keyYesUp 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.

  • from is one bare email address such as ada@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 as com or nl. International domains are accepted.
  • fields holds 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 or null answer is dropped.
  • workflow_id and case_type_id are 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 200 with 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. For reply: "none" this also happens once the person has sent the form. A reply: "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

LimitCounted per
20 enquiries a daysender, in each workspace
3 link emails a dayrecipient, in each workspace
3 link emails a dayrecipient, across all of Klarefi
60 link emails an hourworkspace

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

StatusCodeCause
400invalid_jsonThe body is not a JSON object
400missing_fromNo from
400invalid_fromfrom is not one bare email address or one phone number
400invalid_texttext is not a string, or is longer than 10,000 characters
400invalid_fieldsfields breaks one of the limits above
400duplicate_fieldTwo answers name the same question
400empty_enquiryNeither text nor fields holds anything
400files_not_supportedThe body has files
400invalid_replyreply is not none or link
400link_needs_emailreply: "link" without an email address in from
400invalid_routeworkflow_id or case_type_id is empty or too long
400missing_workflowNeither or both of workflow_id and case_type_id
400invalid_idempotency_keyThe idempotency key is empty or too long
400missing_idempotency_keyNo idempotency key in the body or the header
400idempotency_key_conflictThe key was used for a different enquiry
404unknown_workflow_idThe workflow is not in this workspace
404unknown_case_type_idThe case type is not in this workspace
402billing_requiredA live key, and the workspace has no active pilot or contract
402live_usage_cap_exceededA live key, and the workspace reached its live usage cap
413request_too_largeThe body is larger than 64 KB
428legal_acceptance_requiredA live key, and the current terms were not accepted
428reply_address_requiredreply: "link" and no reply address is set
428workflow_not_publishedThe 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
428draft_check_unavailableA 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
428too_many_draftsA 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
429test_usage_cap_exceededThe monthly test session cap is reached
429rate_limit_exceededA limit above, or the per-key request rate, was reached; see Retry-After

On this page