لوكلاء AI: ملف markdown لهذه الصفحة — /docs-content-en/calls/record.md فهرس التوثيق — /llms.txt

مقالات التوثيق متاحة حاليًا باللغة الإنجليزية فقط.

Call recording

POST /v1/calls/:callId/record

Attaches an audio recording to a completed external telephony call. Pass the file in the request body as base64 or as a link to a public HTTPS URL.

Parameters

Parameter Type Required Description
ParametercallId (path) Typestring Requiredyes DescriptionID of a completed call — the data.callId field from call registration. To complete a call, use POST /v1/calls/:callId/finish

Request fields (body)

Pass either fileContent or recordUrl, not both.

Field Type Required Description
FieldfileContent Typestring Requiredno DescriptionAudio file in base64. Required if recordUrl is not passed. Up to 2 MiB after decoding; an empty file is not accepted
FieldrecordUrl Typestring Requiredno DescriptionPublic HTTPS URL of the recording file. Required if fileContent is not passed. The URL must not contain a login, password or access tokens and must not point to an internal network
FieldfileName Typestring Requiredno DescriptionFile name with a lowercase .mp3 or .wav extension. Required together with fileContent. With recordUrl, the last segment of the URL path is used by default

Examples

curl — personal key

Terminal
curl -X POST 'https://vibecode.bitrix24.com/v1/calls/externalCall.00000000000000000000000000000000.1700000000/record' \
  -H 'X-Api-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"fileName":"record.wav","fileContent":"UklGRjQAAABXQVZFZm10IBAAAAABAAEAQB8AAIA+AAACABAAZGF0YRAAAAAAAAAAAAAAAAAAAAAAAAAA"}'

curl — OAuth application

Terminal
curl -X POST 'https://vibecode.bitrix24.com/v1/calls/externalCall.00000000000000000000000000000000.1700000000/record' \
  -H 'X-Api-Key: YOUR_APP_KEY' \
  -H 'Authorization: Bearer USER_SESSION_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"fileName":"record.wav","fileContent":"UklGRjQAAABXQVZFZm10IBAAAAABAAEAQB8AAIA+AAACABAAZGF0YRAAAAAAAAAAAAAAAAAAAAAAAAAA"}'

JavaScript — personal key

javascript
const callId = 'externalCall.00000000000000000000000000000000.1700000000';
const response = await fetch(`https://vibecode.bitrix24.com/v1/calls/${callId}/record`, {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    fileName: 'record.wav',
    fileContent: 'UklGRjQAAABXQVZFZm10IBAAAAABAAEAQB8AAIA+AAACABAAZGF0YRAAAAAAAAAAAAAAAAAAAAAAAAAA',
  }),
});
const { data } = await response.json();
console.log(data.fileId);

JavaScript — OAuth application

javascript
const callId = 'externalCall.00000000000000000000000000000000.1700000000';
const response = await fetch(`https://vibecode.bitrix24.com/v1/calls/${callId}/record`, {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    fileName: 'record.wav',
    fileContent: 'UklGRjQAAABXQVZFZm10IBAAAAABAAEAQB8AAIA+AAACABAAZGF0YRAAAAAAAAAAAAAAAAAAAAAAAAAA',
  }),
});
const { data } = await response.json();
console.log(data.fileId);

Response fields

Field Type Description
Fieldsuccess Typeboolean Descriptiontrue on success
Fielddata Typeobject DescriptionOperation result
Fielddata.fileId Typeinteger DescriptionID of the recording file attached to the call

Response example

JSON
{
  "success": true,
  "data": {
    "fileId": 10209
  }
}

Error response example

422 — a call with this callId is not found or has not ended yet:

JSON
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "Call is not found in the statistic table. Looks like it is not finished yet."
  }
}

Errors

HTTP Code Description
HTTP400 CodeINVALID_PARAMS DescriptionThe request body is not a JSON object
HTTP400 CodeINVALID_PARAMS DescriptionBoth recordUrl and fileContent are passed, or recordUrl is empty
HTTP400 CodeINVALID_PARAMS DescriptionrecordUrl is not an HTTPS URL, contains credentials or points to an internal network
HTTP400 CodeINVALID_PARAMS DescriptionfileContent is not base64 or the file is empty
HTTP400 CodeINVALID_PARAMS DescriptionfileName does not end in .mp3 or .wav
HTTP400 CodeINVALID_PARAMS DescriptionBitrix24 rejected the parameter value
HTTP400 CodeMISSING_REQUIRED_FIELDS DescriptionrecordUrl is not passed, and fileContent or fileName is missing
HTTP401 CodeMISSING_API_KEY DescriptionThe X-Api-Key header is missing
HTTP401 CodeINVALID_API_KEY DescriptionThe key is not found or has been revoked
HTTP401 CodeTOKEN_MISSING DescriptionThe key has no portal tokens. An OAuth application key requires the Authorization: Bearer header
HTTP403 CodeSCOPE_DENIED DescriptionThe key has no telephony scope
HTTP403 CodeWRITE_BLOCKED_READONLY_KEY DescriptionThe key is read-only
HTTP403 CodeBITRIX_ACCESS_DENIED DescriptionBitrix24 denied access. For possible causes, see Authorization, keys and permissions
HTTP404 CodeENTITY_NOT_FOUND DescriptionBitrix24 reported that the object was not found
HTTP413 CodePAYLOAD_TOO_LARGE DescriptionThe file exceeds 2 MiB after decoding, or the request body exceeds 3 MiB
HTTP422 CodeBITRIX_ERROR DescriptionA call with this callId is not found or has not ended yet
HTTP422 CodeBITRIX_ERROR DescriptionBitrix24 did not return the recording file ID
HTTP429 CodeLARGE_BODY_BACKEND_BUSY DescriptionThe server is processing other requests with a large body. Retry the request after a delay
HTTP429 CodeRATE_LIMITED DescriptionRequest rate exceeded on the Bitrix24 side
HTTP502 CodeBITRIX_UNAVAILABLE DescriptionBitrix24 is unavailable
HTTP503 CodeBITRIX_TIMEOUT DescriptionBitrix24 did not respond in time

The full list of common API errors — Error codes.

See also