Skip to main content
POST
Launch coding session on an imported app

Authorizations

Authorization
string
header
required

Personal access token, sent as Authorization: Bearer <token>. Each operation lists the permission it needs: read_only or full_access. A full-access token can call every operation. A read-only token can call only the operations that list read_only; anything else returns 403 read_only_credential_route_not_allowed.

Headers

Idempotency-Key
string
required

A unique key for this task. Reuse it with the same runtime inputs on retries; you may omit the previously associated client_reference.

Required string length: 1 - 200
Pattern: ^[A-Za-z0-9_.:-]+$
Example:

"flag-cleanup-123"

Path Parameters

app_id
string
required

Body

application/json
prompt
string
required

The coding task to carry out. The agent opens a pull request when the task asks for a change.

Required string length: 1 - 99618
Example:

"Remove the retired example-feature flag, preserving its enabled behavior."

title
string
required

A short name for the session.

Required string length: 1 - 200
Example:

"Remove example-feature"

existing_branch
string | null

An existing repository branch to work on, or null to create an isolated branch.

Required string length: 1 - 255
Example:

"feature/review-fixes"

source_ref
string | null

An existing repository branch a new branch starts from, or null for the imported base branch. Commit SHAs and tags are refused with source_ref_not_found.

Required string length: 1 - 255
Example:

"main"

pull_request_body
string | null

Additional Markdown to include in the pull request description, or null.

Maximum string length: 20000
Example:

"Requested by the release workflow."

commit_message
string | null

An optional message for this session's commits, including any required trailers, or null for a generated message.

Required string length: 1 - 2000
Example:

"fix: remove the retired flag"

file_urls
string[] | null

Images for the agent to see alongside the text: URLs of files uploaded to this app, or null.

Required array length: 1 - 10 elements
client_reference
string | null

An opaque reference used by your application to reconcile sessions, or null.

Required string length: 1 - 200
Pattern: ^[A-Za-z0-9_.:-]+$
Example:

"release-task-123"

expected_repository_full_name
string | null

The repository you expect this app to be connected to, or null to use its current connection. A mismatch refuses the launch before starting work.

Maximum string length: 201
Pattern: ^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$
Example:

"acme/project"

Response

Successful Response

id
string
required

The session's opaque identifier.

Example:

"6820f3a4e7b91d003c45a1f2"

created_by_user_id
string
required

The ID of the user who launched the session. A session launched with a workspace API key reports the key's owner.

Example:

"6820f3a4e7b91d003c45a1f4"

state
enum<string>
required

The session's state: queued, running, opening_pull_request, needs_input, completed, failed, cancelling, or cancelled.

Available options:
queued,
running,
opening_pull_request,
needs_input,
completed,
failed,
cancelling,
cancelled
Example:

"running"

message_id
string | null
required

The UUID of the session's user message, or null before dispatch. Queued processing updates it to the UUID used for the turn.

Example:

"ca00e880-1111-4444-aaaa-ccddeeff0011"

repository_full_name
string
required

The connected repository the session runs in.

Example:

"acme/project"

branch_id
string | null
required

The session's Base Code branch identifier, or null before provisioning.

Example:

"6820f3a4e7b91d003c45a1f3"

branch_name
string | null
required

The session's working Git branch, or null before provisioning.

Example:

"base-code/fix-login-redirect-45a1f2"

session_url
string | null
required

The Base Code editor URL for inspecting the session or answering pending questions, or null until its branch is provisioned.

Example:

"https://app.base44.com/apps/6820f3a4e7b91d003c45a1f2/editor/preview"

pull_request
SessionPullRequest · object | null
required

The session's pull request, or null until one is opened.

Example:
error_code
string | null
required

The stable failure cause, or null if there is no failure.

Example:

"execution_failed"

launch_key
string | null

The original Idempotency-Key, or null for sessions created before key recovery was recorded. Use the same principal and key to retry a queued launch.

Example:

"flag-cleanup-123"

client_reference
string | null

Your application reconciliation reference, or null.

Example:

"release-task-123"

input_request_id
string | null

Opaque identifier of the current question or approval pause, or null when the session is not waiting for input or the pause predates identifier tracking. Use it to deduplicate notifications for repeated input requests. To answer, use the input_request_id from Get a coding session's open question.

Example:

"ca00e880-1111-4444-aaaa-ccddeeff0011"

error_reason
string | null

A short, human-readable explanation of error_code and what to do next, or null if there is no failure.

Example:

"The branch's sandbox ran out of disk space. Crash dumps were removed; send the message again."

outcome
enum<string> | null

How a completed session ended: pull_request when it opened or updated a pull request, answer when it ended without one and replied instead; has_unpublished_changes says whether that branch still changes files. null until the session completes.

Available options:
pull_request,
answer
Example:

"pull_request"

summary
string | null

The session's final reply in Markdown, up to 10,000 characters: the answer for an answer outcome, the change summary for a pull_request outcome. null until the session publishes.

Example:

"Removed the retired flag and kept the enabled behavior."

has_unpublished_changes
boolean
default:false

true when an answer session's branch changes files that no pull request carries yet: send a message asking for one to have the agent open it. false otherwise.

Example:

false

push_failed
boolean
default:false

true when a pull_request session's last changes did not reach the pull request's branch on GitHub because the push failed; summary then starts with a warning that says where the work is. false otherwise.

Example:

false