---
title: "Create a public SSH key for the authenticated user"
method: POST
path: "/user/keys"
tags: ["users"]
---

# Create a public SSH key for the authenticated user

`POST /user/keys`

Adds a public SSH key to the authenticated user's GitHub account.

OAuth app tokens and personal access tokens (classic) need the `write:public_key` scope to use this endpoint.

## Request body

- object
  - `title` string — A descriptive name for the new key.
  - `key` string, required — The public SSH key to add to your GitHub account.

## Response `201`

Response

- Key — Key
  - `key` string, required
  - `id` integer, required
  - `url` string, required
  - `title` string, required
  - `created_at` string, date-time, required
  - `verified` boolean, required
  - `read_only` boolean, required
  - `last_used` string, date-time, nullable

## Other responses

- `304` — Not modified
- `401` — Requires authentication
- `403` — Forbidden
- `404` — Resource not found
- `422` — Validation failed, or the endpoint has been spammed.

---

[API](https://skmtc.net/github/apis/github-v3-rest-api-2.md) · [All operations](https://skmtc.net/github/apis/github-v3-rest-api-2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/github/github-v3-rest-api-2/versions/8ae6d0c8716e/schema)
