sessions module route (requires sessions:run:admin)
POST
/v1/m/sessions/runs/{ref}/cleanup
const url = 'https://example.com/v1/m/sessions/runs/example/cleanup';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"discard_worktree":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 https://example.com/v1/m/sessions/runs/example/cleanup \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "discard_worktree": true }'Cleans up the resources of one finished session run.
Authorizations
Section titled “ Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “ Path Parameters ” ref
required
string
Path parameter ref.
Header Parameters
Section titled “ Header Parameters ” X-Olivares-Tenant
string format: uuid
Target tenant id; required when the principal can act in more than one tenant.
Request Body
Section titled “ Request Body ” Media type application/json
object
discard_worktree
Any of:
Confirms that the session’s git worktree and branch may be removed although the branch is not merged, the worktree has uncommitted files or its HEAD is off the branch, and lets the release go on, leaving the worktree where it is, when this node cannot reach it. Absent, null or false removes them only when the branch is merged and the worktree is clean.
boolean
null
Example generated
{ "discard_worktree": true}Responses
Section titled “ Responses ”OK
Media type application/json
object
Example generated
{}Bad request
Media type application/json
object
Example generated
{}Unauthenticated
Media type application/json
object
Example generated
{}Forbidden
Media type application/json
object
Example generated
{}Not found
Media type application/json
object
Example generated
{}Conflict / setup required
Media type application/json
object
Example generated
{}Rate limited
Media type application/json
object
Example generated
{}