Skip to main content
Docs menu

API reference

Flows

Set up an agent, import contacts, launch a campaign or set up a workspace in one request. Dry run by default; real runs need an Idempotency-Key.

Beta. These endpoints are switched on per organization. While they are off for yours, each one answers 404 not_found, as if it didn't exist. Ask Finn support to turn them on.

Overview

A flow runs a common job that takes several API calls, in the right order, as one request: set up a voice agent, import contacts, launch a calling campaign, or set up a new workspace. They are the API behind the MCP server's flow_setup_agent, flow_import_contacts, flow_launch_campaign and flow_setup_workspace tools.

Every flow is a dry run unless you say otherwise. A dry run checks everything, lists each step it would take, and changes nothing. Send "dry_run": false to do it.

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

Endpoints

MethodPathScopeWhat it does
POST/flows/agent_setupfinn:writeSet up a voice agent (flow).
POST/flows/contact_importcrm:importImport contacts (flow).
POST/flows/campaign_launchvoice:writeLaunch a calling campaign (flow).
POST/flows/workspace_setupadmin:writeSet up the workspace (flow).

Each step runs as the caller, with that step's own scope, role and approval rules, exactly as if you had made the call yourself. The scope column shows the scope the main steps need.

Credential

FlowCredentialRole
agent_setupOrg API key or member tokenRenting a number (rent_number) needs an Admin.
contact_importMember token requiredThe commit step is held for approval.
campaign_launchOrg API key or member tokenA Supervisor or above when role rules are on.
workspace_setupMember token requiredAdmin or Owner.

An org key acts as an Admin. A role below the one a flow needs gets 403 forbidden.

What each flow does

FlowSendSteps
agent_setupThe agent, its handbook, up to 10 knowledge documents, speech settings, and optionally a number to rentcreate_agent (POST /finns), handbook, knowledge documents, speech_settings, enable_flow, then rent_number (POST /phone_numbers, costs money). Checks the voice exists first.
contact_importUp to 500 rows, and a column mapping if you have onemap_columns (skipped when you send a mapping), check_duplicates (a dry import), commit (POST /crm/imports).
campaign_launchfinn_id, phone_number_id and audience_id (required), and optionally name, schedule, recording_enabled, redial, max_concurrencyOne step, start_campaign (POST /deployments). It costs money and is held for approval.
workspace_setupA name, profile, timezone and up to 25 invitationsrename, profile, timezone, then each invitation (held for approval). Also reads the integrations checklist. Pipeline stages and calling hours aren't set here.

Real runs

A real run ("dry_run": false) needs an Idempotency-Key header (400 idempotency_key_required). A retry with the same key doesn't repeat steps that are done. See idempotency.

A step that is held for approval stops the flow there with "status": "pending_approval". The step carries its approval details; the steps after it are not_run. Once it is approved, run the flow again with the same Idempotency-Key to carry on. If your organization can't resume held flows yet, that run answers 409 resume_unavailable. See requests held for approval.

The answer

FieldMeaning
flow, dry_runWhat ran, and whether it was a dry run.
statusplanned (dry run, nothing blocks it), blocked (a check failed), pending_approval, failed or done.
checksEach check, with ok and a detail.
blocked_byThe checks that failed.
stepsEach step: step, method, path, body, why, costs_money, and its status: planned, blocked, done, pending_approval, failed or not_run. A step that ran adds http_status and result or error.
nextWhat to do next, in plain words.

Example: check a campaign before launching it

curl -X POST https://api.hirefinn.ai/api/v1/flows/campaign_launch \
  -H "Authorization: Bearer $FINN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "finn_id": "1b2c3d4e-5f6a-4b7c-8d9e-0f1a2b3c4d5e",
    "phone_number_id": "5a4b3c2d-1e0f-4a9b-8c7d-6e5f4a3b2c1d",
    "audience_id": "9f8e7d6c-5b4a-4c3d-8e2f-1a0b9c8d7e6f",
    "name": "November renewals"
  }'
{
  "flow": "campaign_launch",
  "dry_run": true,
  "status": "planned",
  "checks": [
    { "check": "agent_exists", "ok": true },
    { "check": "number_exists", "ok": true },
    { "check": "audience_ready", "ok": true, "detail": { "recipients": 412, "name": "Renewals due December" } },
    { "check": "call_credit", "ok": true, "detail": { "balance": 18450 } },
    { "check": "calling_window", "ok": true },
    { "check": "do_not_call", "ok": true, "detail": "Numbers on your do-not-call list are skipped when the campaign dials." }
  ],
  "blocked_by": [],
  "steps": [
    {
      "step": "start_campaign",
      "method": "POST",
      "path": "/deployments",
      "body": {
        "finn_id": "1b2c3d4e-5f6a-4b7c-8d9e-0f1a2b3c4d5e",
        "phone_number_id": "5a4b3c2d-1e0f-4a9b-8c7d-6e5f4a3b2c1d",
        "audience_id": "9f8e7d6c-5b4a-4c3d-8e2f-1a0b9c8d7e6f",
        "name": "November renewals"
      },
      "why": "Start the campaign (spends call credit: held for a person to approve; Supervisors and up)",
      "costs_money": true,
      "status": "planned"
    }
  ],
  "next": "Nothing was changed. Run again with dry_run: false and an Idempotency-Key to do it."
}

Rate limits

20 flow runs per minute per credential, dry runs included (429 rate_limited). The steps also count toward the limits of the endpoints they call. See rate limits.

Errors

StatusCodeWhen
400invalid_requestThe body isn't valid, for example dry_run isn't true or false, or a required field is missing.
400idempotency_key_requiredA real run without an Idempotency-Key.
401api_key_required, invalid_api_keyThe credential is missing, unknown or revoked.
403forbiddenThe caller's role is below what the flow needs.
403insufficient_scopeA step needs a scope the credential lacks. The step shows the error.
404not_foundFlows aren't turned on for your organization.
409resume_unavailableA step is held and this organization can't resume held flows yet.
429rate_limitedOver 20 runs a minute. Wait Retry-After seconds.
503unavailableThe organization's settings couldn't be read. Try again shortly.