Codebase Sessions API
The Sessions API from Codebase — 4 operation(s) for sessions.
The Sessions API from Codebase — 4 operation(s) for sessions.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/codebase-design:codebase-design-sessions-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Codebase Design Sessions API
version: 1.0.0
contact:
email: admin@aipowergrid.io
description: 'Operations tagged Sessions across 2 of this provider''s published API definitions: codebase-design-openapi.json, codebase-design-openapi.yml. Each path carries the servers of the definition it was published in.'
servers:
- url: http://localhost:3001
description: Current
- url: https://dev.codebase.design
description: Development
- url: https://staging.codebase.design
description: Staging
- url: https://codebase.design
description: Production
security:
- ApiKeyAuth: []
- BearerAuth: []
tags:
- name: Sessions
paths:
/api/v1/sessions:
get:
summary: List saved sessions
tags:
- Sessions
security:
- ApiKeyAuth: []
parameters:
- in: query
name: limit
schema:
type: integer
default: 50
responses:
'200':
description: Session list
content:
application/json:
schema:
type: object
properties:
sessions:
type: array
items:
type: object
properties:
sessionId:
type: string
projectId:
type: string
model:
type: string
createdAt:
type: string
'401':
$ref: '#/components/responses/Unauthorized'
'500':
description: Internal server error
x-codeSamples:
- lang: TypeScript
label: TypeScript
source: "// Auth: X-API-Key header.\nconst apiKey = process.env.CODEBASE_API_KEY!;\n\nconst res = await fetch('https://codebase.design/api/v1/sessions?limit=50', {\n method: 'GET',\n headers: {\n 'X-API-Key': apiKey,\n 'Content-Type': 'application/json',\n }\n});\n\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`);\nconst data = await res.json();\nconsole.log(data);"
- lang: Python
label: Python
source: "import os\nimport requests\n\napi_key = os.environ['CODEBASE_API_KEY']\n\nresponse = requests.get(\n 'https://codebase.design/api/v1/sessions?limit=50',\n headers={\n 'X-API-Key': api_key,\n 'Content-Type': 'application/json',\n }\n)\nresponse.raise_for_status()\nprint(response.json())"
- lang: Rust
label: Rust
source: "// Cargo.toml:\n// reqwest = { version = \"0.12\", features = [\"json\"] }\n// serde_json = \"1\"\n// tokio = { version = \"1\", features = [\"full\"] }\n\nuse std::env;\n\n#[tokio::main]\nasync fn main() -> Result<(), Box<dyn std::error::Error>> {\n let api_key = env::var(\"CODEBASE_API_KEY\")?;\n let client = reqwest::Client::new();\n\n let res = client\n .get(\"https://codebase.design/api/v1/sessions?limit=50\")\n .header(\"X-API-Key\", api_key)\n .header(\"Content-Type\", \"application/json\")\n .send()\n .await?;\n\n let data: serde_json::Value = res.json().await?;\n println!(\"{:#?}\", data);\n Ok(())\n}"
operationId: getApiV1Sessions
x-operation-id-source: derived
servers:
- url: http://localhost:3001
description: Current
- url: http://localhost:3001
description: Local development
- url: https://dev.codebase.design
description: Development
- url: https://staging.codebase.design
description: Staging
- url: https://codebase.design
description: Production
/api/v1/sessions/{sessionId}:
get:
summary: Get session details
tags:
- Sessions
security:
- ApiKeyAuth: []
parameters:
- in: path
name: sessionId
required: true
schema:
type: string
responses:
'200':
description: Session details
content:
application/json:
schema:
type: object
properties:
session:
type: object
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
'500':
description: Internal server error
x-codeSamples:
- lang: TypeScript
label: TypeScript
source: "// Auth: X-API-Key header.\nconst apiKey = process.env.CODEBASE_API_KEY!;\n\nconst res = await fetch('https://codebase.design/api/v1/sessions/YOUR_SESSIONID', {\n method: 'GET',\n headers: {\n 'X-API-Key': apiKey,\n 'Content-Type': 'application/json',\n }\n});\n\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`);\nconst data = await res.json();\nconsole.log(data);"
- lang: Python
label: Python
source: "import os\nimport requests\n\napi_key = os.environ['CODEBASE_API_KEY']\n\nresponse = requests.get(\n 'https://codebase.design/api/v1/sessions/YOUR_SESSIONID',\n headers={\n 'X-API-Key': api_key,\n 'Content-Type': 'application/json',\n }\n)\nresponse.raise_for_status()\nprint(response.json())"
- lang: Rust
label: Rust
source: "// Cargo.toml:\n// reqwest = { version = \"0.12\", features = [\"json\"] }\n// serde_json = \"1\"\n// tokio = { version = \"1\", features = [\"full\"] }\n\nuse std::env;\n\n#[tokio::main]\nasync fn main() -> Result<(), Box<dyn std::error::Error>> {\n let api_key = env::var(\"CODEBASE_API_KEY\")?;\n let client = reqwest::Client::new();\n\n let res = client\n .get(\"https://codebase.design/api/v1/sessions/YOUR_SESSIONID\")\n .header(\"X-API-Key\", api_key)\n .header(\"Content-Type\", \"application/json\")\n .send()\n .await?;\n\n let data: serde_json::Value = res.json().await?;\n println!(\"{:#?}\", data);\n Ok(())\n}"
operationId: getApiV1SessionsBySessionId
x-operation-id-source: derived
servers:
- url: http://localhost:3001
description: Current
- url: http://localhost:3001
description: Local development
- url: https://dev.codebase.design
description: Development
- url: https://staging.codebase.design
description: Staging
- url: https://codebase.design
description: Production
/api/v1/sessions/{sessionId}/messages:
get:
summary: Get durable session transcript
description: Returns the saved conversation history for a session.
tags:
- Sessions
security:
- ApiKeyAuth: []
parameters:
- in: path
name: sessionId
required: true
schema:
type: string
- in: query
name: limit
schema:
type: integer
default: 50
minimum: 1
maximum: 100
- in: query
name: offset
schema:
type: integer
default: 0
minimum: 0
responses:
'200':
description: Paginated transcript
content:
application/json:
schema:
type: object
properties:
sessionId:
type: string
total:
type: integer
limit:
type: integer
offset:
type: integer
messages:
type: array
items:
type: object
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
'500':
description: Internal server error
x-codeSamples:
- lang: TypeScript
label: TypeScript
source: "// Auth: X-API-Key header.\nconst apiKey = process.env.CODEBASE_API_KEY!;\n\nconst res = await fetch('https://codebase.design/api/v1/sessions/YOUR_SESSIONID/messages?limit=50&offset=0', {\n method: 'GET',\n headers: {\n 'X-API-Key': apiKey,\n 'Content-Type': 'application/json',\n }\n});\n\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`);\nconst data = await res.json();\nconsole.log(data);"
- lang: Python
label: Python
source: "import os\nimport requests\n\napi_key = os.environ['CODEBASE_API_KEY']\n\nresponse = requests.get(\n 'https://codebase.design/api/v1/sessions/YOUR_SESSIONID/messages?limit=50&offset=0',\n headers={\n 'X-API-Key': api_key,\n 'Content-Type': 'application/json',\n }\n)\nresponse.raise_for_status()\nprint(response.json())"
- lang: Rust
label: Rust
source: "// Cargo.toml:\n// reqwest = { version = \"0.12\", features = [\"json\"] }\n// serde_json = \"1\"\n// tokio = { version = \"1\", features = [\"full\"] }\n\nuse std::env;\n\n#[tokio::main]\nasync fn main() -> Result<(), Box<dyn std::error::Error>> {\n let api_key = env::var(\"CODEBASE_API_KEY\")?;\n let client = reqwest::Client::new();\n\n let res = client\n .get(\"https://codebase.design/api/v1/sessions/YOUR_SESSIONID/messages?limit=50&offset=0\")\n .header(\"X-API-Key\", api_key)\n .header(\"Content-Type\", \"application/json\")\n .send()\n .await?;\n\n let data: serde_json::Value = res.json().await?;\n println!(\"{:#?}\", data);\n Ok(())\n}"
operationId: getApiV1SessionsBySessionIdMessages
x-operation-id-source: derived
servers:
- url: http://localhost:3001
description: Current
- url: http://localhost:3001
description: Local development
- url: https://dev.codebase.design
description: Development
- url: https://staging.codebase.design
description: Staging
- url: https://codebase.design
description: Production
/api/v1/sessions/{sessionId}/attach:
post:
summary: Attach to an active session
description: Returns the canonical session snapshot plus websocket attach metadata so remote clients can join an existing build/chat session without creating a new one.
tags:
- Sessions
security:
- ApiKeyAuth: []
parameters:
- in: path
name: sessionId
required: true
schema:
type: string
responses:
'200':
description: Session snapshot and websocket attach instructions
content:
application/json:
schema:
type: object
properties:
session:
type: object
properties:
sessionId:
type: string
projectId:
type: string
nullable: true
model:
type: string
nullable: true
state:
type: string
buildCompleted:
type: boolean
buildRunning:
type: boolean
buildInterrupted:
type: boolean
buildLogEntries:
type: array
items:
type: object
toolExecutionLog:
type: array
items:
type: object
websocket:
type: object
properties:
url:
type: string
authorization:
type: object
properties:
type:
type: string
enum:
- Bearer
token:
type: string
expiresInSeconds:
type: integer
websocketSubprotocolPrefix:
type: string
sessionRestore:
type: object
properties:
type:
type: string
enum:
- sessionRestore
sessionId:
type: string
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
'500':
description: Internal server error
x-codeSamples:
- lang: TypeScript
label: TypeScript
source: "// Auth: X-API-Key header.\nconst apiKey = process.env.CODEBASE_API_KEY!;\n\nconst res = await fetch('https://codebase.design/api/v1/sessions/YOUR_SESSIONID/attach', {\n method: 'POST',\n headers: {\n 'X-API-Key': apiKey,\n 'Content-Type': 'application/json',\n }\n});\n\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`);\nconst data = await res.json();\nconsole.log(data);"
- lang: Python
label: Python
source: "import os\nimport requests\n\napi_key = os.environ['CODEBASE_API_KEY']\n\nresponse = requests.post(\n 'https://codebase.design/api/v1/sessions/YOUR_SESSIONID/attach',\n headers={\n 'X-API-Key': api_key,\n 'Content-Type': 'application/json',\n }\n)\nresponse.raise_for_status()\nprint(response.json())"
- lang: Rust
label: Rust
source: "// Cargo.toml:\n// reqwest = { version = \"0.12\", features = [\"json\"] }\n// serde_json = \"1\"\n// tokio = { version = \"1\", features = [\"full\"] }\n\nuse std::env;\n\n#[tokio::main]\nasync fn main() -> Result<(), Box<dyn std::error::Error>> {\n let api_key = env::var(\"CODEBASE_API_KEY\")?;\n let client = reqwest::Client::new();\n\n let res = client\n .post(\"https://codebase.design/api/v1/sessions/YOUR_SESSIONID/attach\")\n .header(\"X-API-Key\", api_key)\n .header(\"Content-Type\", \"application/json\")\n .send()\n .await?;\n\n let data: serde_json::Value = res.json().await?;\n println!(\"{:#?}\", data);\n Ok(())\n}"
operationId: postApiV1SessionsBySessionIdAttach
x-operation-id-source: derived
servers:
- url: http://localhost:3001
description: Current
- url: http://localhost:3001
description: Local development
- url: https://dev.codebase.design
description: Development
- url: https://staging.codebase.design
description: Staging
- url: https://codebase.design
description: Production
components:
responses:
NotFound:
description: Resource not found
content:
application/json:
schema:
type: object
properties:
error:
type: string
Unauthorized:
description: Missing or invalid authentication
content:
application/json:
schema:
type: object
properties:
error:
type: string
securitySchemes:
ApiKeyAuth:
type: apiKey
in: header
name: X-API-Key
description: Revocable API key (cb_live_... or cb_test_...)
BearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
description: OAuth2 access token
x-refined-from:
- codebase-design-openapi.json
- codebase-design-openapi.yml