/ api reference
Deployments
A deployment is one build of a project's source in an environment. It's queued while it waits for a build slot, pending while it builds, then success or failed. A successful one becomes the environment's current deployment; a rollback restores an earlier one.
- get/deploymentsList deployments
- get/deployments/{deploymentId}Get a deployment
- get/deployments/{deploymentId}/stepsGet a deployment's build steps
- get/deployments/{deploymentId}/streamStream a deployment's build
- get/environments/{environmentId}/deploymentsList an environment's deployments
- post/deployments/{deploymentId}/cancelCancel a queued deployment
- post/deployments/{deploymentId}/redeployRedeploy
- patch/environments/{environmentId}/active-deploymentRoll back
- post/environments/{environmentId}/deploymentsCreate a deployment
List deployments
/api/v1/deploymentsEvery deployment in the workspace, most recent first, each with its project's and environment's names.
Requires Viewer key or above (workspace.read)
Responses
200The deployments.Response fields
idstringrequiredenvironmentIdstringrequiredworkerScriptRefstring | nullrequiredassetsManifestRefstring | nullrequiredstatus"queued" | "pending" | "success" | "failed"requiredtriggerSource"cli" | "upload"requiredtriggeredByUserIdstringrequiredgitShastring | nullrequiredgitRefstring | nullrequiredframework"rasengan" | "futon" | "hono" | "vite" | "static" | nullrequiredcommitMessagestring | nullrequiredcommitAuthorstring | nullrequiredrepoUrlstring | nullrequireddeployedUrlstring | nullrequirederrorstring | nullrequiredcreatedAtstringrequiredfinishedAtstring | nullrequireddispatchStatus"not_applicable" | "pending" | "live" | "error"requireddispatchErrorstring | nullrequiredpublishStartedAtstring | nullrequiredpublishPlannedbooleanbuildMachine"standard-1" | "standard-2" | "standard-3" | "standard-4" | nullrequiredstartedAtstring | nullrequiredqueuePositioninteger | nullqueueReason"plan_limit" | "capacity" | nullrequiredprojectIdstringrequiredprojectNamestringrequiredprojectSlugstringrequiredenvironmentNamestringrequired
401No valid API key.
Get a deployment
/api/v1/deployments/{deploymentId}status is the build's (queued, pending, success, failed, with error set on failure); dispatchStatus is the publish's: live once the deployment serves traffic at deployedUrl.
Requires Viewer key or above (workspace.read)
Parameters
deploymentIdstringin pathrequired
Responses
200The deployment.Response fields
idstringrequiredenvironmentIdstringrequiredworkerScriptRefstring | nullrequiredassetsManifestRefstring | nullrequiredstatus"queued" | "pending" | "success" | "failed"requiredtriggerSource"cli" | "upload"requiredtriggeredByUserIdstringrequiredgitShastring | nullrequiredgitRefstring | nullrequiredframework"rasengan" | "futon" | "hono" | "vite" | "static" | nullrequiredcommitMessagestring | nullrequiredcommitAuthorstring | nullrequiredrepoUrlstring | nullrequireddeployedUrlstring | nullrequirederrorstring | nullrequiredcreatedAtstringrequiredfinishedAtstring | nullrequireddispatchStatus"not_applicable" | "pending" | "live" | "error"requireddispatchErrorstring | nullrequiredpublishStartedAtstring | nullrequiredpublishPlannedbooleanbuildMachine"standard-1" | "standard-2" | "standard-3" | "standard-4" | nullrequiredstartedAtstring | nullrequiredqueuePositioninteger | nullqueueReason"plan_limit" | "capacity" | nullrequired
404No such deployment in this workspace.
Get a deployment's build steps
/api/v1/deployments/{deploymentId}/stepsThe four build steps (preparing, installing, building, packaging) with their status and timing: the same data the stream sends, for a client that polls instead.
Requires Viewer key or above (workspace.read)
Parameters
deploymentIdstringin pathrequired
Responses
200The steps, in order.Response fields
idstringrequireddeploymentIdstringrequiredstep"preparing" | "installing" | "building" | "packaging"requiredstatus"pending" | "running" | "success" | "failed"requiredstartedAtstring | nullrequiredfinishedAtstring | nullrequired
404No such deployment in this workspace.
Stream a deployment's build
/api/v1/deployments/{deploymentId}/streamA Server-Sent Events stream (text/event-stream). While the deployment is queued it sends status events with its queuePosition and queueReason (plan_limit: your plan's concurrent builds are all running; capacity: no build machine is free yet). It replays every build step (step) and log line (log) recorded so far, then sends new ones as they happen, and closes after done once the deployment succeeds or fails. Each log event has an id: a connection that sends Last-Event-ID (as EventSource does when it reconnects) gets the steps again but only the log lines after that id. While nothing happens, the stream sends a : keepalive comment every 15 seconds.
Requires Viewer key or above (workspace.read)
Parameters
deploymentIdstringin pathrequired
Responses
200The event stream.404No such deployment in this workspace.
List an environment's deployments
/api/v1/environments/{environmentId}/deploymentsMost recent first.
Requires Viewer key or above (workspace.read)
Parameters
environmentIdstringin pathrequired
Responses
200The environment's deployments.Response fields
idstringrequiredenvironmentIdstringrequiredworkerScriptRefstring | nullrequiredassetsManifestRefstring | nullrequiredstatus"queued" | "pending" | "success" | "failed"requiredtriggerSource"cli" | "upload"requiredtriggeredByUserIdstringrequiredgitShastring | nullrequiredgitRefstring | nullrequiredframework"rasengan" | "futon" | "hono" | "vite" | "static" | nullrequiredcommitMessagestring | nullrequiredcommitAuthorstring | nullrequiredrepoUrlstring | nullrequireddeployedUrlstring | nullrequirederrorstring | nullrequiredcreatedAtstringrequiredfinishedAtstring | nullrequireddispatchStatus"not_applicable" | "pending" | "live" | "error"requireddispatchErrorstring | nullrequiredpublishStartedAtstring | nullrequiredpublishPlannedbooleanbuildMachine"standard-1" | "standard-2" | "standard-3" | "standard-4" | nullrequiredstartedAtstring | nullrequiredqueuePositioninteger | nullqueueReason"plan_limit" | "capacity" | nullrequired
404No such environment in this workspace.
Cancel a queued deployment
/api/v1/deployments/{deploymentId}/cancelOnly a deployment still queued can be cancelled: it becomes failed with error: "canceled". A build that has started runs to its end.
Requires Developer key or above (deployment.create)
Parameters
deploymentIdstringin pathrequired
Responses
200The cancelled deployment.Response fields
idstringrequiredenvironmentIdstringrequiredworkerScriptRefstring | nullrequiredassetsManifestRefstring | nullrequiredstatus"queued" | "pending" | "success" | "failed"requiredtriggerSource"cli" | "upload"requiredtriggeredByUserIdstringrequiredgitShastring | nullrequiredgitRefstring | nullrequiredframework"rasengan" | "futon" | "hono" | "vite" | "static" | nullrequiredcommitMessagestring | nullrequiredcommitAuthorstring | nullrequiredrepoUrlstring | nullrequireddeployedUrlstring | nullrequirederrorstring | nullrequiredcreatedAtstringrequiredfinishedAtstring | nullrequireddispatchStatus"not_applicable" | "pending" | "live" | "error"requireddispatchErrorstring | nullrequiredpublishStartedAtstring | nullrequiredpublishPlannedbooleanbuildMachine"standard-1" | "standard-2" | "standard-3" | "standard-4" | nullrequiredstartedAtstring | nullrequiredqueuePositioninteger | nullqueueReason"plan_limit" | "capacity" | nullrequired
404No such deployment in this workspace.409The deployment is no longer queued: its build started or finished.
Redeploy
/api/v1/deployments/{deploymentId}/redeployBuilds a GitHub-sourced deployment again, as a new deployment in the same environment, from the same commit (gitSha), whatever its branch points to now. To build the branch's latest commit, create a deployment with that ref instead. A deployment from a tarball has no stored source: deploy it again instead.
Requires Developer key or above (deployment.create)
Parameters
deploymentIdstringin pathrequired
Responses
202The new deployment,pendingorqueued.Response fields
idstringrequiredenvironmentIdstringrequiredworkerScriptRefstring | nullrequiredassetsManifestRefstring | nullrequiredstatus"queued" | "pending" | "success" | "failed"requiredtriggerSource"cli" | "upload"requiredtriggeredByUserIdstringrequiredgitShastring | nullrequiredgitRefstring | nullrequiredframework"rasengan" | "futon" | "hono" | "vite" | "static" | nullrequiredcommitMessagestring | nullrequiredcommitAuthorstring | nullrequiredrepoUrlstring | nullrequireddeployedUrlstring | nullrequirederrorstring | nullrequiredcreatedAtstringrequiredfinishedAtstring | nullrequireddispatchStatus"not_applicable" | "pending" | "live" | "error"requireddispatchErrorstring | nullrequiredpublishStartedAtstring | nullrequiredpublishPlannedbooleanbuildMachine"standard-1" | "standard-2" | "standard-3" | "standard-4" | nullrequiredstartedAtstring | nullrequiredqueuePositioninteger | nullqueueReason"plan_limit" | "capacity" | nullrequired
400The deployment predates pinned commits and itsrefno longer exists (code: unknown_ref).402A plan limit refused the build (see Create a deployment).Body: see Errors
404No such deployment in this workspace.409The deployment has no GitHub source to build from.501GitHub builds are not configured on this Hiraiship instance.
Roll back
/api/v1/environments/{environmentId}/active-deploymentMakes an earlier successful deployment of the environment its current one again, without a build. The next deployment that succeeds becomes current as usual. Your plan keeps a limited number of recent successful deployments available for rollback.
Requires Developer key or above (deployment.create)
Parameters
environmentIdstringin pathrequired
Body
deploymentIdstringrequireduuid
Responses
200The environment, with its newactiveDeploymentId.Response fields
idstringrequiredprojectIdstringrequirednamestringrequiredworkerNamestringrequiredactiveDeploymentIdstring | nullrequiredsuspendedReason"inactive" | "hibernated" | nullrequiredsuspendedAtstring | nullrequiredneverHibernatebooleanrequiredvariablesobject[]required2 shapes
One of:
secret: false
keystringrequiredsecretfalserequiredvaluestringrequirednotestring | nullrequiredupdatedAtstringrequired
secret: true
keystringrequiredsecrettruerequirednotestring | nullrequiredupdatedAtstringrequired
createdAtstringrequired
402The environment is paused and every live environment your plan includes is in use (quota: active_environments).Body: see Errors
404No such environment in this workspace, or the deployment is not one of its own.409The deployment did not succeed, or is older than what your plan keeps for rollback.
Create a deployment
/api/v1/environments/{environmentId}/deploymentsBuilds and deploys your source to the environment. Send the source as sourceTarballBase64, a gzipped tar of the project directory, base64-encoded (a single top-level directory is unwrapped); this is what hiraiship deploy does. Or send installationId/owner/repo/ref to build a GitHub repository the workspace's GitHub App can read: ref (a branch, tag or commit) is resolved to its commit when you call, and that commit is what gets built, recorded as gitSha with its message and author. installCommand, buildCommand, outputDir and machine override the project's build settings for this deployment only. The build runs asynchronously: follow it with the stream or the steps route. status is pending while it builds, queued while it waits for a free build slot or a free build machine (queueReason says which), then success or failed; on success it becomes the environment's current deployment. The body is at most 40 MB.
Requires Developer key or above (deployment.create)
Parameters
environmentIdstringin pathrequired
Body
One of:
with sourceTarballBase64
sourceTarballBase64stringrequiredtriggerSource"cli" | "upload"requiredgitShastringcommitMessagestringrepoUrlstringinstallCommandstringbuildCommandstringoutputDirstringat most 500 characters
machine"standard-1" | "standard-2" | "standard-3" | "standard-4"
triggerSource: "cli"
installationIdstringrequiredownerstringrequiredrepostringrequiredrefstringrequiredtriggerSource"cli"requiredinstallCommandstringbuildCommandstringoutputDirstringat most 500 characters
machine"standard-1" | "standard-2" | "standard-3" | "standard-4"
Responses
202The build was accepted. The deployment ispending, orqueuedwith itsqueuePositionandqueueReason.Response fields
idstringrequiredenvironmentIdstringrequiredworkerScriptRefstring | nullrequiredassetsManifestRefstring | nullrequiredstatus"queued" | "pending" | "success" | "failed"requiredtriggerSource"cli" | "upload"requiredtriggeredByUserIdstringrequiredgitShastring | nullrequiredgitRefstring | nullrequiredframework"rasengan" | "futon" | "hono" | "vite" | "static" | nullrequiredcommitMessagestring | nullrequiredcommitAuthorstring | nullrequiredrepoUrlstring | nullrequireddeployedUrlstring | nullrequirederrorstring | nullrequiredcreatedAtstringrequiredfinishedAtstring | nullrequireddispatchStatus"not_applicable" | "pending" | "live" | "error"requireddispatchErrorstring | nullrequiredpublishStartedAtstring | nullrequiredpublishPlannedbooleanbuildMachine"standard-1" | "standard-2" | "standard-3" | "standard-4" | nullrequiredstartedAtstring | nullrequiredqueuePositioninteger | nullqueueReason"plan_limit" | "capacity" | nullrequired
400The body matches none of the shapes, or mixes fields from several; or (GitHub source) the repository has no suchref(code: unknown_ref).402A plan limit refused the build: build minutes, live environments, a full build queue (queued_builds), a build machine your plan doesn't allow (build_machine), or the spend limit.Body: see Errors
403The project was disabled by Hiraiship (code: project_disabled).404No such environment in this workspace, or (GitHub source) no such installation.413The body is larger than 40 MB (code: payload_too_large).501(GitHub source) GitHub builds are not configured on this Hiraiship instance.