Skip to content

Generate a guide

Generate a guide for a pull request's or hosted branch's current head

POST /api/v1/repositories/{repository}/changesets/{kind}/{ref}/runs

Personal token · runs:write

Starts a run that generates a guide for what GitHub has now, against the run allowance. Send an Idempotency-Key: a retry with the same key and body returns the same run and spends nothing more, and a different body under that key is a conflict. Local branches cannot start here, since Theseus cannot see unpushed commits: run theseus generate in the checkout.

Example request

Link to this section
Shell
# Set your token and resource IDs first.
API_BASE_URL="https://app.theseus.dev/api/v1"

curl --fail-with-body --request POST \
  -H "Authorization: Bearer ${THESEUS_API_TOKEN:?}" \
  -H "Idempotency-Key: ${IDEMPOTENCY_KEY:?}" \
  -H "Content-Type: application/json" \
  --data '{}' \
  "${API_BASE_URL}/repositories/${REPOSITORY_ID:?}/changesets/pr/42/runs"
NameInTypeDescription
repository requiredpathstringThe repository's rep_ ID
kind requiredpathstring

One of pr, branch, local

ref requiredpathstringThe PR number, or the branch name with / encoded as %2F. A local branch is always your own

Minimum length 1

idempotency-key requiredheaderstringUp to 255 printable ASCII characters, such as a UUID, new for each run you mean to start

Pattern ^[\x21-\x7e]{1,255}$

Content type application/json

RunRequest

Nothing yet; send {} or no body

The run, new or started earlier under this key

Response fields

Content type application/json

  • id string required

    Example run_01ARZ3NDEKTSV4RRFFQ69G5FAV

  • status string required

    New statuses may be added; tolerate one you do not know

    One of queued, running, succeeded, failed

  • error string or null required

  • changeset_id string or null required

  • guide_id string or null required

    The guide the run generates, once it has been accepted

  • created_at string required

  • finished_at string or null required

Example responses

Link to this section

Run accepted

Illustrative response · complete

{
  "id": "run_EXAMPLE",
  "status": "queued",
  "error": null,
  "changeset_id": "set_EXAMPLE",
  "guide_id": null,
  "created_at": "2026-10-08T12:00:00Z",
  "finished_at": null
}
400 · The request is not valid

Error response fields

401 · A valid bearer token is required

Error response fields

402 · The workspace's plan does not include this

Error response fields

403 · The credential's scopes do not allow this

Error response fields

404 · Not found

Error response fields

409 · The request conflicts with the resource as it is

Error response fields

426 · Upgrade the CLI: run theseus update

Error response fields

429 · Too many requests

Headers

  • Retry-After integer

    Seconds to wait before the next request, when known

Error response fields

503 · Theseus is unavailable; retry the same request

Headers

  • Retry-After integer

    Seconds to wait before the next request, when known

Error response fields

Error response fields

Content type application/problem+json

  • type string (uri) required

    Identifies the problem type; branch on code instead

  • title string required

  • status integer required

  • detail string

  • code string required

    Why the request failed. New codes may be added: treat an unknown one by its status

    One of invalid_request, unauthenticated, not_in_plan, insufficient_scope, admission_required, not_found, ambiguous, conflict, rate_limited, internal_error, unavailable, search_authorization_pending, search_unavailable, cli_upgrade_required

  • request_id string required

    Quote this when reporting the problem

  • errors array of FieldError

    With invalid_request: what is wrong with each field

    errors fields
    • path string required

      Where in the request, as dotted segments

    • message string required

  • required_scope string

    With insufficient_scope: the scope the operation needs

  • next string

    Recovery action, such as theseus update

  • candidates array of Candidate

    With ambiguous: what the request could mean; ask which

    candidates fields
    • id string required

    • path string required

    • kind string required

    • title string required

    • url string (uri) required