Switch the caller's worktree to another branch (or create one)
POST
/api/workspaces/{workspaceId}/apps/{id}/checkout
const url = 'http://localhost:8080/api/workspaces/example/apps/example/checkout';const options = { method: 'POST', headers: {cookie: 'auth_session=<auth_session>', 'Content-Type': 'application/json'}, body: '{"branch":"example","create":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:8080/api/workspaces/example/apps/example/checkout \ --header 'Content-Type: application/json' \ --cookie auth_session=<auth_session> \ --data '{ "branch": "example", "create": true }'The same thing git checkout (or git checkout -b with create) in the terminal does, offered as a button — and it goes through the sandbox, so both agree afterwards. Refuses with uncommitted work rather than choosing between carrying it across and discarding it.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”workspaceId
required
string
id
required
string
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
branch
required
string
create
boolean
Example generated
{ "branch": "example", "create": true}Responses
Section titled “Responses”Successful response
Media typeapplication/json
object
success
Whether the request succeeded.
boolean
data
Endpoint-specific response payload.
message
string
error
string
Example
{ "message": "Operation completed", "error": "Error message"}Invalid request
Media typeapplication/json
object
success
boolean
error
string
Example
{ "error": "Error message"}Internal server error
Media typeapplication/json
object
success
boolean
error
string
Example
{ "error": "Error message"}