> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bland.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Memory Context

> Retrieve the full memory context for a contact scoped to a persona or agent number. Returns everything the agent sees at the start of a conversation: summary, facts, recent messages, entities, and open items.

### Headers

<ParamField header="authorization" type="string" required>
  Your API key for authentication.
</ParamField>

### Query Parameters

<ParamField query="contact_id" type="string" required>
  The unique identifier of the contact.
</ParamField>

<ParamField query="persona_id" type="string">
  The persona ID for memory scoping. Either `persona_id` or `agent_number` is required.
</ParamField>

<ParamField query="agent_number" type="string">
  The agent phone number for memory scoping. Either `persona_id` or `agent_number` is required.
</ParamField>

### Response

<ResponseField name="data" type="object">
  The memory context object.
</ResponseField>

<ResponseField name="data.contact_id" type="string">
  The contact ID this memory belongs to.
</ResponseField>

<ResponseField name="data.recentMessages" type="array">
  Array of recent messages from the sliding window (cross-channel).
</ResponseField>

<ResponseField name="data.recentMessages[].role" type="string">
  Message role: "user" or "assistant".
</ResponseField>

<ResponseField name="data.recentMessages[].content" type="string">
  Message content.
</ResponseField>

<ResponseField name="data.recentMessages[].channel" type="string">
  Channel the message came from: "call" or "sms".
</ResponseField>

<ResponseField name="data.recentMessages[].timestamp" type="string">
  ISO timestamp when the message was recorded.
</ResponseField>

<ResponseField name="data.summary" type="string">
  Rolling summary of interactions with this contact.
</ResponseField>

<ResponseField name="data.contactFacts" type="object">
  Structured facts about the contact (key-value pairs).
</ResponseField>

<ResponseField name="data.entities" type="array">
  Array of extracted entities associated with this contact.
</ResponseField>

<ResponseField name="data.openItems" type="array">
  Array of open items or pending tasks for this contact.
</ResponseField>

<ResponseField name="errors" type="null">
  Error array (null on success).
</ResponseField>

<ResponseExample>
  ```json Response theme={null}
  {
    "data": {
      "contact_id": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
      "recentMessages": [
        {
          "role": "user",
          "content": "Has my order shipped yet?",
          "channel": "sms",
          "timestamp": "2025-07-23T09:10:00.000Z"
        },
        {
          "role": "assistant",
          "content": "Yes, order #8821 shipped this morning. Expected delivery is Friday July 25.",
          "channel": "sms",
          "timestamp": "2025-07-23T09:10:05.000Z"
        }
      ],
      "summary": "Customer called about order #8821 which was delayed. Follow-up confirmed the order shipped and is now in transit. Expected delivery July 25.",
      "contactFacts": {
        "name": "Sarah Chen",
        "phone": "+14155550192",
        "preferred_contact": "sms",
        "timezone": "America/Los_Angeles"
      },
      "entities": [
        {
          "entity_type": "order",
          "entity_id": "order-8821",
          "facts": {
            "order_number": "#8821",
            "status": "in_transit",
            "carrier": "UPS",
            "expected_delivery": "2025-07-25"
          },
          "status": "in_transit",
          "last_discussed_at": "2025-07-23T09:10:00.000Z",
          "notes": null
        }
      ],
      "openItems": [
        {
          "type": "follow_up",
          "description": "Confirm delivery of order #8821 on July 25",
          "created_at": "2025-07-23T09:10:00.000Z",
          "priority": "medium",
          "related_to": {
            "entity_type": "order",
            "entity_id": "order-8821"
          }
        }
      ]
    },
    "errors": null
  }
  ```

  ```json No Memory Yet theme={null}
  {
    "data": {
      "contact_id": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
      "recentMessages": [],
      "summary": null,
      "contactFacts": {},
      "entities": [],
      "openItems": []
    },
    "errors": null
  }
  ```

  ```json Error Response theme={null}
  {
    "data": null,
    "errors": [
      {
        "error": "BAD_REQUEST",
        "message": "persona_id or agent_number is required"
      }
    ]
  }
  ```
</ResponseExample>

***

Docs for agents: [llms.txt](/llms.txt)
