For the complete documentation index, see llms.txt. This page is also available as Markdown.

Create an agent browser session for a project

Create an agent browser session for a project with the FLORA API: POST /projects/{projectId}/agent-session.

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.

POST https://app.flora.ai/api/v1/projects/{projectId}/agent-session
  • Auth: API key as a bearer token, Authorization: Bearer $FLORA_API_KEY. See Authentication.

  • TypeScript SDK: client.projects.createAgentSession().

  • Operation ID: createProjectAgentSession.

Example

curl -X POST 'https://app.flora.ai/api/v1/projects/prj_abc123/agent-session' \
  -H "Authorization: Bearer $FLORA_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "session_hours": 1
}'
import { FloraClient } from '@flora-ai/flora';

const client = new FloraClient({ apiKey: process.env['FLORA_API_KEY'] });

const project = await client.projects.createAgentSession({
  projectId: 'prj_abc123',
  session_hours: 1,
});
console.log(project);

Path parameters

Name
Type
Required
Description

projectId

string

Yes

Project identifier. Pattern: ^prj_\S+$. Example: prj_abc123.

Request body

Optional.

Field
Type
Required
Description

session_hours

integer

No

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

Responses

Field
Type
Required
Description

project_id

string

Yes

Project identifier. Pattern: ^prj_\S+$. Example: prj_abc123.

workspace_id

string

Yes

Workspace identifier. Pattern: ^ws_\S+$. Example: ws_abc123.

url

string (uri)

Yes

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.

canvas_url

string (uri)

Yes

Project canvas URL

expires_at

string (date-time)

Yes

When the browser session minted by the link expires

session_hours

integer

Yes

Session length the link grants. 1 to 24.

Errors

Every error has the same body: error.code, error.message, and error.fields on validation errors. See Errors for how to recover from each code.

Status
Code
Meaning

400

invalid_json, input_validation_error

The body isn't valid JSON, or an input failed validation (fields lists each one).

401

unauthorized, invalid_api_key

The API key is missing, invalid or revoked.

402

insufficient_credits

The workspace balance is too low for this request.

403

forbidden, paid_plan_required

The key can't do this, or the workspace plan doesn't include it.

404

not_found

The resource doesn't exist or isn't visible to this key.

409

idempotency_duplicate, revision_conflict

Duplicate Idempotency-Key or a stale base_revision.

429

rate_limited

Too many requests. Back off and retry.

500

unknown_error, internal_error

Something failed on FLORA's side. Retry with backoff.

503

temporarily_unavailable

Authorization is temporarily unavailable. Retry later.

Last updated

Was this helpful?