Skip to main content
POST
Create Session

Authentication

Requires browser authentication (dashboard). API keys cannot create sessions — sessions must be attributed to a specific user.

Request body

string
required
The ID of the workspace to create the session in.
string
The initial prompt for the agent. A title is auto-generated from this message.
string
GitHub repository URL to clone (e.g., https://github.com/owner/repo). The sandbox will clone this repo before the agent starts working.
string
The branch to base changes on. Defaults to main. Only used when repoUrl is provided.
string
The Claude model to use. Defaults to claude-opus-4-6.

Response

Returns 201 Created with the newly created session.
object
The created session object. See List Sessions for the full schema.

Example

This endpoint requires browser authentication (session cookie). The example below shows the request shape — to create sessions, use the Magnet dashboard or the API from an authenticated browser context.
cURL

Response

Errors

Session creation requires browser authentication. If you need to create sessions programmatically, use the Magnet dashboard.