Skip to main content
Docs menu

API reference

Headless

Hand-off links for a person, file uploads, test calls and preview links, so an integration or AI agent can finish steps without the dashboard.

Beta. These endpoints are switched on per organization. While they are off for yours, each one answers 403 headless_off. Ask Finn support to turn them on.

Overview

Some steps need a person or a file: connecting an app, paying for a top-up, uploading a document, hearing a Finn on the phone, looking at a draft. These endpoints let an integration or an AI agent do those steps without the dashboard:

  • Hand-offs answer a link for a person to open (connect an app, pay a top-up, sign up for WhatsApp), then let you poll the result.
  • Uploads answer a storage URL to PUT a file to, then register the file where it belongs.
  • Test calls ring a number with a Finn and return the transcript and a verdict.
  • Previews answer a link a person can open to see an agent, a form or an email template.

They are the API behind the MCP server's get_handoff_status, get_upload_url, finish_upload, run_test_call, get_test_call and get_preview_link tools.

Base URL: https://api.hirefinn.ai/api/v1. See authentication and scopes.

Credential

Org API keys and member tokens (a personal MCP key or an AI app's OAuth access token) both work. Hand-offs and logo uploads need an org key or a member who is a workspace Owner or Admin; other members get 403 forbidden.

Hand-offs

MethodPathScopeWhat it does
GET/handoffsadmin:readList hand-offs.
POST/handoffsadmin:writeStart a hand-off link.
GET/handoffs/{handoff_id}admin:readPoll a hand-off.

POST /handoffs takes a kind:

kindSendLink lastsPoll
connectprovider (a catalog key, such as hubspot) and an optional label, or connection_id to reconnect30 minutesGET /handoffs/{handoff_id} shows the connection settle.
checkoutcredits (whole number) or amount_minor, not both, and an optional currency. Needs checkout links on too (403 headless_checkout_off otherwise).30 minutesA link paid just before it lapsed is still credited when polled.
whatsapp_signupNothing else24 hoursNot available yet (status_polling: "not_available").

The url is in the create answer only. It is never stored, and a replay with the same Idempotency-Key answers without it (url_returned: "once"). An open hand-off past its expiry reads as expired.

Uploads

MethodPathScopeWhat it does
POST/uploadscrm:docs:writeGet an upload URL.
GET/uploads/{upload_id}crm:readGet an upload.
POST/uploads/{upload_id}/completecrm:docs:writeRegister an uploaded file.

The scope follows the upload's purpose:

purposeScopeFilestarget
contact_filecrm:docs:writeDocuments, images and spreadsheets{ contact_id } or { phone }, optional doc_type
knowledge_documentfinn:writepdf, doc, docx, txt up to 25 MB{ finn_id }
import_csvcrm:importcsv or xlsx up to 20 MBNone. Use the file with /crm/imports once it is uploaded.
logoadmin:writepng, jpeg, gif, webp up to 2 MBNone. Org key or Owner or Admin only.

PUT the bytes to upload_url with upload_headers within 10 minutes, then call POST /uploads/{upload_id}/complete. Finn checks the type and size and registers the file. Calling complete again on a completed upload answers the upload as it is.

Test calls

MethodPathScopeWhat it does
POST/test_callsvoice:writeRing a number with a Finn (test call).
GET/test_calls/{test_call_id}voice:readGet a test call.

Before anything else, to_number is checked against your organization's test-call allow-list (422 destination_not_allowed) and the daily test-call cap (429 test_call_limit). Then the call is held for a person to approve (hold action test_call.create) unless your organization relaxed outward actions. An org key's call is held too, unless to_number is on the organization's verified list. A held call answers 202 with an approval_id; poll GET /approvals/{id}. See requests held for approval.

Poll GET /test_calls/{test_call_id} for the status, duration, transcript, post-call analysis and a verdict: connected, no_answer, failed or in_progress, with reasons.

Previews

MethodPathScopeWhat it does
POST/previewsfinn:readGet a preview link.
DELETE/previews/{preview_id}crm:readRevoke a preview link.

POST /previews takes a kind (agent, form or email_template) and an id, and needs that kind's read scope: finn:read for an agent, crm:read for the others. An agent with an active share link answers that link (via: "share_link"). Otherwise it is a signed link that lasts 10 minutes (via: "signed", with a preview_id). DELETE /previews/{preview_id} kills a signed link at once; its next open answers 410. Revoking a link that is already dead answers 200 with was_live: false. A member who isn't an Owner or Admin can revoke only their own previews.

Idempotency

POST /handoffs, POST /uploads, POST /uploads/{upload_id}/complete and POST /test_calls need an Idempotency-Key header (400 idempotency_key_required). POST /previews is a read and needs none. See idempotency.

Example: ring your phone with a Finn

curl -X POST https://api.hirefinn.ai/api/v1/test_calls \
  -H "Authorization: Bearer $FINN_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: test-call-frontdesk-001" \
  -d '{
    "finn_id": "1b2c3d4e-5f6a-4b7c-8d9e-0f1a2b3c4d5e",
    "to_number": "+919800000001"
  }'

201 Created when the call starts:

{
  "object": "test_call",
  "id": "8e7d6c5b-4a3f-4e2d-9c1b-0a9f8e7d6c5b",
  "status": "initiated",
  "finn_id": "1b2c3d4e-5f6a-4b7c-8d9e-0f1a2b3c4d5e",
  "to_number": "+919800000001",
  "warnings": ["no goodbye step"]
}

202 Accepted when it is held: "status": "pending_approval" with approval_id, approve_url, expires_at and "action": "test_call.create". Nothing has rung yet.

FieldTypeRequiredNotes
finn_idstringYesThe Finn to test.
to_numberstringYesE.164. Must be on your test-call allow-list.
from_numberstringNoOne of your numbers.

Rate limits

120 reads and 30 writes per minute per credential, across all endpoints on this page. See rate limits.

Errors

StatusCodeWhen
400invalid_requestA field isn't valid, for example kind, provider, credits, purpose, size_bytes or to_number.
400idempotency_key_requiredA create without an Idempotency-Key.
401api_key_required, invalid_api_keyThe credential is missing, unknown or revoked.
403headless_offThese endpoints aren't turned on for your organization.
403headless_checkout_offA checkout hand-off while checkout links are off.
403insufficient_scopeThe credential lacks the scope.
403forbiddenA hand-off or logo upload by a member below Owner or Admin.
404handoff_not_found, upload_not_found, test_call_not_found, preview_not_foundNo such item in your organization.
404contact_not_found, finn_not_foundThe target or finn_id isn't in your organization.
409upload_expired, upload_closedThe upload can't be completed any more. Start a new one.
409call_refusedThe voice service refused the test call.
422destination_not_allowedto_number isn't one your organization may test-call.
423ai_apps_pausedAn admin paused all AI apps. Writes are refused; reads still work.
429rate_limited, test_call_limitOver the rate limit, or the daily test-call cap.
503unavailableThe organization's settings couldn't be read, or this environment isn't ready for hand-offs and uploads. Try again shortly.