Skip to main content
POST
/
v1
/
memory
/
{memory_id}
/
add-call
Add Call to Memory
curl --request POST \
  --url https://api.bland.ai/v1/memory/{memory_id}/add-call \
  --header 'Content-Type: application/json' \
  --header 'authorization: <authorization>' \
  --data '
{
  "call_id": "<string>",
  "external_memory_key": "<string>"
}
'
import requests

url = "https://api.bland.ai/v1/memory/{memory_id}/add-call"

payload = {
"call_id": "<string>",
"external_memory_key": "<string>"
}
headers = {
"authorization": "<authorization>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({call_id: '<string>', external_memory_key: '<string>'})
};

fetch('https://api.bland.ai/v1/memory/{memory_id}/add-call', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.bland.ai/v1/memory/{memory_id}/add-call",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'call_id' => '<string>',
'external_memory_key' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"authorization: <authorization>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.bland.ai/v1/memory/{memory_id}/add-call"

payload := strings.NewReader("{\n \"call_id\": \"<string>\",\n \"external_memory_key\": \"<string>\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("authorization", "<authorization>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.bland.ai/v1/memory/{memory_id}/add-call")
.header("authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"call_id\": \"<string>\",\n \"external_memory_key\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.bland.ai/v1/memory/{memory_id}/add-call")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"call_id\": \"<string>\",\n \"external_memory_key\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "data": {
    "message": "Call added to memory successfully",
    "call": {
      "call_id": "call_abc123",
      "memory_id": "mem_123abc"
    }
  },
  "errors": null
}
{
  "data": null,
  "errors": [
    {
      "error": "INVALID_REQUEST",
      "message": "Call ID is required."
    }
  ]
}
{
  "data": null,
  "errors": [
    {
      "error": "MEMORY_ADD_CALL_ERROR",
      "message": "Failed to add call to memory."
    }
  ]
}

Headers

authorization
string
required
Your API key for authentication.

Path Parameters

memory_id
string
required
The unique identifier of the memory to add the call to.

Body Parameters

call_id
string
required
The unique identifier of the call to add to the memory. Must be an existing call in your account.
external_memory_key
string
Optional external key for additional memory validation or cross-referencing.

Response

data
object
Response data confirming call addition.
data.message
string
Success message confirming call was added to memory.
data.call
object
Information about the call that was added.
data.call.call_id
string
The call identifier that was added.
data.call.memory_id
string
The memory identifier the call was added to.
errors
null
Error array (null on success).
{
  "data": {
    "message": "Call added to memory successfully",
    "call": {
      "call_id": "call_abc123",
      "memory_id": "mem_123abc"
    }
  },
  "errors": null
}
{
  "data": null,
  "errors": [
    {
      "error": "INVALID_REQUEST",
      "message": "Call ID is required."
    }
  ]
}
{
  "data": null,
  "errors": [
    {
      "error": "MEMORY_ADD_CALL_ERROR",
      "message": "Failed to add call to memory."
    }
  ]
}

Notes

  • The call must already exist in your account before it can be added to a memory
  • The call must be connected to a user existing in the memory
  • Adding a call to a memory will automatically associate it with the phone number involved in the call

Docs for agents: llms.txt