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

# Sources

> What a profile stored — each ingested session and remembered fact — and how to trace a memory back to it.

A **source** is what a profile stored and extracts memories from: one ingested session, or one remembered fact. [`ingest`](/docs/agent-memory/writing#ingest-a-session) and [`remember`](/docs/agent-memory/writing#remember-a-fact) return its `source_id` in their `202`, so you have it before extraction finishes. Re-ingesting a session keeps its source id and replaces what it held.

## List a profile's sources

Every source a profile stored, most recently written first, without content:

```bash theme={null}
curl "https://api.telnyx.com/v2/ai/memory/namespaces/default/profiles/caller:+13128675309/sources" \
  -H "Authorization: Bearer $TELNYX_API_KEY"
```

```json theme={null}
{
  "data": [
    { "id": "b1e6c0a2-…", "session_id": "conv_8901", "memory_count": 3, "created_at": "2026-08-26T21:14:11Z", "updated_at": "2026-08-26T21:14:11Z" },
    { "id": "9af23d17-…", "session_id": null, "memory_count": 1, "created_at": "2026-08-25T09:02:44Z", "updated_at": "2026-08-25T09:02:44Z" }
  ],
  "meta": { "page_number": 1, "page_size": 20, "total_pages": 1, "total_results": 2 }
}
```

`session_id` is `null` for a remembered fact — the only place the two kinds differ. Paged like every listing: `page[number]` / `page[size]`, with `meta.total_pages` / `meta.total_results`.

### Find one session's source

Add `?session_id=` to look up the source a session was stored as, without paging or re-deriving its id:

```bash theme={null}
curl "https://api.telnyx.com/v2/ai/memory/namespaces/default/profiles/caller:+13128675309/sources?session_id=conv_8901" \
  -H "Authorization: Bearer $TELNYX_API_KEY"
```

It returns **zero or one** source. An unknown session, another profile's session, or one whose ingest is still queued is an empty page (`total_results: 0`) — a listing, not a `404`. A `session_id` over 128 characters is a `422`.

## Read one source

One source with its `content`, returned in the shape it was sent — a JSON body as JSON, a string as a string:

```bash theme={null}
curl "https://api.telnyx.com/v2/ai/memory/namespaces/default/profiles/caller:+13128675309/sources/$SOURCE_ID" \
  -H "Authorization: Bearer $TELNYX_API_KEY"
```

```json theme={null}
{
  "data": {
    "id": "b1e6c0a2-…",
    "session_id": "conv_8901",
    "memory_count": 3,
    "created_at": "2026-08-26T21:14:11Z",
    "updated_at": "2026-08-26T21:14:11Z",
    "content": {
      "messages": [{ "role": "user", "content": "invoices go to 220 W Chicago Ave now" }]
    }
  }
}
```

## Trace a memory to its source

Read one memory by id to see where it came from — exactly one field is set:

```bash theme={null}
curl "https://api.telnyx.com/v2/ai/memory/namespaces/default/profiles/caller:+13128675309/memories/mem_01H…" \
  -H "Authorization: Bearer $TELNYX_API_KEY"
```

* A **fact** names the source it was extracted from in `source_id` — read it with `GET …/sources/{source_id}`.
* A **derived memory** names the memories it was built from in `derived_from` — read each one to follow it back. Every read is a single call, however many memories are cited.

```json theme={null}
{
  "data": {
    "id": "mem_01H…",
    "text": "Invoices go to 220 W Chicago Ave.",
    "recorded_at": "2026-08-26T21:14:11Z",
    "source_id": "b1e6c0a2-…",
    "derived_from": null
  }
}
```

## Forget one source

Forget a single source and the memories derived from it, leaving the rest of the profile intact. **This is also how you forget one session** — delete the session's source, either with the `source_id` from the ingest `202` or the one from [`?session_id=`](#find-one-sessions-source) above:

```bash theme={null}
curl -X DELETE "https://api.telnyx.com/v2/ai/memory/namespaces/default/profiles/caller:+13128675309/sources/$SOURCE_ID" \
  -H "Authorization: Bearer $TELNYX_API_KEY"
```

A source that is not there answers `404` — an unknown id, another profile's source, or one already forgotten. Retrying is safe: on a `502` or `504`, repeat it and read a `404` as done.

<Note>
  A source id is an opaque UUID. Another profile's source or memory answers `404` — the same as one that does not exist — and an id that is not a UUID is a `422`.
</Note>

## Related

* [Writing memories](/docs/agent-memory/writing) — how sources get in
* [Recalling memories](/docs/agent-memory/recall) — reading a profile's memories
* [Forgetting](/docs/agent-memory/deleting) — forgetting a whole profile
