Phone Agent API

Request callbacks, pass per-call instructions, and retrieve actions requested by the agent. Use the same endpoints from a CRM, an automation platform, or a backend service.

Pair an account

Read the Firebase Web API key from the project configuration. Create a dedicated Firebase account from your integration backend. Pair the returned localId in Integrations in your client workspace.

curl -fsS "https://identitytoolkit.googleapis.com/v1/accounts:signUp?key=$FIREBASE_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"returnSecureToken":true}'

Store the refresh token in your integration’s secret store. Use a fresh ID token as the bearer token for every API request. Refresh it before its one-hour expiry.

curl -fsS "https://securetoken.googleapis.com/v1/token?key=$FIREBASE_API_KEY" \
  --data-urlencode "grant_type=refresh_token" \
  --data-urlencode "refresh_token=$FIREBASE_REFRESH_TOKEN"

Request a callback

Copy ENDPOINT from your workspace’s Integrations page. Generate a UUID for CALL_ID and reuse it when retrying the same request. The from number must have an active outbound agent for this workspace. The agentId is the last part of the agent’s dashboard link.

Send the consent wording the recipient agreed to and the time they agreed. Set instructions to a per-call briefing, such as which service the person asked about. Staging also checks the destination allowlist and opt-outs before dialing.

curl -fsS -X POST "$ENDPOINT?documentId=$CALL_ID" \
  -H "Authorization: Bearer $FIREBASE_ID_TOKEN" \
  -H 'Content-Type: application/json' \
  --data-binary @callback.json
{
  "fields": {
    "to": {"stringValue": "+34…"},
    "from": {"stringValue": "+34…"},
    "agentId": {"stringValue": "content-studio"},
    "consentText": {"stringValue": "<wording the recipient agreed to>"},
    "consentAt": {"timestampValue": "<UTC timestamp of consent>"},
    "instructions": {"stringValue": "Discuss the sponsored report the caller asked about."},
    "status": {"stringValue": "queued"}
  }
}

A successful request enters the queue. If a retry returns ALREADY_EXISTS, read that call’s status using the same ID. A request still queued after five minutes expires when the worker picks it up.

Get status and agent actions

curl -fsS "$ENDPOINT/$CALL_ID" \
  -H "Authorization: Bearer $FIREBASE_ID_TOKEN"

curl -fsS --get "$ENDPOINT/$CALL_ID/phoneAgentEvents" \
  --data-urlencode "orderBy=createdAt" \
  -H "Authorization: Bearer $FIREBASE_ID_TOKEN"

The status moves through queued, dispatching, dialing, in-progress, and completed. A rejected or failed status includes a reason code.

Agent actions have a type, instructions, and createdAt. Supported actions are human_handoff, send_information, and update_record. Poll while the call is active and once more after it ends. Deduplicate using the returned document name. Your integration decides how to handle each action.

Use Call history in the dashboard to review calls and their transcripts. Revoke a platform account from Integrations.