Skip to content

Create an agent browser session for a project

POST
/projects/{projectId}/agent-session
import { FloraClient } from '@flora-ai/flora';
const client = new FloraClient({ apiKey: process.env['FLORA_API_KEY'] });
const project = await client.projects.createAgentSession({
projectId: '<projectId>',
session_hours: 1,
});
console.log(project);

Mints a one-shot sign-in link for an agent that has its own browser (for example Claude Code Desktop or Cowork with WebMCP). Opening the link signs the agent in as the credential’s user and lands on the project canvas with FLORA’s in-page WebMCP tools enabled, so the agent can drive the canvas directly. The link is consumed on first visit and the session it grants lasts session_hours (1–24, default 8) and acts as the user — treat it as a secret. The session acts as the whole user, so only OAuth credentials and API keys created before per-workspace permissions existed may create one; keys that carry a permission map are refused with 403 forbidden.

Error responses use the standard error body.

projectId
required

Project identifier

string
/^prj_\S+$/

Project identifier

Media type application/json
object
session_hours

How long the browser session minted by the link lasts, in hours (1–24, default 8).

integer
>= 1 <= 24
Example generated
{
"session_hours": 1
}

Agent session link created.

Media type application/json
object
project_id
required

Project identifier

string
/^prj_\S+$/
workspace_id
required

Workspace identifier

string
/^ws_\S+$/
url
required

One-shot sign-in link. Opening it in a browser signs the agent in as the credential’s user and lands on the project canvas with WebMCP enabled. It is consumed on first visit; navigate within the tab rather than reloading it.

string format: uri
canvas_url
required

Project canvas URL

string format: uri
expires_at
required

When the browser session minted by the link expires

string format: date-time
session_hours
required

Session length the link grants

integer
>= 1 <= 24
Example
{
"project_id": "prj_abc123",
"workspace_id": "ws_abc123"
}