# Update a call

Update an active call resource. You can use this request to do additional actions:

* [You can use this request to hangup the call by setting status to `completed`](#user-content-fn-1)[^1]
* It can also be used to update the `callFlow` of the call. Commands of the new `callFlow` will be executed after the Patch.

### CallFlowCommand

Check bellow the available commands when initiating an outbound call. In order to assess the options of each command, you may explore each command section.

```
type: string
enum:
  - answer
  - hangup
  - playback
  - say
  - gather
  - record
  - bridge
  - pause
  - ringing
```

## Update call

> Update a call

```json
{"openapi":"3.0.3","info":{"title":"Channels","version":"v1"},"servers":[{"url":"https://api.bird.com","description":"Production API"}],"security":[{"accessKey":[]}],"components":{"securitySchemes":{"accessKey":{"description":"Uses the Authorization header: 'AccessKey ' followed by your access key token","scheme":"AccessKey","type":"http"}},"schemas":{"PatchCall":{"type":"object","title":"PatchCall","additionalProperties":false,"properties":{"status":{"type":"string","nullable":true,"enum":["completed"]},"callFlow":{"type":"array","items":{"$ref":"#/components/schemas/CallFlowCommand"},"maxItems":20}}},"CallFlowCommand":{"type":"object","title":"CallFlowCommand","additionalProperties":false,"properties":{"command":{"$ref":"#/components/schemas/CallFlowCommandEnum"},"options":{"type":"object","nullable":true,"oneOf":[{"if":{"properties":{"command":{"const":"answer"}}},"$ref":"#/components/schemas/Answer"},{"if":{"properties":{"command":{"const":"ringing"}}},"$ref":"#/components/schemas/Ringing"},{"if":{"properties":{"command":{"const":"playback"}}},"$ref":"#/components/schemas/Play"},{"if":null,"properties":{"command":{"const":"say"}},"$ref":"#/components/schemas/Say"},{"if":null,"properties":{"command":{"const":"gather"}},"$ref":"#/components/schemas/Gather"},{"if":null,"properties":{"command":{"const":"record"}},"$ref":"#/components/schemas/Record"},{"if":null,"properties":{"command":{"const":"hangup"}},"$ref":"#/components/schemas/Hangup"},{"if":null,"properties":{"command":{"const":"pause"}},"$ref":"#/components/schemas/Pause"},{"if":null,"properties":{"command":{"const":"bridge"}},"$ref":"#/components/schemas/BridgeCall"}]},"conditions":{"nullable":true,"type":"array","items":{"$ref":"#/components/schemas/CallFlowCommandCondition"}}}},"CallFlowCommandEnum":{"type":"string","enum":["answer","hangup","playback","say","gather","record","bridge","pause","ringing"]},"Answer":{"type":"object","title":"AnswerCalls","additionalProperties":false},"Ringing":{"type":"object","title":"RingingCalls","additionalProperties":false},"Play":{"type":"object","title":"Playback sound to Call","additionalProperties":false,"properties":{"media":{"type":"array","items":{"type":"string"},"maxItems":80,"nullable":true},"loop":{"type":"integer"},"timeout":{"type":"integer"},"pauseMilliseconds":{"type":"integer","minimum":0,"maximum":30000}},"required":["media"]},"Say":{"type":"object","title":"Say text to Call","additionalProperties":false,"properties":{"text":{"type":"string"},"locale":{"$ref":"#/components/schemas/standard.locale.tts-polly"},"voice":{"type":"string"},"loop":{"type":"integer"},"timeout":{"type":"integer"}},"required":["text"]},"standard.locale.tts-polly":{"description":"Curated set of BCP47 locale identifiers supported by AWS Polly text-to-speech in Bird voice products","enum":["arb","ar-AE","bg-BG","bn-IN","ca-ES","cs-CZ","cy-GB","cmn-CN","da-DK","de-CH","de-DE","de-AT","el-GR","en-AU","en-GB","en-IN","en-NZ","en-ZA","en-US","en-GB-WLS","es-ES","es-MX","es-US","eu-ES","fi-FI","fil-PH","fr-FR","fr-BE","fr-CA","gl-ES","gu-IN","he-IL","hi-IN","hu-HU","id-ID","is-IS","it-IT","ja-JP","ko-KR","lt-LT","lv-LV","ms-MY","nl-BE","nl-NL","nb-NO","pa-IN","pl-PL","pt-BR","pt-PT","ro-RO","ru-RU","sk-SK","sr-RS","sv-SE","ta-IN","te-IN","tr-TR","th-TH","uk-UA","vi-VN","yue-CN"],"type":"string"},"Gather":{"type":"object","title":"Gather dtmfs from call","additionalProperties":false,"properties":{"maxNumKeys":{"type":"integer"},"endKey":{"$ref":"#/components/schemas/Key"},"timeout":{"type":"integer"},"retries":{"type":"integer"},"input":{"type":"string","enum":["dtmf","speech","dtmf speech"]},"speechLocale":{"type":"string","format":"locale-bcp47","default":"en-US","enum":["de-DE","en-AU","en-GB","en-US","es-US","it-IT","ja-JP","ko-KR","pt-BR","th-TH","zh-CN"]},"playback":{"$ref":"#/components/schemas/Play"},"say":{"$ref":"#/components/schemas/Say"}}},"Key":{"type":"string","enum":["0","1","2","3","4","5","6","7","8","9","*","#"]},"Record":{"type":"object","title":"Record one Call","additionalProperties":false,"properties":{"endKey":{"$ref":"#/components/schemas/Key"},"maxLength":{"type":"integer"},"timeout":{"type":"integer"},"beep":{"type":"boolean"},"transcribe":{"type":"boolean"},"transcribeLocale":{"type":"string","format":"locale-bcp47","default":"en-US","enum":["ar-AE","ar-SA","zh-CN","zh-TW","da-DK","nl-NL","en-AU","en-GB","en-IN","en-IE","en-NZ","en-AB","en-ZA","en-US","en-WL","fr-FR","fr-CA","fa-IR","de-DE","de-CH","he-IL","hi-IN","id-ID","it-IT","ja-JP","ko-KR","ms-MY","pt-PT","pt-BR","ru-RU","es-ES","es-US","sv-SE","ta-IN","te-IN","th-TH","tr-TR","vi-VN"]}}},"Hangup":{"type":"object","title":"HangupCalls","additionalProperties":false,"properties":{"cause":{"type":"string","enum":["rejected","busy"]}}},"Pause":{"type":"object","title":"PauseCall","additionalProperties":false,"properties":{"pauseSeconds":{"type":"integer","minimum":0,"maximum":30}}},"BridgeCall":{"type":"object","title":"Bridge new call with existing call","additionalProperties":false,"properties":{"from":{"type":"string"},"to":{"type":"string"},"ringTimeout":{"type":"integer","minimum":3,"maximum":120,"default":30},"maxDuration":{"type":"integer","minimum":1,"default":28800},"ringTone":{"$ref":"#/components/schemas/RingTone"},"hangupAfterBridge":{"type":"boolean"},"record":{"type":"boolean"},"recordStart":{"type":"string","enum":["record-from-answer","record-from-ringing"]},"recordStereo":{"type":"boolean"},"callFlow":{"type":"array","items":{"$ref":"#/components/schemas/CallFlowCommandBridgeCall"},"maxItems":20},"notification":{"$ref":"#/components/schemas/CallNotification"},"amdSettings":{"$ref":"#/components/schemas/AmdSettings"}},"required":["to"]},"RingTone":{"type":"string","nullable":true,"enum":["be","ca","cn","cy","cz","de","dk","dz","eg","fi","fr","hk","hu","il","in","jp","ko","pk","pl","ro","rs","ru","sa","tr","uk","us"]},"CallFlowCommandBridgeCall":{"type":"object","title":"CallFlowCommand","additionalProperties":false,"properties":{"command":{"$ref":"#/components/schemas/CallFlowCommandEnumBridgeCall"},"conditions":{"nullable":true,"type":"array","items":{"$ref":"#/components/schemas/CallFlowCommandCondition"}},"options":{"type":"object","nullable":true,"oneOf":[{"if":{"properties":{"command":{"const":"playback"}}},"$ref":"#/components/schemas/Play"},{"if":null,"properties":{"command":{"const":"say"}},"$ref":"#/components/schemas/Say"},{"if":null,"properties":{"command":{"const":"gather"}},"$ref":"#/components/schemas/Gather"},{"if":null,"properties":{"command":{"const":"hangup"}},"$ref":"#/components/schemas/Hangup"},{"if":null,"properties":{"command":{"const":"pause"}},"$ref":"#/components/schemas/Pause"}]}}},"CallFlowCommandEnumBridgeCall":{"type":"string","enum":["hangup","playback","say","gather","pause"]},"CallFlowCommandCondition":{"type":"object","title":"Conditions for command","additionalProperties":false,"properties":{"variable":{"type":"string","enum":["keys","speech"]},"operator":{"type":"string","enum":["eq","ne","==","!=","contains"]},"value":{"type":"string"}}},"CallNotification":{"type":"object","title":"CallNotification","additionalProperties":false,"properties":{"url":{"type":"string"}}},"AmdSettings":{"type":"object","title":"AmdSettings","additionalProperties":false,"properties":{"enabled":{"type":"boolean","default":false},"wordCount":{"type":"number","default":5},"speechTimeout":{"type":"number","default":3,"maximum":10},"speechLocale":{"type":"string","format":"locale-bcp47","default":"en-US","enum":["de-DE","en-AU","en-GB","en-US","es-US","it-IT","ja-JP","ko-KR","pt-BR","th-TH","zh-CN"]},"beepTimeout":{"type":"number","default":30},"ifMachineNotifyAfter":{"type":"string","enum":["beep","wordCount"],"default":"wordCount"}},"required":["enabled","wordCount","speechTimeout","speechLocale","ifMachineNotifyAfter"]},"Call":{"type":"object","title":"ChannelCall","additionalProperties":false,"properties":{"id":{"type":"string","format":"uuid"},"channelId":{"type":"string","format":"uuid"},"from":{"type":"string"},"to":{"type":"string"},"originator":{"$ref":"#/components/schemas/CallIdentifier"},"receiver":{"$ref":"#/components/schemas/CallIdentifier"},"parentId":{"type":"string","format":"uuid"},"direction":{"$ref":"#/components/schemas/Direction"},"status":{"$ref":"#/components/schemas/channels.call_status"},"reason":{"type":"string"},"type":{"$ref":"#/components/schemas/CallType"},"duration":{"type":"integer"},"hangupCauseCode":{"type":"integer"},"hangupSource":{"$ref":"#/components/schemas/HangupSource"},"hangupSipCode":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"ringingAt":{"type":"string","format":"date-time"},"answeredAt":{"type":"string","format":"date-time"},"endedAt":{"type":"string","format":"date-time"},"scheduledFor":{"type":"string","format":"date-time"},"callFlow":{"$ref":"#/components/schemas/CallFlow"},"notification":{"$ref":"#/components/schemas/CallNotification"},"qualityInsights":{"$ref":"#/components/schemas/CallQualityInsights"},"sipInsights":{"$ref":"#/components/schemas/CallSipInsights"},"amdResult":{"$ref":"#/components/schemas/AmdResult"},"sipType":{"$ref":"#/components/schemas/SIPType"},"tags":{"$ref":"#/components/schemas/CallTags"}},"required":["id","channelId","from","to","originator","receiver","status","type","direction","createdAt","updatedAt"]},"CallIdentifier":{"type":"object","title":"ChannelCallOriginatorOrReceiver","additionalProperties":false,"properties":{"contact":{"$ref":"#/components/schemas/CallContact"},"number":{"$ref":"#/components/schemas/Number"}},"required":["number"]},"CallContact":{"type":"object","title":"CallContact","additionalProperties":false,"properties":{"id":{"type":"string"},"identifierKey":{"type":"string"},"identifierValue":{"type":"string"}},"required":["id","identifierKey","identifierValue"]},"Number":{"type":"object","title":"number","additionalProperties":false,"properties":{"type":{"$ref":"#/components/schemas/CallType"},"number":{"type":"string"},"anonymous":{"type":"boolean"},"callerIdName":{"type":"string"},"identity":{"type":"string"},"countryIsoCode":{"type":"string"},"pstnNumberType":{"type":"string"}},"required":["type","number"]},"CallType":{"type":"string","enum":["pstn","sip","webrtc"]},"Direction":{"type":"string","enum":["incoming","outgoing"]},"channels.call_status":{"enum":["accepted","starting","ringing","ongoing","completed","busy","no-answer","failed","cancelled","scheduled"],"type":"string"},"HangupSource":{"type":"string","nullable":true,"enum":["callee","caller","api","timeout","media-timeout","none"]},"CallFlow":{"type":"object","title":"CallFlow","additionalProperties":false,"nullable":true,"properties":{"id":{"type":"string","format":"uuid"},"commands":{"type":"array","items":{"$ref":"#/components/schemas/CallCommandResponse"}}}},"CallCommandResponse":{"type":"object","title":"CallCommandResponse","additionalProperties":false,"properties":{"id":{"type":"string","format":"uuid"},"callId":{"type":"string","format":"uuid"},"callFlowId":{"nullable":true,"type":"string","format":"uuid"},"status":{"type":"string"},"command":{"type":"string"},"conditions":{"type":"array","items":{"$ref":"#/components/schemas/CallFlowCommandCondition"}}}},"CallQualityInsights":{"type":"object","title":"qualityInsights","additionalProperties":false,"properties":{"mos":{"type":"string"},"pdd":{"type":"string"}}},"CallSipInsights":{"type":"object","title":"signallingInsights","additionalProperties":false,"properties":{"hangupSipCode":{"type":"string"},"edgeRegion":{"type":"string"},"providerName":{"type":"string"},"userAgent":{"type":"string"},"remoteSignallingIp":{"type":"string"},"remoteMediaIp":{"type":"string"}}},"AmdResult":{"type":"object","title":"AmdResult","additionalProperties":false,"properties":{"result":{"type":"string","enum":["human","machine","noSpeech","beep","unknown"]},"speech":{"type":"string"},"locale":{"type":"string"}}},"SIPType":{"type":"string","enum":["elastic","byoc","forward"]},"CallTags":{"type":"array","description":"Tags to associate with the call. Tags are converted to lower case and tags\nthat do not exist are automatically created. You can view your created tags\nin the UI. You can specify up to 10 tags per call.\n","maxItems":10,"items":{"$ref":"#/components/schemas/TagName"}},"TagName":{"type":"string","title":"TagName","pattern":"^[a-zA-Z0-9-_ ]+$","minLength":1,"maxLength":50,"description":"Tag name. Must be between 1 and 50 characters and must only contain\nalphanumeric characters, hyphens, underscores, and spaces."},"error.detailed":{"additionalProperties":false,"description":"An error returned from the API that includes additional details about the error. The `details` property can contain any additional information about the error that may be helpful for debugging or understanding the error.\n","properties":{"code":{"description":"A unique code that identifies the error. This code can be used to programmatically identify the error.","minLength":3,"type":"string"},"details":{"additionalProperties":true,"description":"Any additional information about the error that may be helpful for debugging or understanding the error.","type":"object"},"message":{"description":"A human-readable message that describes the error.","minLength":1,"type":"string"}},"required":["code","message"],"title":"DetailedError","type":"object"}},"responses":{"requestError":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error.detailed"}}},"description":"An error"}}},"paths":{"/workspaces/{workspaceId}/channels/{channelId}/calls/{callId}":{"patch":{"summary":"Update call","operationId":"patchCall","description":"Update a call","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatchCall"}}}},"responses":{"202":{"description":"Call update accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Call"}}}},"400":{"$ref":"#/components/responses/requestError"},"404":{"$ref":"#/components/responses/requestError"},"422":{"$ref":"#/components/responses/requestError"}}}}}}
```

### Example 1: Update a call by answering

{% tabs %}
{% tab title="Request Headers" %}

```
curl -X PATCH "https://api.bird.com/workspaces/{workspaceId}/channels/{channelId}/calls/{channelId}" \
     -H "Authorization: AccessKey YOUR_SECRET_TOKEN"
```

{% endtab %}

{% tab title="Request Body" %}

```
{​
  "status": "completed",​
  "callFlow": [​
    {​
      "command": "answer",​
      "options": {​
        "media": [​
          "string"​
        ],​
        "loop": 0,​
        "timeout": 0​
      }​
    }​
  ]​
​}
```

{% endtab %}

{% tab title="Response" %}

```
{​
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",​
  "channelId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",​
  "from": "string",​
  "to": "string",​
  "originator": {​
    "contact": {​
      "id": "string",​
      "identifierKey": "string",​
      "identifierValue": "string"​
    },​
    "number": {​
      "type": "pstn",​
      "number": "string",​
      "anonymous": true,​
      "callerIdName": "string",​
      "identity": "string",​
      "countryIsoCode": "string",​
      "pstnNumberType": "string"​
    }​
  },​
  "direction": "incoming",​
  "status": "accepted",​
  "reason": "string",​
  "type": "pstn",​
  "duration": 0,​
  "hangupCauseCode": 0,​
  "hangupSource": "callee",​
  "hangupSipCode": "string",​
  "createdAt": "2023-10-25T14:36:18.575Z",​
  "updatedAt": "2023-10-25T14:36:18.575Z",​
  "ringingAt": "2023-10-25T14:36:18.575Z",​
  "answeredAt": "2023-10-25T14:36:18.575Z",​
  "endedAt": "2023-10-25T14:36:18.575Z",​
  "callFlow": {​
    "commands": [​
      {​
        "callFlowId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",​
        "status": "string",​
        "command": "string"​
      }​
    ]​
  },​
  "qualityInsights": {​
    "mos": "string",​
    "pdd": "string"​
  },​
  "sipInsights": {​
    "hangupSipCode": "string",​
    "edgeRegion": "string",​
    "providerName": "string",​
    "userAgent": "string",​
    "remoteSignallingIp": "string",​
    "remoteMediaIp": "string"​
  }​
​}
```

{% endtab %}
{% endtabs %}

### Example 2: Update a call by sending ringing, pause for 2 seconds, answer and play an announcement

{% tabs %}
{% tab title="Request Headers" %}

```
curl -X PATCH "https://api.bird.com/workspaces/{workspaceId}/channels/{channelId}/calls/{channelId}" \
     -H "Authorization: AccessKey YOUR_SECRET_TOKEN"
```

{% endtab %}

{% tab title="Request Body" %}

<pre><code><strong>{
</strong>  "callFlow": [
    {
      "command": "ringing"
    },
    {
      "command": "pause",
      "options": {
        "pauseSeconds": 2
      }
    },
    {
      "command": "answer"
    },
    {
      "command": "say",
      "options": {
        "text": "Sorry, we don't have available agents now. Please call later. GoodBye.",
        "locale": "en-GB",
        "voice": "male"
      }
    },
    {
      "command": "hangup"
    }
  ]
}
</code></pre>

{% endtab %}

{% tab title="Response" %}

```
{
  "id": "a78dd93c-08fb-450b-8651-0def9cf77cf9",
  "channelId": "db53c357-92e3-4f3d-babe-159573940a50",
  "originator": {
    "contact": {
      "id": "1ea5d8c8-3f5e-4cc0-bb92-47b099d317c0",
      "identifierKey": "phonenumber",
      "identifierValue": "+351910648518"
    },
    "number": {
      "type": "pstn",
      "number": "+351910648518",
      "callerIdName": "Jose G",
      "countryIsoCode": "PT"
    }
  },
  "receiver": {
    "number": {
      "type": "pstn",
      "number": "+3197058016589",
      "countryIsoCode": "NL"
    }
  },
  "from": "+351910648518",
  "to": "+3197058016589",
  "direction": "incoming",
  "status": "starting",
  "type": "pstn",
  "duration": 0,
  "callFlow": {
    "id": "c4b84cee-66bb-4f1f-b43c-4b63be02ef84",
    "commands": [
      {
        "id": "2c27c266-856d-4ae2-abfe-19a3388bdfaf",
        "callId": "a78dd93c-08fb-450b-8651-0def9cf77cf9",
        "command": "ringing",
        "status": "accepted",
        "callFlowId": "c4b84cee-66bb-4f1f-b43c-4b63be02ef84"
      },
      {
        "id": "f39efa8f-5c8e-40f1-99a2-9b3eab040734",
        "callId": "a78dd93c-08fb-450b-8651-0def9cf77cf9",
        "command": "pause",
        "status": "accepted",
        "callFlowId": "c4b84cee-66bb-4f1f-b43c-4b63be02ef84"
      },
      {
        "id": "1d093dc0-3646-49d5-9125-939da797961a",
        "callId": "a78dd93c-08fb-450b-8651-0def9cf77cf9",
        "command": "answer",
        "status": "accepted",
        "callFlowId": "c4b84cee-66bb-4f1f-b43c-4b63be02ef84"
      },
      {
        "id": "57f960c6-455f-4884-b4de-fc017c0f1be3",
        "callId": "a78dd93c-08fb-450b-8651-0def9cf77cf9",
        "command": "say",
        "status": "accepted",
        "callFlowId": "c4b84cee-66bb-4f1f-b43c-4b63be02ef84"
      },
      {
        "id": "cf8a8557-f3ba-41a5-a21f-2543f7268380",
        "callId": "a78dd93c-08fb-450b-8651-0def9cf77cf9",
        "command": "hangup",
        "status": "accepted",
        "callFlowId": "c4b84cee-66bb-4f1f-b43c-4b63be02ef84"
      }
    ]
  },
  "createdAt": "2024-03-01T16:46:50.158Z",
  "updatedAt": "2024-03-01T16:46:50.45Z"
}
```

{% endtab %}
{% endtabs %}

[^1]:


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.bird.com/api/voice-api/voice-calls-api/update-a-call.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
