Get Push-to-Deploy Webhook

GET /v1/applications/{uuid}/webhook

For a git-sourced application, fetch the webhook URL and secret to register with your provider so every push to the configured branch auto-deploys. Available only for source: "git" apps.

Apps imported through the ngris GitHub App need no webhook: GitHub delivers their pushes to the app. For them via_app is true, secret is empty, and a push sent to the per-app url is acknowledged and ignored, so a hook added by hand never builds a commit twice.

Response (200 OK)

url string
The payload URL to add to GitHub/GitLab: https://api.ngris.com/v1/webhooks/git/{uuid}.
secret string
The signing secret. Ngris verifies every delivery's signature against it.
provider string
github or gitlab.
branch string
The branch that triggers a deploy.
auto_deploy boolean
Whether pushes to branch are auto-deployed.
auto_preview boolean
Whether pushes to any other branch build a branch preview. Set with PUT …/git/auto-preview.
via_app boolean
true when the repo is connected through the ngris GitHub App — nothing to register; secret is empty.
app_issue string | absent
Only when via_app is true and pushes are not deploying: the GitHub App was uninstalled, suspended, or removed from your account. Says how to fix it.

Provider setup

GitHub
Repo → Settings → Webhooks → Add webhook. Payload URL = url, Content type = application/json, Secret = secret, trigger = “Just the push event”.
GitLab
Settings → Webhooks. URL = url, Secret token = secret, enable Push events.

Errors

404 Not Found
Not a git application.
Request
curl "https://api.ngris.com/v1/applications/019be838-d261-7d9b-9499-71995a3a91c6/webhook" \ -H "X-API-KEY: <your_api_key>"
Response — 200 OK
{ "url": "https://api.ngris.com/v1/webhooks/git/019be838-d261-7d9b-9499-71995a3a91c6", "secret": "b7f3…", "provider": "github", "branch": "main", "auto_deploy": true, "auto_preview": false, "via_app": false }

Regenerate Webhook Secret

POST /v1/applications/{uuid}/webhook/regenerate

Rotate the webhook signing secret. The old secret stops working immediately, so update it in your provider afterward or pushes will fail signature verification. Git applications only (source: "git"): any other app answers 404. Returns 409 for an app connected through the ngris GitHub App, which has no webhook secret.

Response (200 OK)

url string
The (unchanged) payload URL.
secret string
The new signing secret.

Errors

404 Not Found
not a git application — the app is an upload app (or unknown).
409 Conflict
The repo is connected through the ngris GitHub App (no webhook secret), or the app is paused over a plan limit.

How delivery is verified

Providers call the public endpoint POST /v1/webhooks/git/{uuid} (no API key). Ngris verifies the signature — GitHub's X-Hub-Signature-256 (HMAC-SHA256 of the body) or GitLab's X-Gitlab-Token — against the app's secret, then deploys the pushed commit. That HMAC is the authentication; there is nothing for you to call there directly.

Request
curl -X POST \ "https://api.ngris.com/v1/applications/019be838-d261-7d9b-9499-71995a3a91c6/webhook/regenerate" \ -H "X-API-KEY: <your_api_key>" \ -H "Content-Type: application/json"
Response — 200 OK
{ "url": "https://api.ngris.com/v1/webhooks/git/019be838-d261-7d9b-9499-71995a3a91c6", "secret": "9d21…" }

Update Git Settings

PATCH /v1/applications/{uuid}/git

Change a git app's production branch, its push-to-deploy switch and its access token, or remove the token. Send only the fields you change: only those are written, and the others keep their stored values. The response is the settings as stored. The repository and the webhook stay as connected. To build the branch now, call redeploy.

Request body (application/json)

branch string
The production branch: pushes to it deploy to production. A valid git branch name (no spaces, no .., no leading -, none of ~ ^ : ? * [ \, …), at most 255 bytes, as on create.
auto_deploy boolean
false: pushes deploy nothing until you turn it back on (redeploy still works).
git_token string
A new access token for a repository connected with a URL. Omitted or empty keeps the saved token; it is never returned.
git_token_remove boolean
true removes the saved token (builds then fetch the repository without one). Not together with a new git_token.

Response (200 OK)

branch / auto_deploy / auto_preview string / boolean / boolean
The settings now in effect.
provider / via_app / has_token string / boolean / boolean
The git provider, whether the repo is connected through the ngris GitHub App, and whether a token is saved.

Errors

400 Bad Request
branch is required (empty), branch name is too long, “That isn't a valid branch name. Enter it as it appears in your repository, like main or feature/login.” (not a valid git branch name), “Send a new git_token or git_token_remove, not both.”, or an invalid body.
404 Not Found
not a git application.
409 Conflict
A git_token or git_token_remove for an app connected through the ngris GitHub App (it has no token), or the app is paused over a plan limit.
Request
curl -X PATCH \ "https://api.ngris.com/v1/applications/019be838-d261-7d9b-9499-71995a3a91c6/git" \ -H "X-API-KEY: <your_api_key>" \ -H "Content-Type: application/json" \ -d '{"branch": "release", "auto_deploy": false}'
Response — 200 OK
{ "branch": "release", "auto_deploy": false, "auto_preview": false, "provider": "github", "via_app": false, "has_token": true }
Was this helpful?