Apply

Rehearse an apply plan on a contained branch

Upgrades the source plan to reviewed_plan mode, rejects stale fingerprints before allocating a branch, snapshots the source project, creates a contained data branch, applies the candidate, and returns a dated rehearsal certificate. Passing reports include an exact bound commit call with required_plan; commits re-derive current facts and fail closed on drift. CI sessions are rejected in v1. The plan's bytes must already be uploaded: an unmet missing_content is refused 409 REHEARSAL_CONTENT_MISSING (with details.missing_content and an upload_content next action) before any snapshot or branch is spent; a project with no live release rehearses on an empty branch. The rehearsal runs on the gateway, detached from the request: with Prefer: respond-async the call answers 202 at once with the operation (report: null, a poll next action, header Preference-Applied: respond-async) and the report appears as rehearsal_report on GET /apply/v1/operations/{operation_id} once the operation is ready or failed; without it the 202 carries the report. A rehearsal whose gateway task stops before it finishes ends failed with a retryable OPERATION_INTERRUPTED naming the branch it left (details.branch_project_id).

post/apply/v1/plans/{plan_id}/rehearse

Request

  • Base URL: https://api.run402.com
  • URL: https://api.run402.com/apply/v1/plans/{plan_id}/rehearse
  • Auth: one of:
    • API key in header SIGN-IN-WITH-X
    • HTTP bearer
    • HTTP bearer

Path parameters

plan_idstring required

Apply plan id returned by POST /apply/v1/plans.

Headers

Preferstring
Example:respond-async

respond-async answers 202 as soon as the rehearsal's operation exists (RehearsePlanAccepted) instead of waiting for its report.

SIGN-IN-WITH-Xstring required

SIWX auth header — base64-encoded JSON payload containing a signed CAIP-122 (EIP-4361) message. See https://docs.x402.org/extensions/sign-in-with-x.

Request body

teardown'keep' | 'on_pass' | 'always'

on_pass (default): purge a passed rehearsal's branch, keep a failed one 7 days. keep: always keep. always: always purge. A new rehearsal first discards the project's earlier failed rehearsal branches unless their TTL was renewed.

Response

With Prefer: respond-async: the rehearsal is running (RehearsePlanAccepted); poll the operation for its rehearsal_report. Without it: the rehearsal completed or failed with a report (RehearsePlanResponse). A failed report is still a successful HTTP response unless the orchestration itself failed.

OR

Example response

{
  "report": {
    "source_project_id": "prj_1741340000_0042",
    "next_actions": [
      {
        "method": "POST",
        "path": "/tiers/v1/hobby",
        "auth": "x402"
      }
    ]
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.