Create a Forward session from an Identity and Template.
POST /api/v1/forward/sessions
Creates a session by compiling the Template baseline with the Identity Config override, then starting a runtime Session.
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <PAT or SAT> |
Content-Type | Yes | application/json |
Idempotency-Key | No | Optional idempotency key for unsafe requests. |
Body parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
identity_id | string | Yes | Forward Identity ID. |
template_id | string | Yes | Forward Template ID. |
title | string | No | Session title. |
metadata | object | No | Custom metadata. |
config | object | No | Per-session configuration override. Only allowlisted fields are accepted. |
config.environment_variables | object | No | Session environment variables as key-value pairs. They are merged on top of the compiled Template + Identity Config result; Session-level values override base-layer values with the same key. |
resources | array | No | Session-level resources, currently file mounts. |
resources[].type | string | Yes when resources is used | Resource type. Currently file. |
resources[].file_id | string | Yes when resources is used | File ID from the Files API. |
resources[].mount_path | string | No | Mount path inside the agent container. If omitted, Forward derives one from the filename. |
config.environment_variables:
- Forward first compiles the Template
environment_variablesbaseline and the Identity Config override layer to produce the base environment variables. - Key-value pairs supplied in the request are added to the base environment variables. New keys are added, while Session-level values override base-layer values with the same key.
- Variables omitted from the request remain in the compiled Template + Identity Config result.
Example request
Example response
HTTP 200 OK
Response fields
| Field | Type | Description |
|---|---|---|
id | string | Session ID. |
type | string | Always session. |
identity_id | string | Forward Identity ID. |
template | object | Template summary. |
source_type | string | Session source. Direct API creation uses api. |
status | string | idle, running, rescheduling, canceling, or terminated. |
archived_at | string|null | Archive timestamp. |
created_at | string | Creation timestamp. |
updated_at | string | Update timestamp. |
Errors
| HTTP | Type | Code | Trigger |
|---|---|---|---|
| 400 | invalid_request_error | invalid_request_body | Invalid request body. |
| 403 | permission_error | template_access_denied | Identity cannot use the Template. |
| 404 | not_found_error | identity_not_found | Identity does not exist or is deleted. |
| 404 | not_found_error | template_not_found | Template does not exist. |
| 409 | conflict_error | identity_disabled | Identity is disabled. |
| 422 | invalid_request_error | runtime_config_invalid | Effective runtime config is invalid. |
| 401 | authentication_error | authentication_required | The PAT or SAT is invalid or expired. |
Notes
source_typeis assigned by Forward and is not accepted in the create request.incremental_streaming_enabledis a legacy streaming toggle retained for backward compatibility. It is not recommended for new integrations and cannot be changed after creation. New integrations that need streaming output should useevent_deltas[]when subscribing to the Session Event Stream. If this field is set totrue,event_deltas[]does not take effect.- Uploaded files must already exist in the Files API before being passed in
resources.