Teams & sessions
Resolve team runtime configuration, then list and operate sessions for that team.
Discover how a team should run work, then operate sessions for that team. Resolve a team's gateway config first, then list and act on its sessions.
Route inventory
| Method | Route | Purpose |
|---|---|---|
GET | /v1/teams/{team} | Resolve team metadata & gateway configuration. |
GET | /v1/sessions?team={team} | List sessions for a team. |
POST | /v1/sessions/{id}/detach | Detach an active session into control-plane state. |
POST | /v1/sessions/{id}/resume | Resume remotely or materialize locally. |
POST | /v1/sessions/{id}/attach | Return attach transport metadata once available. |
GET | /v1/sessions/{id}/stream | Stream remote-session handoff events as SSE. |
POST | /v1/sessions/{id}/land | Queue policy-gated landing / review work. |
Resolve team metadata
Use the returned endpoint, region, defaultModel, and models instead of hard-coding production values. Optional dev query params: endpoint, region, mode, defaultModel.
curl https://api.s46.dev/v1/teams/%40s46%2Fengineering \
-H "Authorization: Bearer $S46_ACCESS_TOKEN"const team = await fetch(
"https://api.s46.dev/v1/teams/%40s46%2Fengineering",
{ headers: { Authorization: `Bearer ${accessToken}` } },
).then((r) => r.json());team = requests.get("https://api.s46.dev/v1/teams/%40s46%2Fengineering",
headers={"Authorization": f"Bearer {access_token}"}).json(){
"name": "@s46/engineering",
"organizationSlug": "s46",
"slug": "engineering",
"endpoint": "https://gateway.s46.dev",
"region": "EU-OPO",
"mode": "cloud",
"workerHosts": [],
"defaultModel": "s46/devstral-small-2-24b",
"models": ["s46/devstral-small-2-24b"]
}List sessions
Session payloads use region, not lane.
curl "https://api.s46.dev/v1/sessions?team=%40s46%2Fengineering" \
-H "Authorization: Bearer $S46_ACCESS_TOKEN"const { sessions } = await fetch(
"https://api.s46.dev/v1/sessions?team=%40s46%2Fengineering",
{ headers: { Authorization: `Bearer ${accessToken}` } },
).then((r) => r.json());sessions = requests.get("https://api.s46.dev/v1/sessions",
params={"team": "@s46/engineering"},
headers={"Authorization": f"Bearer {access_token}"}).json(){
"sessions": [
{
"id": "@dscape/auth-redirect-fix",
"state": "running",
"harness": "pi",
"location": "worker:worker_01",
"region": "EU-OPO",
"model": "s46/devstral-small-2-24b",
"age": "4m",
"spent": "€0.00",
"task": "Fix auth redirect"
}
]
}Detach & resume
Detach returns the updated session object (it is job-backed on the control plane). Resume defaults to target: "remote"; target: "local" asks the consumer to materialize locally when supported.
curl -X POST "https://api.s46.dev/v1/sessions/%40dscape%2Fauth-redirect-fix/resume?team=%40s46%2Fengineering" \
-H "Authorization: Bearer $S46_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "target": "remote" }'const session = await fetch(
"https://api.s46.dev/v1/sessions/%40dscape%2Fauth-redirect-fix/resume?team=%40s46%2Fengineering",
{
method: "POST",
headers: { Authorization: `Bearer ${accessToken}`, "Content-Type": "application/json" },
body: JSON.stringify({ target: "remote" }),
},
).then((r) => r.json());session = requests.post(
"https://api.s46.dev/v1/sessions/%40dscape%2Fauth-redirect-fix/resume",
params={"team": "@s46/engineering"},
headers={"Authorization": f"Bearer {access_token}"},
json={"target": "remote"},
).json()Attach & stream
Attach returns transport metadata when the remote session is attachable; if the session is still queued, the API returns 428 authorization_pending. The stream is text/event-stream.
# Request attach transport metadata
curl -X POST "https://api.s46.dev/v1/sessions/%40dscape%2Fauth-redirect-fix/attach?team=%40s46%2Fengineering" \
-H "Authorization: Bearer $S46_ACCESS_TOKEN"
# Then consume the SSE stream
curl -N "https://api.s46.dev/v1/sessions/%40dscape%2Fauth-redirect-fix/stream?team=%40s46%2Fengineering" \
-H "Authorization: Bearer $S46_ACCESS_TOKEN"const attach = await fetch(
"https://api.s46.dev/v1/sessions/%40dscape%2Fauth-redirect-fix/attach?team=%40s46%2Fengineering",
{ method: "POST", headers: { Authorization: `Bearer ${accessToken}` } },
).then((r) => r.json());
// then consume attach.url as a text/event-streamattach = requests.post(
"https://api.s46.dev/v1/sessions/%40dscape%2Fauth-redirect-fix/attach",
params={"team": "@s46/engineering"},
headers={"Authorization": f"Bearer {access_token}"},
).json()
# then consume attach["url"] as a text/event-stream{
"sessionId": "@dscape/auth-redirect-fix",
"url": "https://api.s46.dev/v1/sessions/%40dscape%2Fauth-redirect-fix/stream?team=%40s46%2Fengineering",
"protocol": "sse"
}event: session
data: {"id":"@dscape/auth-redirect-fix","state":"running","location":"worker:worker_01"}Land
Queue policy-gated landing / review work. The response includes landing and review metadata.
curl -X POST "https://api.s46.dev/v1/sessions/%40dscape%2Fauth-redirect-fix/land?team=%40s46%2Fengineering" \
-H "Authorization: Bearer $S46_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "title": "Fix auth redirect" }'const landing = await fetch(
"https://api.s46.dev/v1/sessions/%40dscape%2Fauth-redirect-fix/land?team=%40s46%2Fengineering",
{
method: "POST",
headers: { Authorization: `Bearer ${accessToken}`, "Content-Type": "application/json" },
body: JSON.stringify({ title: "Fix auth redirect" }),
},
).then((r) => r.json());landing = requests.post(
"https://api.s46.dev/v1/sessions/%40dscape%2Fauth-redirect-fix/land",
params={"team": "@s46/engineering"},
headers={"Authorization": f"Bearer {access_token}"},
json={"title": "Fix auth redirect"},
).json(){
"id": "@dscape/auth-redirect-fix",
"title": "Fix auth redirect",
"branch": "dscape/auth-redirect-fix",
"ranOn": ["worker_01"],
"harness": "pi",
"model": "s46/devstral-small-2-24b",
"cost": "€0.00",
"status": "ready_for_review",
"pullRequestUrl": "https://github.com/sovereign46/app/pull/42",
"review": {
"summary": "Ready for review.",
"checklist": ["Tests pass", "Review changes"],
"suggestedCommands": ["npm test"]
}
}