Skip to main content
GET
/
api
/
sessions
List Sessions
curl --request GET \
  --url https://api.example.com/api/sessions
{
  "sessions": [
    {
      "id": "<string>",
      "title": "<string>",
      "status": "<string>",
      "createdAt": {},
      "updatedAt": {},
      "model": "<string>",
      "author": {
        "id": "<string>",
        "name": "<string>",
        "imageUrl": "<string>"
      },
      "metadata": {
        "repository": "<string>",
        "branch": "<string>",
        "prNumber": 123,
        "prUrl": "<string>",
        "prStatus": "<string>"
      },
      "messageCount": 123,
      "firstMessagePreview": "<string>",
      "lastMessagePreview": "<string>"
    }
  ],
  "stats": {
    "mergesPastWeek": 123,
    "authorsPastWeek": 123,
    "humansPastWeek": 123,
    "humansPromptingNow": 123
  }
}

Authentication

Requires an API key.

Query parameters

organizationId
string
The ID of the organization to list sessions for. Optional when using an API key (resolved automatically).

Response

sessions
array
Array of session objects (without full message history).
stats
object
Aggregate statistics for the organization.

Example

curl -X GET "https://magnet.run/api/sessions" \
  -H "x-api-key: YOUR_API_KEY"

Response

{
  "sessions": [
    {
      "id": "cm3abc123def",
      "title": "Add input validation to signup form",
      "status": "completed",
      "createdAt": "2026-02-10T14:30:00.000Z",
      "updatedAt": "2026-02-10T14:45:00.000Z",
      "model": "claude-opus-4-6",
      "author": {
        "id": "user_123",
        "name": "Alice Chen"
      },
      "metadata": {
        "repository": "acme/web-app",
        "branch": "agent/add-signup-validation",
        "prNumber": 42,
        "prUrl": "https://github.com/acme/web-app/pull/42",
        "prStatus": "open"
      },
      "messageCount": 12,
      "firstMessagePreview": "Add input validation to the signup form...",
      "lastMessagePreview": "I've opened PR #42 with the changes..."
    }
  ],
  "stats": {
    "mergesPastWeek": 8,
    "authorsPastWeek": 3,
    "humansPastWeek": 5,
    "humansPromptingNow": 1
  }
}

Errors

StatusDescription
401Invalid or missing authentication
403No access to the specified organization
500Server error