---
title: "Rotate the git credential of a private-repo deployment"
method: POST
path: "/platform/deployments/custom/{id}/git-auth"
tags: ["Platform"]
---

# Rotate the git credential of a private-repo deployment

`POST /platform/deployments/custom/{id}/git-auth`

## Request

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

Replaces the credential this deployment uses to **clone** its private
repo, without recreating the app — before this existed, a revoked
token meant deleting the deployment and losing its domain, port and
environment variables.

Which credential is rotated follows how the deployment was created:

- `deploy_key` — send an empty body. A new keypair is generated and the
  new **public key** comes back; install it on the repo (GitHub →
  Deploy keys) and the next deploy uses it.
- `pat` — send `git_pat`. It is verified against the repo before it is
  stored, so a typo fails here instead of at deploy time.

This is **not** the auto-deploy webhook secret. That is a separate
credential with its own endpoints under
`/platform/deployments/custom/{id}/git-webhook/*`; rotating one does
not touch the other.

## Path parameters

- `id` string, required

## Request body

- object
  - `git_pat` string: New fine-grained personal access token, for a `pat` deployment. Verified against the repo before it is stored, then encrypted at rest. Omit for `deploy_key`.

## Response `200`

Credential rotated

- object
  - `success` boolean
  - `data` object
    - `git_auth_method` 'deploy_key' | 'pat'
    - `public_key` string: The new deploy key to install on the repo. `deploy_key` only.
    - `fingerprint` string: SHA256 fingerprint of the new key.
    - `note` string
  - `meta` Meta
    - `request_id` string
    - `timestamp` string, date-time

## Other responses

- `400`: The deployment has no git credential to rotate, or the PAT was rejected by the repo
- `404`: No such custom deployment on this account

---

[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)
