> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vers.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Verify public key

# Verify Public Key

Lookup all verified records for a given SSH public key. Diagnostic endpoint — useful when you have the key but not the associated email.

## Endpoint

```
POST /api/shell-auth/verify-public-key
```

## Request

```json theme={"theme":{"light":"min-light","dark":"min-dark"}}
{
  "ssh_public_key": "ssh-ed25519 AAAA..."
}
```

| Field            | Type   | Required | Description               |
| ---------------- | ------ | -------- | ------------------------- |
| `ssh_public_key` | string | Yes      | SSH public key to look up |

## Response

### Found (200)

```json theme={"theme":{"light":"min-light","dark":"min-dark"}}
{
  "verified": true,
  "count": 1,
  "matches": [
    {
      "user_id": "550e8400-e29b-41d4-a716-446655440000",
      "key_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
      "email": "alice@company.com",
      "is_active": true,
      "public_key_verified": true,
      "verified_at": "2026-03-01T10:30:00Z",
      "last_seen_at": "2026-03-02T15:45:00Z"
    }
  ]
}
```

| Field                    | Description                                   |
| ------------------------ | --------------------------------------------- |
| `count`                  | Number of verified records for this key       |
| `matches[].email`        | The email associated with this key            |
| `matches[].verified_at`  | When the key was verified                     |
| `matches[].last_seen_at` | Last time the key was used for authentication |

### Not found (404)

```json theme={"theme":{"light":"min-light","dark":"min-dark"}}
{
  "verified": false,
  "reason": "No verified SSH key records found for this public key"
}
```

## When to use

This endpoint is for diagnostics and debugging:

* Checking if a key is already registered before initiating auth
* Looking up which email is associated with a key
* Verifying key status without knowing the email

For normal authentication flows, use [POST /api/shell-auth/verify-key](/shell-auth/verify-key) instead.

## Example

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
curl -X POST https://vers.sh/api/shell-auth/verify-public-key \
  -H "Content-Type: application/json" \
  -d '{
    "ssh_public_key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIExample..."
  }'
```
