Browse the docs

Get started

Quickstart

Place your first outbound call from your code. You need a CallShift account with an agent and a phone number allowed to call out. The fastest path is to build the agent in the dashboard, then drive it from the API.
  1. Create an API key

    Create a key at app.callshift.ai/api-keys and keep it in an environment variable. Check that it works by listing your agents:

    Terminal
    export CALLSHIFT_API_KEY="your-api-key"
    
    curl "https://api.callshift.ai/v1/agents?limit=5" \
      -H "Authorization: Bearer $CALLSHIFT_API_KEY"
  2. Pick an agent

    Note the id of the agent that will place the call. To try a change without touching an agent in production, duplicate it first with POST/v1/agents/{agentId}/duplicate and work on the copy.

    JSON
    {
      "data": [
        { "id": "550e8400-e29b-41d4-a716-446655440000", "name": "Alice", "gender": "FEMALE", "language": "en", "entityId": null }
      ],
      "pageCount": 1
    }
  3. Pick a phone number

    GET/v1/phones lists every number of the account. Take one whose isOutboundAllowed is true: its id is the phoneId of the campaign.

  4. Create a campaign

    A campaign is created inactive, so nothing is dialed yet.

    curl -X POST "https://api.callshift.ai/v1/campaigns" \
      -H "Authorization: Bearer $CALLSHIFT_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "name": "API quickstart",
        "agentId": "550e8400-e29b-41d4-a716-446655440000",
        "phoneId": "0d3a7e6b-2b8e-4c5b-9c4e-5f4b9d2a1c8e"
      }'
    const res = await fetch("https://api.callshift.ai/v1/campaigns", {
      method: "POST",
      headers: {
        Authorization: `Bearer ${process.env.CALLSHIFT_API_KEY}`,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        name: "API quickstart",
        agentId: "550e8400-e29b-41d4-a716-446655440000",
        phoneId: "0d3a7e6b-2b8e-4c5b-9c4e-5f4b9d2a1c8e",
      }),
    });
    const { id: campaignId } = await res.json();
    import os
    import requests
    
    res = requests.post(
        "https://api.callshift.ai/v1/campaigns",
        headers={"Authorization": f"Bearer {os.environ['CALLSHIFT_API_KEY']}"},
        json={
            "name": "API quickstart",
            "agentId": "550e8400-e29b-41d4-a716-446655440000",
            "phoneId": "0d3a7e6b-2b8e-4c5b-9c4e-5f4b9d2a1c8e",
        },
    )
    campaign_id = res.json()["id"]
  5. Add yourself and start the campaign

    Add one contact, your own mobile in E.164 format, then activate the campaign. An active campaign dials new contacts as soon as they arrive.

    Terminal
    curl -X POST "https://api.callshift.ai/v1/campaigns/$CAMPAIGN_ID/contacts" \
      -H "Authorization: Bearer $CALLSHIFT_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{ "contacts": [ { "firstName": "Ada", "phoneNumber": "+33612345678" } ] }'
    
    curl -X PATCH "https://api.callshift.ai/v1/campaigns/$CAMPAIGN_ID" \
      -H "Authorization: Bearer $CALLSHIFT_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{ "isActive": true }'

    Your phone rings within seconds. Answer and talk to the agent.

  6. Read the call back

    Once you hang up, the call carries its outcome. The list gives the status, the ended reason and the summary; the detail adds the transcript and the recording.

    Terminal
    curl "https://api.callshift.ai/v1/calls?campaignId=$CAMPAIGN_ID" \
      -H "Authorization: Bearer $CALLSHIFT_API_KEY"
Tip

Before a real campaign, send a test batch of one or two internal numbers, and let the welcome message say that the caller is talking to an AI assistant.

Answer inbound calls instead

To have the agent answer a number, assign it with PATCH/v1/phones/{phoneId}, then call the number.

Terminal
curl -X PATCH "https://api.callshift.ai/v1/phones/$PHONE_ID" \
  -H "Authorization: Bearer $CALLSHIFT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "agentId": "550e8400-e29b-41d4-a716-446655440000" }'

Next steps