Get Session
curl --request GET \
--url https://api.example.com/api/sessions/{sessionId}import requests
url = "https://api.example.com/api/sessions/{sessionId}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/sessions/{sessionId}', 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/{sessionId}",
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/{sessionId}"
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/{sessionId}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/sessions/{sessionId}")
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{
"session": {
"id": "<string>",
"title": "<string>",
"status": "<string>",
"createdAt": {},
"updatedAt": {},
"model": "<string>",
"author": {},
"metadata": {},
"messages": [
{}
],
"tasks": [
{
"id": "<string>",
"title": "<string>",
"status": "<string>"
}
]
}
}Sessions
Get Session
Retrieve a single session with its full message history.
GET
/
api
/
sessions
/
{sessionId}
Get Session
curl --request GET \
--url https://api.example.com/api/sessions/{sessionId}import requests
url = "https://api.example.com/api/sessions/{sessionId}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/sessions/{sessionId}', 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/{sessionId}",
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/{sessionId}"
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/{sessionId}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/sessions/{sessionId}")
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{
"session": {
"id": "<string>",
"title": "<string>",
"status": "<string>",
"createdAt": {},
"updatedAt": {},
"model": "<string>",
"author": {},
"metadata": {},
"messages": [
{}
],
"tasks": [
{
"id": "<string>",
"title": "<string>",
"status": "<string>"
}
]
}
}Authentication
Requires an API key.Path parameters
string
required
The ID of the session to retrieve.
Query parameters
string
The ID of the workspace the session belongs to. Optional when using an API key.
Response
object
The full session object including messages.
Show Session fields
Show Session fields
string
Unique session identifier.
string
Session title.
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
The user who created the session.
object
Repository and PR context.
array
Full conversation history.
Show Message types
Show 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
Example
curl -X GET "https://magnet.run/api/sessions/cm3abc123def" \
-H "x-api-key: YOUR_API_KEY"
const response = await fetch('https://magnet.run/api/sessions/cm3abc123def', {
headers: { 'x-api-key': 'YOUR_API_KEY' },
});
const { session } = await response.json();
Response
{
"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 |
⌘I