> ## 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.

# Update Session

> Update a session's title or status.

## Authentication

Requires an [API key](/authentication).

## Path parameters

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

## Query parameters

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

## Request body

All fields are optional — only include the fields you want to update.

<ParamField body="title" type="string">
  New title for the session.
</ParamField>

<ParamField body="status" type="string">
  New status. One of `active`, `completed`, or `failed`.
</ParamField>

## Response

<ResponseField name="session" type="object">
  The updated session object. See [List Sessions](/api-reference/sessions/list-sessions) for the full schema.
</ResponseField>

## Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PATCH "https://magnet.run/api/sessions/cm3abc123def" \
    -H "x-api-key: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "title": "Signup form validation (email + password)"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://magnet.run/api/sessions/cm3abc123def', {
    method: 'PATCH',
    headers: {
      'x-api-key': 'YOUR_API_KEY',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      title: 'Signup form validation (email + password)',
    }),
  });
  const { session } = await response.json();
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "session": {
    "id": "cm3abc123def",
    "title": "Signup form validation (email + password)",
    "status": "completed",
    "createdAt": "2026-02-10T14:30:00.000Z",
    "updatedAt": "2026-02-11T09:15:00.000Z",
    "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"
    },
    "messageCount": 12
  }
}
```

## Errors

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