---
title: "Connect git auto-deploy (any provider)"
method: POST
path: "/platform/deployments/custom/{id}/git-webhook/connect"
tags: ["Platform"]
---

# Connect git auto-deploy (any provider)

`POST /platform/deployments/custom/{id}/git-webhook/connect`

## Request

- Base URL: `https://api.imprezahost.com/v1`
- URL: `https://api.imprezahost.com/v1/platform/deployments/custom/{id}/git-webhook/connect`
- Auth: API key in header `X-API-Key` and API key in header `X-API-Secret`

Connects a push webhook so every commit to the watched branch
auto-redeploys (re-clone at the new HEAD → rebuild → restart in
place). Works with any provider against one per-deployment secret.
Two modes, chosen by whether you send a `github_pat`:

**GitHub (one-click)** — send `github_pat`: we validate the token,
mint a fresh per-deployment secret, install the webhook on the repo
via the GitHub API, then **discard the PAT**. The token needs
**Repository → Webhooks: Read and write** scope (and nothing else):
https://github.com/settings/personal-access-tokens/new

**Any other provider (manual)** — omit `github_pat`: we mint the
secret and return `payload_url` + `webhook_token` (shown once, in the
response). Add a push webhook in your repo to `payload_url` and send
the token as the GitLab "Secret token", or as the `X-Impreza-Token`
header / `?token=…` query param (Bitbucket / Gitea / self-hosted /
CI). No provider API is touched in this mode.

On push the receiver authenticates the payload against the secret —
GitHub `X-Hub-Signature-256` HMAC, GitLab `X-Gitlab-Token`, or the
generic shared token. Returns 409 if a webhook is already connected
— disconnect first to reconnect with a fresh secret.

## Path parameters

- `id` string, required

## Request body

- object
  - `github_pat` string: GitHub Fine-grained PAT (`github_pat_...` or `ghp_...`) for the one-click GitHub flow. OMIT for the manual/generic flow (GitLab, Bitbucket, Gitea, self-hosted, CI) — the response then carries a payload_url + webhook_token to add yourself.

## Response `201`

Connected. GitHub mode installs the hook and returns its id;
manual mode returns `payload_url` + `webhook_token` (shown once)
to add in your provider.

## Other responses

- `400`: Validation failed on the request body or query parameters
- `401`: Invalid or missing API credentials
- `404`: Resource not found
- `409`: Webhook already connected
- `502`: Error from upstream provider API

---

[API](https://skmtc.dev/imprezahost/apis/impreza-host-public-api.md) · [All operations](https://skmtc.dev/imprezahost/apis/impreza-host-public-api/llms.txt) · [OpenAPI document](https://skmtc.dev/imprezahost/apis/impreza-host-public-api/revisions/db86511f604f?raw)
