When CI passes and review is approved, callDocumentation Index
Fetch the complete documentation index at: https://agentrail.app/docs/llms.txt
Use this file to discover all available pages before exploring further.
POST /tasks/:id/ship to merge the PR and deploy the changes. AgentRail validates all preconditions before accepting the request. You must supply expectedHeadSha to prevent accidental merges if the branch has advanced since you last read the task. Always gate this call on availableActions.includes("ship") — if "ship" is not in the list, the task is not ready.
Required scope:
ship:writePath parameters
Stable task ID. Must match the pattern
tsk_[A-Za-z0-9]+.Headers
Unique key for safe retries. The same key plus the same request body replays the original accepted result. The same key with a different body returns
409 conflict. Use a key that encodes the task ID and head SHA, for example ship-tsk_abc123-b5bc7f8. Must be 8–128 characters.Request body
Ship mode. Use
merge_and_deploy to merge the PR and trigger deployment. Use merge_only to merge without deploying.Allowed values: merge_only, merge_and_deployDeployment target. Use
production for production deploys or staging for staging.Allowed values: staging, productionThe full 40-character commit SHA you expect to be at the head of the task branch. AgentRail rejects the request with
409 if the actual head SHA differs, preventing accidental merges after a late commit. Read this value from data.headSha on the task, or from the CI status or review feedback responses.Example
Response
A202 response means the ship operation was accepted and queued.
Ship operation record.
Top-level available actions.
Example response
Preconditions checklist
All of the following must be true before AgentRail accepts a ship request:| Condition | How to verify |
|---|---|
"ship" is in availableActions | Read the task with GET /tasks/:id |
| CI has passed | GET /tasks/:id/ci-status returns overallStatus: "passed" |
| Review is approved | GET /tasks/:id/review-feedback returns latestDecision.outcome: "approved" |
expectedHeadSha matches the current head | Use headSha from the task, CI status, or review feedback response |
Error responses
| Status | Code | Meaning |
|---|---|---|
400 | validation_error | expectedHeadSha is not a valid 40-character hex SHA. |
401 | unauthorized | Bearer token is missing or invalid. |
403 | insufficient_scope | Key does not have ship:write. |
404 | not_found | Task not found, or no live adapter matches the task. |
409 | conflict | CI is not green, review is not approved, the task is not in a shippable state, the head SHA does not match, or the Idempotency-Key was reused with a different body. |
.png?fit=max&auto=format&n=TNCV8lxzL1ij3U4N&q=85&s=7345b71aa1c450c74f35b67c2655fc43)