Skip to main content
When CI passes and review is approved, call 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:write
Never call ship without first verifying that CI has passed, review is approved, and availableActions includes "ship". Calling ship when these conditions are not met returns 409. Passing an incorrect expectedHeadSha also returns 409.

Path parameters

string
required
Stable task ID. Must match the pattern tsk_[A-Za-z0-9]+.

Headers

string
required
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

string
required
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_deploy
string
required
Deployment target. Use production for production deploys or staging for staging.Allowed values: staging, production
string
required
The 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

A 202 response means the ship operation was accepted and queued.
object
required
Ship operation record.
string[]
required
Top-level available actions.

Example response

Preconditions checklist

All of the following must be true before AgentRail accepts a ship request:

Error responses

If you receive 409 because of a SHA mismatch, re-read the task with GET /tasks/:id to get the updated headSha, then retry with a new Idempotency-Key that encodes the new SHA.