---
title: "Generate Git SSH key"
method: POST
path: "/api/hosting/v1/accounts/{username}/git/ssh-key"
tags: ["Hosting: Git"]
---

# Generate Git SSH key

`POST /api/hosting/v1/accounts/{username}/git/ssh-key`

Creates the SSH key pair of the hosting account and returns the public key. When the account already
has a key, returns that key unchanged. One key serves every website of the account; add the public
key to a private repository as a deploy key before deploying it.

## Path parameters

- `username` string, required

## Response `200`

Success response

- HostingV1GitGitSshKeyResource — Public SSH key the hosting account uses to clone and pull Git repositories
  - `public_key` string, nullable, required — Public key to add as a deploy key on the Git host. Null when the account has no key yet.

## Other responses

- `401` — Unauthenticated response
- `422` — Validation error response
- `500` — Error response

## Changes

- **2026-10-05** `ddc85273ef4e` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/hostinger/apis/hostinger-api/changes/api/hosting/v1/accounts/:username/git/ssh-key/post.md)

---

[API](https://skmtc.dev/hostinger/apis/hostinger-api.md) · [All operations](https://skmtc.dev/hostinger/apis/hostinger-api/llms.txt) · [OpenAPI document](https://skmtc.dev/hostinger/apis/hostinger-api/revisions/f086c8278a09?raw)
