Skip to main content
POST
Set GitHub Webhook
string
required
The API key for your account. You can find this in your account settings.
Requires an API key with the apps:deploy scope. This endpoint connects an application to a GitHub repository the classic way: generate a personal access token (ghp_* or the fine-grained github_pat_* format) and Square Cloud returns a unique webhook URL to register on that repository so pushes trigger a deploy. Sending access_token: "@" instead removes the existing webhook and access token from the application. Configuring or removing a webhook invalidates the cached response from Get Current Deployment. Calls are rate limited to 5 per 60 seconds per user, and on workspace-shared applications the caller needs the admin role or ownership. To review deploy attempts triggered by this webhook, use List Deployments. A webhook and a GitHub App link can be configured on the same application at the same time: setting up one does not remove the other.

Parameters

string
required
The ID of the application. You can find this in the URL of your application’s dashboard.
string
required
The access token for your GitHub repository. You can find this in your GitHub Tokens Classic

Response

string
Indicates whether the call was successful: success if it was, error if not.
object
The contents of the response.

Common errors

Webhook deliveries

GitHub sends each push to the webhook URL (POST https://api.squarecloud.app/v2/git/webhook/{webhook}). The reply is plain text (text/plain) that says whether a deploy was queued, so the Recent Deliveries list of the webhook on GitHub shows what happened to each push. Only the 429 replies with JSON (KEEP_CALM). A 200 is sent only after the deploy was stored in the queue:
Every other reply ends with Nothing was deployed.
If a delivery shows 503, redeliver it on GitHub in Settings > Webhooks > Recent Deliveries, or push again.