API Reference for Runbooks
This reference page describes the usage of REST API for Runbooks. Get instructions on how to create a runbook, check its status, and more.
This document describes the usage of REST API for Runbooks. You can also use GraphQL API for composite queries.
Create a Runbook
POST /api/v1/runbook
This creates a new Runbook and triggers its execution asynchronously. The runbook is created using the provided prompt and repository, and the response includes the runbook number and a URL to track its progress.
Headers
Content-Type
application/json
Authorization
Bearer <token>
Body
repository
Object
Repository to run the runbook against. Must contain org (GitHub organization name) and name (repository name).
prompt
String
Task description for the runbook.
title
String. Optional
Title for the runbook. If not provided, a title will be auto-generated.
draft
Boolean. Optional
Whether to create pull requests as drafts. If not provided, defaults to the project configuration.
pr_mode
String. Optional
PR creation mode. Possible values: manual, single_pr, stacked_pr. If not provided, defaults to the project configuration.
target_branch
String. Optional
Base branch for the runbook. If not provided, defaults to the repository's default branch.
description
String. Optional
Text to prepend to the body of the first pull request opened by the runbook. Persisted on the runbook so subsequent body refreshes keep the prefix.
labels
Array of strings. Optional
Labels applied to every pull request opened by the runbook. Persisted on the runbook (de-duplicated, order preserved) and re-applied on each PR.
author_email
String. Optional
Email of the user to attribute the runbook to. Must resolve to a user in this account; otherwise the request returns 400. Defaults to the user associated with the API token.
Request body example
Response
If successful, HTTP 202 response is returned back since the runbook runs asynchronously. The response uses the same schema as the Get Runbook Status endpoint. At creation time, step counts are all zero and pull_requests is empty.
Update a Runbook
PATCH /api/v1/runbook/<runbook_number>
Append a new prompt to an existing Runbook and optionally update the PR description and labels. The new prompt is delivered as a follow-up chat message to the runbook's agent loop, which resumes execution and pushes additional commits to the same pull request branch.
Description and label updates are persisted on the runbook and applied to its pull request after the agent's next commit. If the runbook has not opened a PR yet at the time of the call, the overrides still apply to the first PR it opens.
Headers
Content-Type
application/json
Authorization
Bearer <token>
Parameters
runbook_number
The number identifying the runbook.
Body
prompt
String
Follow-up prompt for the runbook. Delivered to the agent as a new user chat message; the agent resumes and pushes additional commits to the existing PR branch.
description
String. Optional
Replaces the previously stored PR body prefix. If omitted, the existing prefix is preserved.
labels
Array of strings. Optional
Labels to add to the runbook's pull request. Merged with previously stored labels (de-duplicated, order preserved); existing labels are not removed.
Request body example
Response
If successful, HTTP 202 response is returned back since the additional work runs asynchronously. The response uses the same schema as the Get Runbook Status endpoint and reflects the runbook's current state at the moment of the call (step counts and pull requests from work that's already been done).
Get Runbook Status
GET /api/v1/runbook/<runbook_number>
Retrieve the current status of a Runbook by its number. The response includes the aggregate status, step counts, and any associated pull requests.
Headers
Authorization
Bearer <token>
Parameters
runbook_number
The number identifying the runbook.
Response
If successful, HTTP 200 response is returned back.
Response schema
The Create, Update, and Get endpoints all return the same response schema.
runbook_number
Integer
The unique number identifying the runbook.
url
String
URL to view the runbook in the Aviator dashboard.
steps
Object
Breakdown of step counts by status. Only counts leaf steps (actual execution units).
steps.total
Integer
Total number of leaf steps.
steps.not_started
Integer
Steps that have not started.
steps.in_progress
Integer
Steps currently executing.
steps.completed
Integer
Steps that completed successfully.
steps.failed
Integer
Steps that failed.
steps.queued
Integer
Steps queued for execution.
pull_requests
Array
Pull requests created by the runbook, deduplicated by PR number.
pull_requests[].number
Integer
GitHub pull request number.
pull_requests[].url
String
URL of the GitHub pull request.
pull_requests[].step_numbers
Array
List of step numbers (e.g., "1.1", "2.3") associated with this pull request.
Status values
The status field is computed from leaf step statuses at query time.
generating_steps
No steps exist yet (the runbook is still generating its execution plan).
not_started
All steps are not_started.
in_progress
At least one step is in_progress.
partially_completed
Mix of completed/queued and not_started steps, with none in-progress or failed.
failed
At least one step has failed and none are in_progress.
completed
All steps are completed.
Last updated
Was this helpful?
