Skip to main content
PATCH
/
calls
/
{agentId}
/
{callIdOrPhone}
Set post call outcome
curl --request PATCH \
  --url https://app.phonely.ai/api/calls/{agentId}/{callIdOrPhone} \
  --header 'Content-Type: application/json' \
  --header 'X-Authorization: <api-key>' \
  --data '
{
  "custom_call_outcome": "<string>",
  "custom_call_outcome_value": 123,
  "custom_call_metadata": {}
}
'
{
  "success": true,
  "call_id": "<string>",
  "agent_id": "<string>",
  "phone": "<string>",
  "preference": "<string>",
  "updated_fields": [
    "<string>"
  ]
}

Overview

This API allows you to set post call outcome fields for calls by either:
  1. Call ID: PATCH /api/calls/{agent_id}/{call_id}
  2. Phone Number: PATCH /api/calls/{agent_id}/{e164_number}?preference=first|last

Authentication

  • API Key: X-Authorization header (for batch jobs)

Example 1: Update by Call ID

Using API Key

curl -X PATCH "https://app.phonely.ai/api/calls/agent123/call456" \
  -H "X-Authorization: your-api-key-here" \
  -H "Content-Type: application/json" \
  -d '{
    "custom_call_outcome": "Sold",
    "custom_call_outcome_value": 299,
    "custom_call_metadata": {
      "campaign": "spring_2026",
      "rep_id": "12345",
      "notes": "Customer was very interested"
    }
  }'

Example 2: Update by Phone Number (Last Touch - Default)

curl -X PATCH "https://app.phonely.ai/api/calls/agent123/+14155551234" \
  -H "X-Authorization: your-api-key-here" \
  -H "Content-Type: application/json" \
  -d '{
    "custom_call_outcome": "No Sale",
    "custom_call_outcome_value": 0,
    "custom_call_metadata": {
      "reason": "Price too high",
      "follow_up": true
    }
  }'

Example 3: Update by Phone Number (First Touch)

curl -X PATCH "https://app.phonely.ai/api/calls/agent123/+14155551234?preference=first" \
  -H "X-Authorization: your-api-key-here" \
  -H "Content-Type: application/json" \
  -d '{
    "custom_call_outcome": "Sold",
    "custom_call_outcome_value": 499,
    "custom_call_metadata": {
      "attribution": "first_touch",
      "campaign": "spring_2026"
    }
  }'

Example 4: Partial Update (Only Outcome)

curl -X PATCH "https://app.phonely.ai/api/calls/agent123/call456" \
  -H "X-Authorization: your-api-key-here" \
  -H "Content-Type: application/json" \
  -d '{
    "custom_call_outcome": "Follow Up Required"
  }'

Notes

  1. Phone Number Format: Phone numbers must be in E.164 format (e.g., +14155551234). The + sign can be included directly in the URL path.
  2. Preference Parameter:
    • first: Updates the earliest call with the given phone number
    • last: Updates the most recent call (default)
  3. Partial Updates: You can provide any combination of the three fields:
    • custom_call_outcome (string)
    • custom_call_outcome_value (number)
    • custom_call_metadata (object)

Authorizations

X-Authorization
string
header
required

Path Parameters

agentId
string
required

The ID of the agent

callIdOrPhone
string
required

The ID of the call or the E.164 phone number

Query Parameters

preference
enum<string>
default:last

first: first time that someone called in, last: latest call from someone

Available options:
first,
last

Body

application/json
custom_call_outcome
string

The outcome label (e.g., Sold, No Sale)

custom_call_outcome_value
number

The monetary value associated with the outcome

custom_call_metadata
object

Additional custom metadata for the call

Response

Call outcome updated successfully

success
boolean
call_id
string
agent_id
string
phone
string
preference
string
updated_fields
string[]