List Sessions
curl --request GET \
--url https://api.example.com/api/sessionsimport requests
url = "https://api.example.com/api/sessions"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/sessions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/sessions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/sessions"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/sessions")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"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
}
}Sessions
List Sessions
Retrieve all sessions for a workspace, along with aggregate stats.
GET
/
api
/
sessions
List Sessions
curl --request GET \
--url https://api.example.com/api/sessionsimport requests
url = "https://api.example.com/api/sessions"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/sessions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/sessions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/sessions"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/sessions")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"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
string
The ID of the workspace to list sessions for. Optional when using an API key (resolved automatically).
Response
array
Array of session objects (without full message history).
Show Session fields
Show Session fields
string
Unique session identifier.
string
Session title (auto-generated or user-provided).
string
One of
active, completed, or failed.datetime
When the session was created.
datetime
When the session was last updated.
string
The Claude model used.
object
object
number
Total number of messages in the session.
string
Preview of the first message.
string
Preview of the most recent message.
object
Example
curl -X GET "https://magnet.run/api/sessions" \
-H "x-api-key: YOUR_API_KEY"
const response = await fetch('https://magnet.run/api/sessions', {
headers: { 'x-api-key': 'YOUR_API_KEY' },
});
const { sessions, stats } = await response.json();
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
| Status | Description |
|---|---|
401 | Invalid or missing authentication |
403 | No access to the specified workspace |
500 | Server error |
⌘I