curl --request POST \
--url https://api.{domain}/v1/sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent": {
"model": "MiniMax-M3"
},
"input": "Write /workspace/outputs/report.md about this repo."
}
'import requests
url = "https://api.{domain}/v1/sessions"
payload = {
"agent": { "model": "MiniMax-M3" },
"input": "Write /workspace/outputs/report.md about this repo."
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agent: {model: 'MiniMax-M3'},
input: 'Write /workspace/outputs/report.md about this repo.'
})
};
fetch('https://api.{domain}/v1/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.{domain}/v1/sessions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'agent' => [
'model' => 'MiniMax-M3'
],
'input' => 'Write /workspace/outputs/report.md about this repo.'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.{domain}/v1/sessions"
payload := strings.NewReader("{\n \"agent\": {\n \"model\": \"MiniMax-M3\"\n },\n \"input\": \"Write /workspace/outputs/report.md about this repo.\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.{domain}/v1/sessions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent\": {\n \"model\": \"MiniMax-M3\"\n },\n \"input\": \"Write /workspace/outputs/report.md about this repo.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.{domain}/v1/sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agent\": {\n \"model\": \"MiniMax-M3\"\n },\n \"input\": \"Write /workspace/outputs/report.md about this repo.\"\n}"
response = http.request(request)
puts response.read_body{
"object": "session",
"id": "<string>",
"status": "idle",
"created_at": 123,
"updated_at": 123,
"agent": {
"id": "<string>",
"model": "<string>",
"model_credential_id": "<string>",
"approval_mode": "<string>",
"instructions": "<string>",
"permission_rules": [
{}
],
"tools": [
{}
]
},
"environment": {
"type": "sandbox",
"state": "unknown",
"workspace_directory": "<string>",
"repo": {
"full_name": "<string>",
"branch": "<string>",
"clone_error": "<string>"
}
},
"preview": {
"url": "<string>",
"port": 123,
"published_url": "<string>"
},
"title": "<string>",
"source": "api",
"created_by_token": "<string>",
"required_actions": [
{
"type": "function_call",
"turn_id": "<string>",
"call_id": "<string>",
"name": "<string>",
"arguments": "<unknown>",
"created_at": 123,
"expires_at": 123
}
]
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"request_id": "<string>"
}
}Create a session
Create a session, optionally with an opening message.
curl --request POST \
--url https://api.{domain}/v1/sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent": {
"model": "MiniMax-M3"
},
"input": "Write /workspace/outputs/report.md about this repo."
}
'import requests
url = "https://api.{domain}/v1/sessions"
payload = {
"agent": { "model": "MiniMax-M3" },
"input": "Write /workspace/outputs/report.md about this repo."
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agent: {model: 'MiniMax-M3'},
input: 'Write /workspace/outputs/report.md about this repo.'
})
};
fetch('https://api.{domain}/v1/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.{domain}/v1/sessions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'agent' => [
'model' => 'MiniMax-M3'
],
'input' => 'Write /workspace/outputs/report.md about this repo.'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.{domain}/v1/sessions"
payload := strings.NewReader("{\n \"agent\": {\n \"model\": \"MiniMax-M3\"\n },\n \"input\": \"Write /workspace/outputs/report.md about this repo.\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.{domain}/v1/sessions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent\": {\n \"model\": \"MiniMax-M3\"\n },\n \"input\": \"Write /workspace/outputs/report.md about this repo.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.{domain}/v1/sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agent\": {\n \"model\": \"MiniMax-M3\"\n },\n \"input\": \"Write /workspace/outputs/report.md about this repo.\"\n}"
response = http.request(request)
puts response.read_body{
"object": "session",
"id": "<string>",
"status": "idle",
"created_at": 123,
"updated_at": 123,
"agent": {
"id": "<string>",
"model": "<string>",
"model_credential_id": "<string>",
"approval_mode": "<string>",
"instructions": "<string>",
"permission_rules": [
{}
],
"tools": [
{}
]
},
"environment": {
"type": "sandbox",
"state": "unknown",
"workspace_directory": "<string>",
"repo": {
"full_name": "<string>",
"branch": "<string>",
"clone_error": "<string>"
}
},
"preview": {
"url": "<string>",
"port": 123,
"published_url": "<string>"
},
"title": "<string>",
"source": "api",
"created_by_token": "<string>",
"required_actions": [
{
"type": "function_call",
"turn_id": "<string>",
"call_id": "<string>",
"name": "<string>",
"arguments": "<unknown>",
"created_at": 123,
"expires_at": 123
}
]
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"request_id": "<string>"
}
}Authorizations
A gbr_pat_ access token. Scopes are recorded on the token when it is minted.
Headers
Retrying with the same key replays the first answer instead of acting again.
255Body
Everything optional. A session with only a model is a complete session.
What runs, and how freely. Omit every field and the organization's default connection runs it.
Show child attributes
Show child attributes
What the workspace starts with.
Show child attributes
Show child attributes
Your own labels. Returned unchanged; never interpreted.
Show child attributes
Show child attributes
An opening message. All or nothing — if it cannot be accepted the session is not created either.
A label for people.
Response
Create a session, optionally with an opening message.
Always session. Names the shape, so a value can be identified without knowing which call returned it.
"session"Ours, not yours. Use metadata to carry your own identifier.
idle accepts input. working is running a turn. requires_action is waiting on you — see required_actions. failed is the last turn's outcome, not a dead session.
idle, working, requires_action, failed Unix milliseconds.
Unix milliseconds. Moves on any change, including the workspace waking.
What is running, and how freely.
Show child attributes
Show child attributes
The workspace: its state, where the agent works, and the repository bound to it.
Show child attributes
Show child attributes
Addresses for whatever the agent is serving. See preview.md.
Show child attributes
Show child attributes
A label for people. Set it yourself; nothing derives one.
Which door created this session. Null on sessions predating the field.
api, console, cli, null The id of the access token that created it — never its secret.
Everything the session is waiting on you for. Authoritative — not a replay of events, so a caller that restarted gets the same complete answer.
Show child attributes
Show child attributes