curl -X POST "https://app.runtm.com/api/v0/sessions/86e11104-.../git" \
-H "Authorization: Bearer runtm_xxx" \
-H "Content-Type: application/json" \
-d '{
"operation": "create_branch_and_pr",
"working_dir": "/home/user/project",
"pr_title": "Add /health endpoint",
"pr_body": "Adds a simple health check endpoint that returns 200."
}'
import requests
response = requests.post(
"https://app.runtm.com/api/v0/sessions/86e11104-.../git",
headers={"Authorization": "Bearer runtm_xxx"},
json={
"operation": "create_branch_and_pr",
"working_dir": "/home/user/project",
"pr_title": "Add /health endpoint",
"pr_body": "Adds a simple health check endpoint.",
},
)
result = response.json()
if result["success"]:
print(f"PR opened: {result['pr_url']}")
else:
print(f"Failed: {result['error']}")
{
"success": true,
"operation": "create_branch_and_pr",
"output": "Created branch agent/86e11104 and pushed",
"current_branch": "agent/86e11104",
"default_branch": "main",
"repo_full_name": "acme/billing",
"repo_url": "https://github.com/acme/billing",
"created_branch": "agent/86e11104",
"pr_url": "https://github.com/acme/billing/pull/42",
"pr_number": 42
}
Git Operation (v0)
Run a git operation inside the sandbox (commit, push, create PR, etc.)
POST
/
api
/
v0
/
sessions
/
{session_id}
/
git
curl -X POST "https://app.runtm.com/api/v0/sessions/86e11104-.../git" \
-H "Authorization: Bearer runtm_xxx" \
-H "Content-Type: application/json" \
-d '{
"operation": "create_branch_and_pr",
"working_dir": "/home/user/project",
"pr_title": "Add /health endpoint",
"pr_body": "Adds a simple health check endpoint that returns 200."
}'
import requests
response = requests.post(
"https://app.runtm.com/api/v0/sessions/86e11104-.../git",
headers={"Authorization": "Bearer runtm_xxx"},
json={
"operation": "create_branch_and_pr",
"working_dir": "/home/user/project",
"pr_title": "Add /health endpoint",
"pr_body": "Adds a simple health check endpoint.",
},
)
result = response.json()
if result["success"]:
print(f"PR opened: {result['pr_url']}")
else:
print(f"Failed: {result['error']}")
{
"success": true,
"operation": "create_branch_and_pr",
"output": "Created branch agent/86e11104 and pushed",
"current_branch": "agent/86e11104",
"default_branch": "main",
"repo_full_name": "acme/billing",
"repo_url": "https://github.com/acme/billing",
"created_branch": "agent/86e11104",
"pr_url": "https://github.com/acme/billing/pull/42",
"pr_number": 42
}
Executes a git operation inside the sandbox’s workspace - typically used by background agents to push their work and open a pull request after completing a task.
The session must be in
running state.
Required scope: sessions:write
Path Parameters
Headers
Body
One of:
status, commit, push, pull, sync, create_branch, switch_branch, list_branches, create_pr, create_branch_and_pr, init_repo.Response
Status-specific fields populated when relevant:curl -X POST "https://app.runtm.com/api/v0/sessions/86e11104-.../git" \
-H "Authorization: Bearer runtm_xxx" \
-H "Content-Type: application/json" \
-d '{
"operation": "create_branch_and_pr",
"working_dir": "/home/user/project",
"pr_title": "Add /health endpoint",
"pr_body": "Adds a simple health check endpoint that returns 200."
}'
import requests
response = requests.post(
"https://app.runtm.com/api/v0/sessions/86e11104-.../git",
headers={"Authorization": "Bearer runtm_xxx"},
json={
"operation": "create_branch_and_pr",
"working_dir": "/home/user/project",
"pr_title": "Add /health endpoint",
"pr_body": "Adds a simple health check endpoint.",
},
)
result = response.json()
if result["success"]:
print(f"PR opened: {result['pr_url']}")
else:
print(f"Failed: {result['error']}")
{
"success": true,
"operation": "create_branch_and_pr",
"output": "Created branch agent/86e11104 and pushed",
"current_branch": "agent/86e11104",
"default_branch": "main",
"repo_full_name": "acme/billing",
"repo_url": "https://github.com/acme/billing",
"created_branch": "agent/86e11104",
"pr_url": "https://github.com/acme/billing/pull/42",
"pr_number": 42
}