> ## Documentation Index
> Fetch the complete documentation index at: https://docs.squarecloud.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Set GitHub Webhook

> Integrate Square Cloud with GitHub webhooks.

<ParamField header="Authorization" type="string" placeholder="API Key" required>
  The API key for your account. You can find this in your [account settings](https://squarecloud.app/en/account/security).
</ParamField>

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](/en/api-reference/endpoint/apps/deploy/info). Calls are rate limited to 5 per 60 seconds per user, and on workspace-shared applications the caller needs the Administrator role or ownership. To review deploy attempts triggered by this webhook, use [List Deployments](/en/api-reference/endpoint/apps/deploy/list).

### Parameters

<ParamField path="app_id" type="string" placeholder="Application ID" required>
  The ID of the application. You can find this in the URL of your application's dashboard.
</ParamField>

<ParamField body="access_token" type="string" placeholder="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" required>
  The access token for your GitHub repository. You can find this in your [GitHub Tokens Classic](https://github.com/settings/tokens/new)
</ParamField>

### Response

<ResponseField name="status" type="string">
  Indicates whether the call was successful.. `success` if successful, `error` if not.
</ResponseField>

<ResponseField name="response" type="object">
  The contents of the response.

  <Expandable title="Toggle object">
    <ResponseField name="webhook" type="string">
      The URL of the webhook.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseExample>
  ```json theme={null}
  {
      "status": "success",
      "response": {
          "webhook": "https://api.squarecloud.app/v2/git/webhook/<webhook-code>"
      }
  }
  ```
</ResponseExample>

### Common errors

| Code                   | HTTP | Meaning                                                                                     |
| ---------------------- | ---- | ------------------------------------------------------------------------------------------- |
| `INVALID_ACCESS_TOKEN` | 400  | `access_token` is not `@` and doesn't match the `ghp_*`/`github_pat_*` GitHub token format. |
