# Agent skills Source: https://docs.formbharo.artpark.ai/agents/skills Install the FormBharo skills so a coding agent can build and manage voice form agents for you. An [Agent Skill](https://agentskills.io) is a folder of instructions that teaches a coding agent how to do one specific job. FormBharo publishes two. | Skill | What it does | | - | - | | `formbharo-start` | Walks you through your first agent: gets your API key, builds the agent, gives you a link to call it | | `formbharo` | Builds and edits agents, pulls the answers people gave on calls, reads the analytics | ## Install ```bash Claude Code theme={null} npx skills add ARTPARK-SAHAI-ORG/formbharo-skills --agent claude-code -g ``` ```bash Cursor theme={null} npx skills add ARTPARK-SAHAI-ORG/formbharo-skills --agent cursor ``` ```bash Windsurf theme={null} npx skills add ARTPARK-SAHAI-ORG/formbharo-skills --agent windsurf ``` ```bash Codex theme={null} npx skills add ARTPARK-SAHAI-ORG/formbharo-skills --agent codex ``` Restart your coding agent session after installing so it picks up the skills. The repo is public ([ARTPARK-SAHAI-ORG/formbharo-skills](https://github.com/ARTPARK-SAHAI-ORG/formbharo-skills)), so no credentials are needed. ## Start here Call the first skill by name: ``` /formbharo-start ``` It asks what you want to find out on the call and in what language, builds and publishes the agent, and gives you a link you can ring up and try. It asks for your API key along the way and saves it, so you paste the key once. After that first agent, say what you want in your own words: "add a question about age", "show me last week's calls", "put the answers in a spreadsheet". ### Manual install ```bash theme={null} git clone https://github.com/ARTPARK-SAHAI-ORG/formbharo-skills.git cp -r formbharo-skills/skills/formbharo ~/.claude/skills/formbharo cp -r formbharo-skills/skills/formbharo-start ~/.claude/skills/formbharo-start ``` Copy both folders whole, since `formbharo-start` links across to `formbharo`. Those paths are for Claude Code. Cursor reads `.cursor/skills/`, and Windsurf and Codex each have their own skills folder. ## The API key Open the web app, click your profile picture in the top right, then **API keys**. The key starts with `fb_live_` and is shown once. The first time a skill needs the key it asks you for it. Paste it in and it is saved to the `env` block of `~/.claude/settings.json`, so you are asked once. To check a key yourself, put it in `FORMBHARO_API_KEY` and run: ```bash theme={null} curl -s -H "Authorization: Bearer $FORMBHARO_API_KEY" "https://api.formbharo.artpark.ai/api/v1/agents" ``` A list back, even an empty `[]`, means the key works. ## What they can do Describe your form in plain English, for example "collect name, age, and whether they have a fever, in Hindi", and the skill builds and publishes the agent. You can also ask it to edit an existing agent, pull the answers people gave on calls, and read back analytics. They work from a plain-English description only, not a PDF or document directly. To turn a form document into an agent, see [Create an agent from a PDF](/guides/pdf-to-form). ## Next steps > [card] [Agent config schema](/reference/agent-config-schema) > > See the full shape of an agent's JSON config > [card] [API keys](/getting-started/api-keys) > > Create the API key the skills authenticate with # Create Agent Source: https://docs.formbharo.artpark.ai/api-reference/agents/create-agent /api-reference/openapi.json post /api/v1/agents Create a new agent with the given title and questions. # Create Conversation Source: https://docs.formbharo.artpark.ai/api-reference/agents/create-conversation /api-reference/openapi.json post /api/v1/conversations Start a conversation and return the token that authorizes its answers. Refused with 403 when the workspace has used its calling minutes for this month. Open on purpose: anyone who can open an agent's call page can start a call. The id is generated here rather than accepted from the caller, so one caller cannot name another caller's conversation and read or overwrite it. # Delete Agent Source: https://docs.formbharo.artpark.ai/api-reference/agents/delete-agent /api-reference/openapi.json delete /api/v1/agents/{agent_id} Soft delete an agent by setting deleted = true in config. # Get Agent Source: https://docs.formbharo.artpark.ai/api-reference/agents/get-agent /api-reference/openapi.json get /api/v1/agents/{agent_id} Return the config for a specific agent. # Get Agent Access Source: https://docs.formbharo.artpark.ai/api-reference/agents/get-agent-access /api-reference/openapi.json get /api/v1/agents/{agent_id}/access Return an agent's owner and the emails with access to it. # Get Agents Source: https://docs.formbharo.artpark.ai/api-reference/agents/get-agents /api-reference/openapi.json get /api/v1/agents Return every agent the user can see, newest first. Add ``limit`` or ``cursor`` to page results. # Get Data Source: https://docs.formbharo.artpark.ai/api-reference/agents/get-data /api-reference/openapi.json get /api/v1/data/{agent_id}/{conversation_id} Return the answers collected on one conversation. Send the conversation's token as ``X-Conversation-Token``, or an API key that reaches the agent. # Get Public Agent Source: https://docs.formbharo.artpark.ai/api-reference/agents/get-public-agent /api-reference/openapi.json get /api/v1/agents/{agent_id}/public Return the public config needed to start a conversation. # Get Transcript Source: https://docs.formbharo.artpark.ai/api-reference/agents/get-transcript /api-reference/openapi.json get /api/v1/agents/{agent_id}/conversations/{conversation_id}/transcript Return the transcript for a conversation. # List Conversations Source: https://docs.formbharo.artpark.ai/api-reference/agents/list-conversations /api-reference/openapi.json get /api/v1/agents/{agent_id}/conversations Return an agent's conversations: form data and recording availability, newest first. Add ``limit`` or ``cursor`` to page. Set ``include_transcript=true`` to include each row's transcript (off by default); when off, ``transcript`` and ``has_transcript`` are absent from the row, not empty. # Update Agent Source: https://docs.formbharo.artpark.ai/api-reference/agents/update-agent /api-reference/openapi.json put /api/v1/agents/{agent_id} Update an existing agent with the given data. # Update Agent Access Source: https://docs.formbharo.artpark.ai/api-reference/agents/update-agent-access /api-reference/openapi.json put /api/v1/agents/{agent_id}/access Replace the list of admin emails that can manage an agent. # Update Agent Config Json Source: https://docs.formbharo.artpark.ai/api-reference/agents/update-agent-config-json /api-reference/openapi.json put /api/v1/agents/{agent_id}/config Update an existing agent by replacing config.json directly. # Update Conversation Form Data Source: https://docs.formbharo.artpark.ai/api-reference/agents/update-conversation-form-data /api-reference/openapi.json patch /api/v1/agents/{agent_id}/conversations/{conversation_id}/form_data Validate and persist manual edits to conversation form_data. Send the conversation's token as ``X-Conversation-Token``, or an API key that reaches the agent. # Get Agent Analytics Source: https://docs.formbharo.artpark.ai/api-reference/analytics/get-agent-analytics /api-reference/openapi.json get /api/v1/agents/{agent_id}/analytics The Overview tab numbers for one agent, computed on the server. # Get Workspace Analytics Source: https://docs.formbharo.artpark.ai/api-reference/analytics/get-workspace-analytics /api-reference/openapi.json get /api/v1/workspaces/{workspace_id}/analytics The same numbers rolled up over a workspace, plus a per-agent breakdown. # List All Conversations Source: https://docs.formbharo.artpark.ai/api-reference/analytics/list-all-conversations /api-reference/openapi.json get /api/v1/conversations Conversations across every agent the caller can see, newest first. ``cursor`` is the offset into the sorted result set. It is honest about what it is: calls recorded between two page requests shift later rows, so a row can repeat or be missed while paging through a live agent. # Introduction Source: https://docs.formbharo.artpark.ai/api-reference/introduction Base path, authentication, and resource groups for the FormBharo REST API. The FormBharo REST API is organized into resource groups: Agents, Calls, Analytics, and Workspaces. All endpoints are under `/api/v1` on your FormBharo server, with one exception: `POST /offer`, the WebRTC signalling path, which lives at the bare root. ## Authentication Every request must include an `Authorization` header with your API key. See [API keys](/getting-started/api-keys) for how to create one. ```http theme={null} Authorization: Bearer fb_live_0123456789ab_... ``` Running a call from your own page needs no key: `POST /api/v1/conversations` returns a conversation id and a token, and that token authorizes the audio connection and the answer poll. See [Run a call](/guides/run-a-call). > [!NOTE] > > Keep your API key secret. Never embed it in client-side JavaScript or expose it in a public repository. Rotate it immediately if it is compromised. ## Base URL Every example in this reference uses this address. ```text theme={null} https://api.formbharo.artpark.ai ``` All API paths are then appended after this base. For example: ```text theme={null} https://api.formbharo.artpark.ai/api/v1/agents ``` ## Errors | Code | Meaning | | - | - | | 401 | The `Authorization` header is missing, or the key is not valid. | | 403 | The workspace or agent exists and your key may not use it. | | 404 | The workspace or agent does not exist. | | 422 | The request body failed validation. | A 403 or a 404 carries the reason in an `error` field. ```json theme={null} { "error": "You do not have access to this workspace." } ``` A key belongs to one workspace. A request for an agent or a workspace outside it returns 404, the same as an id that does not exist. ## Resource groups > [card] [Agents](/api-reference/agents/get-agents) > > Create, read, update, delete, and publish agents. Manage access lists and move agents between workspaces > [card] [Calls](/api-reference/analytics/list-all-conversations) > > Read conversations, retrieve collected answers, and download full call transcripts > [card] [Analytics](/api-reference/analytics/get-agent-analytics) > > Query completion rates, average call duration, and per-agent cost breakdowns > [card] [Workspaces](/api-reference/workspaces/get-workspaces) > > Manage workspace membership, roles, and settings across your organization # Create Workspace Endpoint Source: https://docs.formbharo.artpark.ai/api-reference/workspaces/create-workspace-endpoint /api-reference/openapi.json post /api/v1/workspaces Create a new workspace owned by the current user. # Get Workspace Endpoint Source: https://docs.formbharo.artpark.ai/api-reference/workspaces/get-workspace-endpoint /api-reference/openapi.json get /api/v1/workspaces/{workspace_id} Return workspace details and members. Workspace admins only. # Get Workspaces Source: https://docs.formbharo.artpark.ai/api-reference/workspaces/get-workspaces /api-reference/openapi.json get /api/v1/workspaces List workspaces visible to the user: ones they administer, or have per-form access to at least one agent inside. Add ``limit`` or ``cursor`` to page results. # Rename Workspace Endpoint Source: https://docs.formbharo.artpark.ai/api-reference/workspaces/rename-workspace-endpoint /api-reference/openapi.json put /api/v1/workspaces/{workspace_id} Rename a workspace. Workspace admins only. # API keys Source: https://docs.formbharo.artpark.ai/getting-started/api-keys Create a key in the web app and send it on every request. ## Create a key **1. Sign in to FormBharo** Go to [formbharo.artpark.ai](https://formbharo.artpark.ai) and sign in. **2. Open API keys** Click your profile picture in the top right, then **API keys**. This opens your workspace, where the keys live. Any member of a workspace can create one. **3. Create it** Click **Create API key**, enter a name, then **Create key**. **4. Copy it now** The key is shown once. Copy it and store it somewhere safe. > [!WARNING] > > You cannot view the full key again after closing the dialog. If you lose it, revoke it and create a new one. Keys start with `fb_live_`. ## Use it Send the key as a bearer token on every request. ```bash theme={null} curl "https://api.formbharo.artpark.ai/api/v1/agents" \ -H "Authorization: Bearer $FORMBHARO_KEY" ``` A list of your agents, or `[]` if you have none, means the key works. ## What a key can do A key reaches the agents in its workspace and acts with the role you hold there. ## Revoke a key Find the key by name in the same **API keys** table and click **Revoke**. The next request using it gets `401`. > [!NOTE] > > Never commit a key to source control or embed it in client-side JavaScript. Use environment variables or your team's secret manager. # Introduction Source: https://docs.formbharo.artpark.ai/getting-started/introduction What FormBharo does and where to start. Turn any form into a voice agent. Filling forms by hand is tedious, and those who cannot read or write have to depend on others to help them. FormBharo speaks to each person and fills the form as they answer. [FormBharo demo](https://www.youtube-nocookie.com/embed/oak0_1wKe7A) ## What you can do with it > [card] [Conditional branching](/reference/agent-config-schema) > > Skip or show groups of questions based on earlier answers > [card] [Field validation](/reference/agent-config-schema) > > Validate phone numbers, date ranges, regex patterns, and custom rules > [card] [Multiple question types](/reference/agent-config-schema) > > Text, number, date, boolean, and single/multi-select questions > [card] [Call analytics](/guides/read-the-analytics) > > Completion rates, latency, and cost breakdowns per agent > [card] Telephony and browser calls > > Works over the browser or a real phone call (Twilio, Exotel) ## Get started > [card] [Quickstart](/getting-started/quickstart) > > Create your first voice agent in under five minutes > [card] [Build an agent](/guides/build-an-agent) > > Turn a form into a voice agent > [card] [Agent skills](/agents/skills) > > Teach Claude Code, Cursor, or another AI coding agent to build FormBharo agents for you > [card] [API Reference](/api-reference/introduction) > > Full reference for every endpoint # Quickstart Source: https://docs.formbharo.artpark.ai/getting-started/quickstart Create an agent, publish it, and read its analytics. You need an API key. See [API keys](/getting-started/api-keys). **1. Set your API key** ```bash theme={null} export FORMBHARO_KEY="fb_live_0123456789ab_REPLACE_THIS_WITH_YOUR_KEY" ``` **2. Create an agent** `POST` always creates a draft. ```bash curl theme={null} curl -X POST "https://api.formbharo.artpark.ai/api/v1/agents" \ -H "Authorization: Bearer $FORMBHARO_KEY" \ -H "Content-Type: application/json" \ -d '{ "title": "Clinic intake", "questions": [ { "question": "What is your full name?", "response_type": "string" }, { "question": "What is your date of birth?", "response_type": "date" } ] }' ``` ```python Python theme={null} import os import requests body = { "title": "Clinic intake", "questions": [ {"question": "What is your full name?", "response_type": "string"}, {"question": "What is your date of birth?", "response_type": "date"}, ], } response = requests.post( "https://api.formbharo.artpark.ai/api/v1/agents", headers={"Authorization": f"Bearer {os.environ['FORMBHARO_KEY']}"}, json=body, ) response.raise_for_status() agent_id = response.json()["id"] ``` Save the `id` from the response. **3. Publish it** `PUT` always publishes. Send the same body again. ```bash curl theme={null} curl -X PUT "https://api.formbharo.artpark.ai/api/v1/agents/AGENT_ID" \ -H "Authorization: Bearer $FORMBHARO_KEY" \ -H "Content-Type: application/json" \ -d '{ "title": "Clinic intake", "questions": [ { "question": "What is your full name?", "response_type": "string" }, { "question": "What is your date of birth?", "response_type": "date" } ] }' ``` **4. Call it** Open the agent's call page and talk to it. ``` https://formbharo.artpark.ai/agents/AGENT_ID ``` Anyone with the link can fill the form by voice. No account needed. To run the call inside your own page instead, see [Run a call](/guides/run-a-call). **5. Read its analytics** ```bash theme={null} curl "https://api.formbharo.artpark.ai/api/v1/agents/AGENT_ID/analytics" \ -H "Authorization: Bearer $FORMBHARO_KEY" ``` Completion rate, call duration, and cost. ## Next steps > [card] [Build an agent](/guides/build-an-agent) > > Question types, scripts, branching, validation > [card] [Run a call](/guides/run-a-call) > > Embed a live call on your own page > [card] [Poll for calls](/guides/poll-for-finished-calls) > > Sync finished calls into your systems > [card] [Analyze the calls](/guides/read-the-analytics) > > Completion rates, latency, cost # Build an agent Source: https://docs.formbharo.artpark.ai/guides/build-an-agent Turn a form into a FormBharo voice agent: map fields to question types, add scripts, configure branching, and publish with the API. **1. Create a draft agent** `POST /api/v1/agents` always creates a draft. Send a `title` and a `questions` array. The response contains the `id`. ```bash curl theme={null} curl -X POST https://api.formbharo.artpark.ai/api/v1/agents \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{ "title": "Clinic intake", "questions": [ { "question": "What is your full name?", "response_type": "string" }, { "question": "What is your date of birth?", "response_type": "date" } ] }' ``` ```python python theme={null} import requests response = requests.post( "https://api.formbharo.artpark.ai/api/v1/agents", headers={"Authorization": "Bearer "}, json={ "title": "Clinic intake", "questions": [ { "question": "What is your full name?", "response_type": "string", }, { "question": "What is your date of birth?", "response_type": "date", }, ], }, ) agent_id = response.json()["id"] ``` **2. Map each field to a question type** `response_type` sets how the spoken answer is parsed and stored. | `response_type` | What it stores | Extra options | | - | - | - | | `string` | Free-text answer | | | `number` | Numeric value | `number_format: "integer"` or `"decimal"` | | `date` | Date, stored as `DD-MM-YYYY` | | | `boolean` | Yes/no answer | `boolean_labels` to customize the spoken options | | `single-select` | One choice from a list | `options[]`, required | | `multi-select` | One or more choices from a list | `options[]`, required | `options` is an array of strings. The agent reads the list aloud and maps the answer to the closest option. Omit `number_format` to accept both integers and decimals. Add an optional `name` to a question to give it a stable snake\_case key. Branch conditions reference questions by `name`. **3. Add scripts** Set `scripts` on the agent body. | Field | When the agent says it | | - | - | | `scripts.intro` | At the start of the call, before the first question | | `scripts.outro` | After all required questions are answered | | `scripts.outro_incomplete` | When the call ends before all questions are answered | `outro_incomplete` requires `outro`. ```json theme={null} { "scripts": { "intro": "Hi, I'm calling on behalf of City Clinic to complete your intake form. This will only take a couple of minutes.", "outro": "That's everything I need. Thank you for your time, we'll see you at your appointment.", "outro_incomplete": "It looks like we ran out of time. Our team will follow up to collect the remaining details." } } ``` **4. Add conditional branches** 1. Add an entry to the top-level `branches` array with a unique `id` and a `condition`. 2. Set `branch_id` on every question in that branch. Those questions are asked only when the condition is true. A condition supports these fields: | Field | Type | Meaning | | - | - | - | | `field` | string | The `name` of the question whose answer is evaluated | | `equals` | boolean | Matches the answer to a `boolean` question | | `present` | boolean | `true` asks the branch when the question was answered, `false` asks it when the question was skipped | Set exactly one of `equals` or `present`. ```json Equals condition theme={null} { "branches": [ { "id": "has_insurance", "condition": { "field": "insurance_status", "equals": true } } ], "questions": [ { "name": "insurance_status", "question": "Do you have health insurance?", "response_type": "boolean" }, { "question": "Who is your insurance provider?", "response_type": "string", "branch_id": "has_insurance" }, { "question": "What is your policy number?", "response_type": "string", "branch_id": "has_insurance" } ] } ``` ```json Present condition theme={null} { "branches": [ { "id": "has_referral", "condition": { "field": "referral_source", "present": true } } ], "questions": [ { "name": "referral_source", "question": "Were you referred by someone?", "response_type": "string" }, { "question": "What is the name of the person who referred you?", "response_type": "string", "branch_id": "has_referral" } ] } ``` **5. Configure screening** `end_call_values` is an array of strings set on a question. When the answer to that question matches one of the values, the agent ends the call and marks the conversation `screened_out`. Screened-out calls count as successes, not failures, and appear separately in analytics. ```json theme={null} { "question": "Are you interested in scheduling an appointment?", "response_type": "boolean", "end_call_values": ["no"] } ``` **6. Publish** `PUT /api/v1/agents/{agent_id}` always publishes. Send the complete agent body, not just the changed fields. ```bash curl theme={null} curl -X PUT https://api.formbharo.artpark.ai/api/v1/agents/AGENT_ID \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{ "title": "Clinic intake", "questions": [ ... ], "scripts": { ... }, "branches": [ ... ] }' ``` ```python python theme={null} import requests agent_body = { "title": "Clinic intake", "questions": [...], "scripts": {...}, "branches": [...], } response = requests.put( f"https://api.formbharo.artpark.ai/api/v1/agents/{agent_id}", headers={"Authorization": "Bearer "}, json=agent_body, ) if response.status_code == 400: print("Validation failed:", response.json()["validation_issues"]) else: print("Published:", response.json()) ``` > [!WARNING] > > On validation failure the API returns `400` with a `validation_issues` array. Fix every issue before retrying. Partial saves are not supported. > [!TIP] > > See [Agent config schema](/reference/agent-config-schema) for every field. # Create an agent from a PDF Source: https://docs.formbharo.artpark.ai/guides/pdf-to-form Read a form PDF with Claude, then hand the extracted questions to the formbharo skill to build the agent. Claude reads the PDF and the `formbharo` skill builds the agent from the question list it produces; the skill itself has no PDF reading. ## Prerequisites * The `formbharo` skill installed. See [Agent skills](/agents/skills). * A FormBharo API key. The skill asks you for it the first time it needs one. See [Agent skills](/agents/skills). **1. Attach the PDF and ask Claude to read it** Attach the form PDF to your conversation and ask Claude to list every question or field on the form. **2. Review and correct the extracted list** Check the list against the form. Fix anything Claude misread, and tell it the language and tone you want, for example, "ask these in Hindi, keep it friendly." **3. Ask Claude to build the agent** Ask Claude to build a FormBharo agent from the list. From here it is the same skill workflow as building from a typed description. See [Agent skills](/agents/skills). **4. The skill creates and publishes the agent** The skill creates the agent as a draft (`POST /api/v1/agents`), then publishes it (`PUT /api/v1/agents/{agent_id}`). **5. Review the agent before real calls** Check the agent in the web app, or with `GET /api/v1/agents/{agent_id}`. PDFs are often subtly wrong on: * **Field types.** A "date of birth" field should become `response_type: "date"`, not `"string"`. See [Agent config schema](/reference/agent-config-schema). * **Option lists.** Check that every choice on a single-select or multi-select field made it into `options[]`, spelled the way you want it read aloud. * **Validation the form implied but did not spell out.** A phone number field should usually get a `phone_number` validation rule. See [Agent config schema](/reference/agent-config-schema). > [!WARNING] > > OCR can misread a scanned or handwritten PDF. Check the extracted question list against the source form before publishing, especially field types and which questions are required. ## Next steps > [card] [Agent config schema](/reference/agent-config-schema) > > See the full shape of an agent's JSON config > [card] [Agent skills](/agents/skills) > > Install the skill and see everything it can do # Poll for calls Source: https://docs.formbharo.artpark.ai/guides/poll-for-finished-calls Use GET /api/v1/conversations?since= to continuously pull completed calls into your database, spreadsheet, or case management system. `GET /api/v1/conversations` returns finished calls across every agent. Filter on `since` to fetch only what changed since your last poll. ## The polling pattern **1. First poll** Call the endpoint with `since=0` to retrieve all calls, then save the largest `created_at` in the response as your cursor. ```bash curl theme={null} curl "https://api.formbharo.artpark.ai/api/v1/conversations?since=0" \ -H "Authorization: Bearer " ``` **2. Later polls** Pass the saved cursor as `since=`. Save the new largest `created_at` each time. **3. Repeat** Poll at most a few times per minute. ## Things to know * `since` is inclusive, so the call at the boundary comes back in the next poll. * `created_at` is the last-write time, not the call start time. Editing an answer on an old call moves it into the current window. Match on `conversation_id` and update the existing row instead of inserting a new one. ## Example request ```bash curl theme={null} curl -G "https://api.formbharo.artpark.ai/api/v1/conversations" \ -H "Authorization: Bearer " \ --data-urlencode "since=0" \ --data-urlencode "status=complete" \ --data-urlencode "limit=50" ``` ```python python theme={null} import requests BASE_URL = "https://api.formbharo.artpark.ai" HEADERS = {"Authorization": "Bearer "} def poll_conversations(since: int = 0) -> list[dict]: params = { "since": since, "status": "complete", "limit": 50, } all_conversations = [] cursor = None while True: if cursor: params["cursor"] = cursor response = requests.get( f"{BASE_URL}/api/v1/conversations", headers=HEADERS, params=params, ) response.raise_for_status() data = response.json() all_conversations.extend(data.get("data", [])) cursor = data.get("next_cursor") if not cursor: break return all_conversations results = poll_conversations(since=0) if results: last_created_at = max(r["created_at"] for r in results) print(f"Next poll: since={last_created_at}") ``` ## Query parameters | Parameter | Description | | - | - | | `agent_id` | Only conversations for one agent | | `workspace_id` | Only conversations for one workspace | | `status` | `in_progress`, `complete`, `screened_out`, or `failed` | | `source` | The source that started the call | | `since` | Unix timestamp, inclusive: `created_at >= since` | | `until` | Unix timestamp, inclusive: `created_at <= until` | | `limit` | Rows per page, `1` to `200`. Defaults to `50` | | `cursor` | The `next_cursor` from the previous response | ## Fetching transcripts Transcripts are not in the cross-agent list. Fetch them one call at a time. ```bash curl theme={null} curl "https://api.formbharo.artpark.ai/api/v1/agents/AGENT_ID/conversations/CONVERSATION_ID/transcript" \ -H "Authorization: Bearer " ``` A call with no recorded speech returns `404` with `{ "error": "Transcript not found" }`. Treat it as an empty transcript, not a failure. # Analyze the calls Source: https://docs.formbharo.artpark.ai/guides/read-the-analytics Fetch completion rates, average call duration, voice latency, and per-call cost breakdowns for a single agent or an entire workspace. ## Agent analytics `GET /api/v1/agents/{agent_id}/analytics` returns stats for one agent. ```bash curl theme={null} curl -G "https://api.formbharo.artpark.ai/api/v1/agents/AGENT_ID/analytics" \ -H "Authorization: Bearer " \ --data-urlencode "since=1700000000" \ --data-urlencode "until=1700086400" \ --data-urlencode "status=complete" \ --data-urlencode "source=web" ``` | Query parameter | Description | | - | - | | `status` | `in_progress`, `complete`, `screened_out`, or `failed` | | `source` | The source that started the call | | `since` | Unix timestamp: `created_at >= since` | | `until` | Unix timestamp: `created_at <= until` | ## Workspace analytics `GET /api/v1/workspaces/{workspace_id}/analytics` returns the same stats across all agents in a workspace, plus a per-agent breakdown. Workspace admins only. ```bash curl theme={null} curl -G "https://api.formbharo.artpark.ai/api/v1/workspaces/WORKSPACE_ID/analytics" \ -H "Authorization: Bearer " \ --data-urlencode "since=1700000000" ``` ## Reading the numbers | Stat | Meaning | | - | - | | `attempted` | Calls started, in any status | | `completed` | Calls that reached a defined ending, including screened out ones | | `screened_out` | Calls ended early because an answer matched `end_call_values` | | `completion_rate` | `completed / attempted`, between `0` and `1`. `0` when `attempted` is zero | To count calls that answered every question, subtract `screened_out` from `completed`. The response also carries average call duration, voice latency, and cost per call and per turn. See the [API reference](/api-reference/introduction) for those fields. Every average is `null` when the window has no usable calls. # Run a call Source: https://docs.formbharo.artpark.ai/guides/run-a-call Embed a voice call in your own page with WebRTC and read answers as they arrive. No API key is needed to run a call. `POST /api/v1/conversations` gives you a conversation id and a token; the token authorizes the audio connection and the answer poll for that one conversation. ## Before you start You need the **agent ID** of a published agent. `GET /api/v1/agents/{agent_id}/public` returns the agent's `title`, `questions` list, and `agent_speaks_first` flag. Use it to render your form UI before the call starts. ```bash curl theme={null} curl https://api.formbharo.artpark.ai/api/v1/agents/AGENT_ID/public ``` `agent_speaks_first` tells you whether to show a "waiting for agent" state or a push-to-talk prompt on connect. ## Run the call **1. Create the conversation** The server generates the conversation id and returns the token with it. ```javascript javascript theme={null} const res = await fetch("https://api.formbharo.artpark.ai/api/v1/conversations", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ agent_id: "AGENT_ID" }), }); const { conversation_id, token } = await res.json(); ``` The token expires after 12 hours and works only for this conversation. **2. Open the audio connection** `POST /offer` starts the WebRTC handshake. This path sits at the bare root of the server, not under `/api/v1`. Send a JSON body with these fields: | Field | Value | | - | - | | `sdp` | Your browser's WebRTC SDP offer string | | `type` | Always `"offer"` | | `request_data` | Object with `agentId`, `conversation_id`, and `conversation_token` | The response is a WebRTC SDP answer. To exchange ICE candidates after the initial handshake, send them with `PATCH /offer`. ```javascript javascript theme={null} const pc = new RTCPeerConnection(); pc.addTransceiver("audio", { direction: "sendrecv" }); await pc.setLocalDescription(await pc.createOffer()); // Wait for ICE gathering to complete await new Promise((resolve) => { if (pc.iceGatheringState === "complete") { resolve(); } else { pc.addEventListener("icegatheringstatechange", () => { if (pc.iceGatheringState === "complete") resolve(); }); } }); const offerResponse = await fetch("https://api.formbharo.artpark.ai/offer", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ sdp: pc.localDescription.sdp, type: "offer", request_data: { agentId: "AGENT_ID", conversation_id, conversation_token: token, }, }), }); const answer = await offerResponse.json(); await pc.setRemoteDescription(new RTCSessionDescription(answer)); // Play incoming audio pc.addEventListener("track", (event) => { const audio = new Audio(); audio.srcObject = event.streams[0]; audio.play(); }); ``` **3. Read answers as they arrive** Poll `GET /api/v1/data/{agent_id}/{conversation_id}` every two seconds or so, sending the token as `X-Conversation-Token`. The response has `form_data` (answers keyed by question `name`) and `form_status` (per-question: `empty`, `skipped`, or `answered`). When the call ends, `ended_at` appears. ```javascript javascript theme={null} function pollAnswers(agentId, conversationId, token) { const url = `https://api.formbharo.artpark.ai/api/v1/data/${agentId}/${conversationId}`; const interval = setInterval(async () => { const res = await fetch(url, { headers: { "X-Conversation-Token": token }, }); const data = await res.json(); console.log("Current answers:", data.form_data); if (data.ended_at) { clearInterval(interval); } }, 2000); } ``` ## Next steps > [card] [Poll for calls](/guides/poll-for-finished-calls) > > Read `form_data` and `form_status` after a call ends > [card] [Agent config schema](/reference/agent-config-schema) > > See the full shape of an agent's JSON config # Agent config schema Source: https://docs.formbharo.artpark.ai/reference/agent-config-schema The full config for a voice form: questions, validation, retries, and branches. The complete shape of a form. `PUT` it to `/api/v1/agents/{agent_id}/config` to replace an agent's whole configuration in one call. > [!NOTE] > > `POST`/`PUT /api/v1/agents`, used in [Build an agent](/guides/build-an-agent), takes a slightly different shape: `description`, `ai_instructions`, `question`, and `response_type` in place of `context`, `instructions`, `label`, and `type` below. ## Schema ```json theme={null} { "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "Form agent config (JSON view)", "type": "object", "required": ["title", "questions"], "properties": { "title": { "type": "string", "minLength": 1, "description": "Form name." }, "status": { "type": "string", "enum": ["draft", "published"], "description": "Send \"published\" so the form is live." }, "context": { "type": "string", "description": "What this form is for." }, "instructions": { "type": "string", "description": "Standing instructions: tone, skip rules, closing." }, "agent_persona": { "type": "string", "description": "Who the agent is, e.g. 'community health worker'." }, "user_persona": { "type": "string", "description": "Who the caller is, e.g. 'caregiver answering about the patient'." }, "language": { "type": "string", "enum": ["english", "hindi", "hinglish", "telugu", "marathi", "kannada"] }, "agent_speaks_first": { "type": "boolean", "default": true }, "ask_questions_one_by_one": { "type": "boolean", "default": true, "description": "true = one question at a time. false = the person can answer many fields at once." }, "mute_user_while_agent_speaking": { "type": "boolean", "default": false }, "scripts": { "type": "object", "properties": { "intro": { "type": "string", "description": "Opening line." }, "outro": { "type": "string", "description": "Closing line when the form is complete. Required if outro_incomplete is set." }, "outro_incomplete": { "type": "string", "description": "Closing line when the call ends early." } } }, "questions": { "type": "array", "items": { "$ref": "#/$defs/question" } }, "branches": { "type": "array", "items": { "$ref": "#/$defs/branch" } } }, "$defs": { "question": { "type": "object", "required": ["name", "label", "type"], "properties": { "name": { "type": "string", "minLength": 1, "description": "Stable snake_case key. Required. Branch conditions point at this." }, "label": { "type": "string", "minLength": 1, "description": "Field name shown in the answers table." }, "type": { "type": "string", "enum": ["string", "number", "date", "boolean", "single-select", "multi-select"] }, "number_format": { "type": "string", "enum": ["integer", "decimal"], "description": "Number fields only." }, "options": { "type": "array", "items": { "type": "string" }, "minItems": 1, "description": "Needed for single-select and multi-select." }, "boolean_labels": { "type": "object", "properties": { "true": { "type": "string" }, "false": { "type": "string" } }, "description": "Custom yes/no wording. Set both, or leave the whole thing out." }, "required": { "type": "boolean", "default": true }, "script": { "type": "string", "description": "Exact words used to ask this field." }, "skip_message": { "type": "string", "description": "Said when an optional field is skipped. Only when required is false." }, "advanced_instructions": { "type": "string", "description": "Extra instructions for this field only." }, "end_call_values": { "type": "array", "items": { "type": "string" }, "description": "If the answer matches one of these, the call ends early and outro_incomplete is spoken. For boolean fields use the label, or yes/no. For date fields write the date as DD-MM-YYYY." }, "branch_id": { "type": "string", "description": "Ask this question only when that branch's condition is true." }, "validation": { "type": "object", "required": ["type"], "properties": { "type": { "type": "string", "enum": ["phone_number", "exact_num_digits", "number_range", "min_length", "regex", "free_text", "date", "date_format", "date_today_or_past", "date_future"] }, "rules": { "type": "object" } } }, "retry_config": { "type": "object", "properties": { "allow_retries": { "type": "boolean", "default": true }, "until_answered": { "type": "boolean", "default": false, "description": "Keep asking forever. Ignores max_retries." }, "max_retries": { "type": "integer", "minimum": 0, "default": 2, "description": "Re-asks allowed after the first ask." }, "retry_messages": { "type": "array", "items": { "type": "string" }, "description": "Words for retry 1, retry 2, and so on. Empty means repeat the script." }, "exhausted_action": { "type": "string", "enum": ["skip", "end_call"], "default": "skip", "description": "What happens after the retries run out, for optional questions only. Required questions always end the call." } } } } }, "branch": { "type": "object", "required": ["id", "condition"], "properties": { "id": { "type": "string", "minLength": 1, "description": "Unique. Questions point here with branch_id." }, "condition": { "type": "object", "required": ["field"], "description": "Set exactly one of equals or present.", "properties": { "field": { "type": "string", "minLength": 1, "description": "The name of the controlling question. It must sit above the branch's questions." }, "equals": { "type": "boolean", "description": "Boolean controllers only. true = ask when yes, false = ask when no." }, "present": { "type": "boolean", "description": "Any controller type. true = ask when it was answered, false = ask when it was skipped." } } } } } } } ``` ## Validation: what to put in each one Leave `validation` out entirely to switch it off. | type | Use on | Send | | - | - | - | | `phone_number` | number | `{ "type": "phone_number", "rules": { "digits": 10 } }` | | `exact_num_digits` | string, number | `{ "type": "exact_num_digits", "rules": { "digits": 4 } }` | | `number_range` | number | `{ "type": "number_range", "rules": { "min": 0, "max": 120 } }` (min, max, or both) | | `min_length` | string, number | `{ "type": "min_length", "rules": { "min_length": 2 } }` | | `regex` | string | `{ "type": "regex", "rules": { "pattern": "^[A-Z]{2}[0-9]{4}$", "message": "Must look like AB1234" } }` | | `free_text` | any | `{ "type": "free_text", "rules": { "description": "Must be a real village name" } }` | | `date` | date | `{ "type": "date", "rules": {} }` | | `date_format` | date | `{ "type": "date_format", "rules": {} }` | | `date_today_or_past` | date | `{ "type": "date_today_or_past", "rules": {} }` | | `date_future` | date | `{ "type": "date_future", "rules": {} }` | `free_text` is not enforced. Its `rules.description` is guidance for the agent, not a check on the answer. ## Branch rules * Each `id` must be unique. * Set exactly one of `equals` or `present`, never both, never neither. * `equals` works only when the controlling question is a boolean. * The controlling question must appear above every question that carries that `branch_id`. * Every `branch_id` on a question must match a branch that exists. ## Example ```json theme={null} { "title": "Fever follow-up", "status": "published", "language": "hindi", "agent_persona": "community health worker", "user_persona": "caregiver answering about the patient", "context": "Short fever history. Ask about the patient in third person.", "instructions": "Speak slowly. Do not repeat the answer back.", "agent_speaks_first": true, "ask_questions_one_by_one": true, "mute_user_while_agent_speaking": false, "scripts": { "intro": "Namaste. Main bukhar ke kuch sawaal poochungi.", "outro": "Dhanyavaad. Saare sawaal ho gaye.", "outro_incomplete": "Theek hai, abhi ke liye itna hi. Dhanyavaad." }, "questions": [ { "name": "has_fever", "label": "Does the patient have fever?", "type": "boolean", "required": true, "script": "Kya mariz ko bukhar hai?", "boolean_labels": { "true": "Haan", "false": "Nahi" }, "end_call_values": ["Nahi"] }, { "name": "date_of_birth", "label": "Patient date of birth", "type": "date", "required": true, "script": "Mariz ki janam tithi kya hai?", "validation": { "type": "date_today_or_past", "rules": {} } }, { "name": "fever_days", "label": "How many days of fever?", "type": "number", "number_format": "integer", "required": true, "branch_id": "if_fever", "script": "Kitne din se bukhar hai?", "validation": { "type": "number_range", "rules": { "min": 1, "max": 90 } }, "retry_config": { "allow_retries": true, "until_answered": false, "max_retries": 2, "retry_messages": ["Maaf kijiye, kitne din se bukhar hai?"], "exhausted_action": "end_call" } }, { "name": "symptoms", "label": "Other symptoms", "type": "multi-select", "options": ["Khaansi", "Sar dard", "Ulti", "Kuch nahi"], "required": false, "branch_id": "if_fever", "script": "Bukhar ke saath aur kya takleef hai?", "skip_message": "Theek hai, aage badhte hain." }, { "name": "phone", "label": "Contact phone number", "type": "number", "required": true, "script": "Aapka phone number kya hai?", "validation": { "type": "phone_number", "rules": { "digits": 10 } } } ], "branches": [ { "id": "if_fever", "condition": { "field": "has_fever", "equals": true } } ] } ``` # ARMMAN Source: https://docs.formbharo.artpark.ai/use-cases/armman How ARMMAN enrolls pregnant mothers in its health programmes over a phone call. ARMMAN runs maternal and child health programmes across India. Pregnant mothers call FormBharo to fill in the form that enrolls them in those programmes, without waiting for a health worker or visiting the health centre. Our paper describes this pilot and how the agent was evaluated.