Automation

Create a deploy hook: POST its url (returned once) to deploy the given branch

Without branch (or with the production branch) the hook follows the production branch and redeploys production. Any other branch is deployed as that branch's preview (docs/PREVIEWS.md): the first call creates it within the preview limits, later calls redeploy it. A call to the url (POST /hooks/deploy/{hookId}/{secret}, no auth) answers {ok, target, branch, deploymentId, previewId?, previewUrl?}, or the preview error (402 limit_reached, 429 rate_limited, 501 not_configured) when the preview cannot be created.

post/projects/{projectId}/hooks

Request

  • Base URL: https://hostingsurge.com/api/v1
  • URL: https://hostingsurge.com/api/v1/projects/{projectId}/hooks
  • Auth: one of:
    • HTTP bearer
    • API key in cookie __Host-hs_session

Path parameters

projectIdstring uuid required
Example:3f2b8a4e-5c1d-4e8f-9a7b-2c6d1e0f4a5b

Request body

namestring required
branchstring

Default: the production branch (the hook follows it). Any other branch is deployed as that branch's preview (Git-backed or managed projects only; needs deployments:create as well)

Response

Created (url shown once)

idstring uuid required
namestring required
branchstring nullable required

null = the project's production branch (the hook follows it when it changes); otherwise the branch this hook deploys

target'production' | 'preview' required

What a call does now: "production" redeploys the production branch; "preview" creates or updates the preview of branch (a separate environment at <branch>--<project>.<app domain>, preview limits apply). Decided at call time: a hook whose branch has since become the production branch deploys production.

lastTriggeredAtstring nullable required

ISO-8601 timestamp

createdAtstring required

ISO-8601 timestamp

urlstring required

POST this URL to trigger a deployment. Shown once: it contains the secret and cannot be shown again — create a new hook if you lose it.

Changes

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