# get()

Canonical URL: https://developers.iagenify.com/sdk/ref/models/get/
Language: en

`api.models.get(id) → Promise<AssistantSession>`

Reopens a session by id, with its configuration and its conversation intact. This is what makes a thread survive a restart.

Status: GET /api/ai/models/:id · free · throws on 404

## Parameters {#parameters}

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `id` | string | required | The session id, from `assistant.id` or from [list()](/sdk/ref/models/list). |

## Returns {#returns}

An [AssistantSession](/sdk/ref/assistant-session), identical in kind to what `create()` gave you: same configuration, same id, and the conversation still behind it.

```javascript
// First run
const assistant = await api.models.create({ model: "gemini-3.5-flash" });
await db.save(userId, assistant.id);
await assistant.generate({ inputs: [{ type: "text", content: "My name is Zayd." }] });

// A week later, a different process
const again = await api.models.get(await db.load(userId));
await again.generate({ inputs: [{ type: "text", content: "What is my name?" }] });
// It knows — the conversation came back with the session.
```

> **The id is the only thing you have to keep**
>
> Everything else — model, settings, schema, history — is on the server. Store the id next to whatever the session belongs to, and nothing else needs persisting.

## Errors {#errors}

| Code | Status | When |
| --- | --- | --- |
| session_not_found | 404 | No session of this account carries that id — including a malformed one. |

It **throws** rather than returning `null`, so a missing session is an exception to catch, not a value to test.

```javascript
import { IaGenifyError } from "iagenify";

async function resume(api, id, model) {
  try {
    return await api.models.get(id);
  } catch (err) {
    if (err instanceof IaGenifyError && err.status === 404) {
      // Deleted, or belonging to another account. Start a fresh one.
      return api.models.create({ model });
    }
    throw err;
  }
}
```

A session belonging to another account answers the same `404`: the lookup is scoped to the caller, so one account cannot reach — or even detect — another's sessions.

## A session created with memory: false {#memory-false}

It still exists and `get()` still returns it, because the configuration was recorded. What is not there is a conversation: reopening it gives you the same settings and a blank slate.

- [list()](/sdk/ref/models/list): Finding an id you did not keep.
- [getHistory()](/sdk/ref/assistant-session/get-history): Reading what was said, rather than carrying on.

```python
# First run
assistant = api.models.create(model="gemini-3.5-flash")
db.save(user_id, assistant.id)
assistant.generate(inputs=[{"type": "text", "content": "My name is Zayd."}])

# A week later, a different process
again = api.models.get(db.load(user_id))
again.generate(inputs=[{"type": "text", "content": "What is my name?"}])
# It knows — the conversation came back with the session.
```

```python
from iagenify import IaGenifyError

def resume(api, session_id, model):
    try:
        return api.models.get(session_id)
    except IaGenifyError as error:
        if error.status == 404:
            # Deleted, or belonging to another account. Start a fresh one.
            return api.models.create(model=model)
        raise
```
