# Rename a passkey

> Source: https://truto.one/docs/api-reference/admin/passkeys/patch/

`PATCH /auth/passkey/{id}`

Resource: **Passkeys**

## Path parameters

- **`id`** _(string, required)_
  The ID of the passkey to rename.

## Request body

- **`name`** _(string)_
  New label. Trimmed; a blank or whitespace-only value is rejected.

## Response body

- **`id`** _(string)_
  The unique ID of the passkey. Use this to rename or delete it.
- **`name`** _(string)_
  User-supplied label, or `null` when the passkey was registered without one.
- **`device_type`** _(string)_
  `multiDevice` for a synced passkey (iCloud Keychain, Google Password Manager); `singleDevice` for a device-bound one (a security key, or a platform authenticator that does not sync).
  Allowed: `singleDevice`, `multiDevice`, `null`
- **`backup_state`** _(boolean)_
  Whether the credential is currently synced into a backup (the WebAuthn BS flag). Refreshed on every sign-in.
- **`last_used_at`** _(string)_
  ISO-8601 UTC timestamp of the last successful sign-in with this passkey; `null` if it has never been used.
- **`created_at`** _(string)_
  ISO-8601 UTC timestamp of registration.

## Code examples

### curl

```bash
curl -X PATCH 'https://api.truto.one/auth/passkey/{id}' \
  -H 'Authorization: Bearer <your_api_token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "YubiKey 5C"
}'
```

### JavaScript

```javascript
const body = {
  "name": "YubiKey 5C"
};

const response = await fetch('https://api.truto.one/auth/passkey/{id}', {
  method: 'PATCH',
  headers: {
    'Authorization': 'Bearer <your_api_token>',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(body),
});

const data = await response.json();
console.log(data);
```

### Python

```python
import requests

url = "https://api.truto.one/auth/passkey/{id}"
headers = {
    "Authorization": "Bearer <your_api_token>",
    "Content-Type": "application/json",
}
params = {
}
payload = {
    "name": "YubiKey 5C"
}

response = requests.patch(url, headers=headers, params=params, json=payload)
print(response.json())
```
