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

# Get Session

> Retrieve a single session with its full message history.

## Authentication

Requires an [API key](/authentication).

## Path parameters

<ParamField path="sessionId" type="string" required>
  The ID of the session to retrieve.
</ParamField>

## Query parameters

<ParamField query="organizationId" type="string">
  The ID of the workspace the session belongs to. Optional when using an API key.
</ParamField>

## Response

<ResponseField name="session" type="object">
  The full session object including messages.

  <Expandable title="Session fields">
    <ResponseField name="id" type="string">Unique session identifier.</ResponseField>
    <ResponseField name="title" type="string">Session title.</ResponseField>
    <ResponseField name="status" type="string">One of `active`, `completed`, or `failed`.</ResponseField>
    <ResponseField name="createdAt" type="datetime">When the session was created.</ResponseField>
    <ResponseField name="updatedAt" type="datetime">When the session was last updated.</ResponseField>
    <ResponseField name="model" type="string">The Claude model used.</ResponseField>
    <ResponseField name="author" type="object">The user who created the session.</ResponseField>
    <ResponseField name="metadata" type="object">Repository and PR context.</ResponseField>

    <ResponseField name="messages" type="array">
      Full conversation history.

      <Expandable title="Message types">
        Each message has a `type` field:

        * **`user`** — User input (the initial prompt and follow-ups)
        * **`assistant`** — Claude's response (text, thinking, tool usage)
        * **`result`** — Session completion event
      </Expandable>
    </ResponseField>

    <ResponseField name="tasks" type="array">
      Tasks tracked during the session.

      <Expandable title="Task fields">
        <ResponseField name="id" type="string">Task identifier.</ResponseField>
        <ResponseField name="title" type="string">Task description.</ResponseField>
        <ResponseField name="status" type="string">One of `pending`, `in_progress`, `completed`.</ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

## Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://magnet.run/api/sessions/cm3abc123def" \
    -H "x-api-key: YOUR_API_KEY"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://magnet.run/api/sessions/cm3abc123def', {
    headers: { 'x-api-key': 'YOUR_API_KEY' },
  });
  const { session } = await response.json();
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "session": {
    "id": "cm3abc123def",
    "title": "Add input validation to signup form",
    "status": "completed",
    "model": "claude-opus-4-6",
    "author": {
      "id": "user_123",
      "name": "Alice Chen"
    },
    "metadata": {
      "repository": "acme/web-app",
      "prNumber": 42,
      "prUrl": "https://github.com/acme/web-app/pull/42",
      "prStatus": "open"
    },
    "messages": [
      {
        "type": "user",
        "message": {
          "content": "Add input validation to the signup form..."
        }
      },
      {
        "type": "assistant",
        "message": {
          "content": [
            {
              "type": "text",
              "text": "I'll add validation to the signup form..."
            }
          ]
        }
      }
    ],
    "tasks": [
      {
        "id": "task_1",
        "title": "Add email validation",
        "status": "completed"
      }
    ]
  }
}
```

## Errors

| Status | Description                          |
| ------ | ------------------------------------ |
| `401`  | Invalid or missing authentication    |
| `403`  | No access to the specified workspace |
| `404`  | Session not found                    |
| `500`  | Server error                         |
