# PATCH /users/{name}/ssh-keys/{id}

First published 14 Oct 2026 (release 0.2.0) · Unchanged since publication

UrbeStack release 0.2.35 API operation in the users group.

Change a customer's SSH key label

- Who may call it: administrator, reseller, customer
- Token scope, any of: users, all
- Answers: 200 OK

Administrators, the customer's reseller and the customer can change a key's label. Use the key's id from GET /users/{name}/ssh-keys. The label must contain 1 to 64 printable ASCII characters. An omitted or empty label returns 400.

The response contains the existing public key and fingerprint with the new label in key. UrbeStack immediately writes the label as the key's comment in the customer's file under ssh_keys_dir.

## As a command

- [urbestack-ssh-key-set](https://urbestack.com/docs/commands/urbestack-ssh-key-set.md): Changes only the label of a customer's SSH public key in place.

## Parameters

- `name` (path, Username, required)
- `id` (path, integer, 1 or more, required)

## Request body

JSON, the type [SshKeyPatch](https://urbestack.com/docs/api/types/SshKeyPatch.md).

- `label` (string, up to 64 characters, required): New label of 1 to 64 printable characters.

## Example

Set $API to the base URL and $TOKEN to the token, as the [API overview](https://urbestack.com/docs/api.md) shows.

```
curl -sS -X PATCH "$API/users/alice/ssh-keys/1" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "label": "my laptop"
  }'
```

Response, 200 OK:

```
{
  "key": {
    "created_at": "2026-09-09T10:15:00Z",
    "fingerprint": "text",
    "id": 1,
    "key": "panel.port",
    "label": "my laptop",
    "type": "rebuild",
    "user": "alice"
  }
}
```

## Errors

- 400: --<_> is required
- 400: Invalid id
- 400: Invalid label: 1 to 64 printable ASCII characters
- 400: Invalid username: 2 to 32 lowercase letters, digits or underscores, starting with a letter
- 400: Username '<value>' is reserved
- 400: label is required: the new label, 1 to 64 printable characters
- 401: Authentication required
- 404: No SSH key <id> on the list of <user.name>
- 404: User '<user>' not found
