# Record a Call

Record a call. This command will record the call until one of the conditions apply:

* the `endKey` DTMF is detected.
* silence is detected for more than the duration defined in `timeout`.
* duration exceeds the `maxLength`.

This command doesn't record the whole call. This command is useful to record messages in a typical voicemail use case.

## Record call

> Record a channel call

```json
{"openapi":"3.0.3","info":{"title":"Channels","version":"v1"},"tags":[],"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 (e.g., 'Authorization: AccessKey AbCdEfGhIjKlMnOpQrStUvWxYzAbCdEfGhIj')","scheme":"AccessKey","type":"http"}},"schemas":{"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"]}}},"Key":{"type":"string","enum":["0","1","2","3","4","5","6","7","8","9","*","#"]},"CallCommandRecordResponse":{"type":"object","title":"ChannelCallCommandRecord","additionalProperties":false,"properties":{"command":{"$ref":"#/components/schemas/CallCommandResponse"},"recordingId":{"$ref":"#/components/schemas/Id-2"}}},"CallCommandResponse":{"type":"object","title":"CallCommandResponse","additionalProperties":false,"properties":{"id":{"$ref":"#/components/schemas/Id-2"},"callId":{"$ref":"#/components/schemas/Id-2"},"callFlowId":{"nullable":true,"$ref":"#/components/schemas/Id-2"},"status":{"type":"string"},"command":{"type":"string"},"conditions":{"type":"array","items":{"$ref":"#/components/schemas/CallFlowCommandCondition"}}}},"Id-2":{"type":"string","format":"uuid"},"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"}}},"RequestError":{"type":"object","properties":{"code":{"type":"string","description":"A unique code that identifies the error. This code can be used to programmatically identify the error.\n"},"message":{"type":"string","description":"A human-readable message that describes the error. An example is 'The requested resource does not exist: channel not found'.\n"}},"required":["code","message"]},"ValidationError":{"type":"object","properties":{"code":{"type":"string","description":"A unique code that identifies the error. This code can be used to programmatically identify the error.\n"},"message":{"type":"string","description":"A human-readable message that describes the error. An example is 'The requested resource does not exist: channel not found'.\n"},"details":{"type":"object","description":"Additional details about the error. This object can contain any additional information that may be useful for debugging.\n","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["code","message"]}},"responses":{"requestError":{"description":"The request did not pass validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestError"}}}},"validationError":{"description":"The request did not pass validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationError"}}}}}},"paths":{"/workspaces/{workspaceId}/channels/{channelId}/calls/{callId}/record":{"post":{"summary":"Record call","operationId":"recordChannelCall","description":"Record a channel call","tags":["channel_call_command"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Record"}}}},"responses":{"202":{"description":"Call Command Record was accepted for processing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallCommandRecordResponse"}}}},"400":{"$ref":"#/components/responses/requestError"},"404":{"$ref":"#/components/responses/requestError"},"422":{"$ref":"#/components/responses/validationError"}}}}}}
```

### Example 1: Record one inbound / outbound call

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

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

{% endtab %}

{% tab title="Request Body" %}

```
{
  "beep": true,
  "endKey": "#",
  "maxLength": 60,
  "timeout": 3,
  "transcribe": true,
  "transcribeLocale": "en-US"
}
```

{% endtab %}

{% tab title="Response" %}

```
{
  "command": {
    "id": "067f0409-fe5a-466a-bdc1-dccc76b02376",
    "callId": "d34d4ebc-dd67-405e-95ef-ca72485a2975",
    "command": "record",
    "status": "accepted"
  },
  "recordingId": "61396ce4-2e1a-404e-a550-5863b594f387"
}
```

{% endtab %}
{% endtabs %}
