> ## 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 key

# Verify Key

Check if an email + SSH key pair has been verified. Returns the user's organization list for org selection.

## Endpoint

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

## Request

```json theme={"theme":{"light":"min-light","dark":"min-dark"}}
{
  "email": "user@example.com",
  "ssh_public_key": "ssh-ed25519 AAAA..."
}
```

| Field            | Type   | Required | Description                                |
| ---------------- | ------ | -------- | ------------------------------------------ |
| `email`          | string | Yes      | User's email address                       |
| `ssh_public_key` | string | Yes      | SSH public key submitted during initiation |

## Response

### Verified (200)

```json theme={"theme":{"light":"min-light","dark":"min-dark"}}
{
  "verified": true,
  "is_active": true,
  "user_id": "550e8400-e29b-41d4-a716-446655440000",
  "key_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
  "orgs": [
    {
      "org_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "name": "alice",
      "role": "admin"
    },
    {
      "org_id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "name": "acme-corp",
      "role": "member"
    }
  ]
}
```

| Field           | Description                                       |
| --------------- | ------------------------------------------------- |
| `verified`      | Whether the SSH key pair is verified              |
| `is_active`     | Whether the user account is active                |
| `user_id`       | The authenticated user's ID                       |
| `key_id`        | The SSH key record ID                             |
| `orgs`          | List of organizations the user belongs to         |
| `orgs[].org_id` | Organization ID (use this when creating API keys) |
| `orgs[].name`   | Organization display name                         |
| `orgs[].role`   | User's role: `admin`, `member`, or `owner`        |

### Not verified (401)

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

The user hasn't clicked the verification link yet. Continue polling.

## Polling pattern

Poll this endpoint after calling [POST /api/shell-auth](/shell-auth/initiate) until `verified` is `true`:

```
loop:
  response = POST /api/shell-auth/verify-key
  if response.verified == true:
    break  → proceed to org selection + API key creation
  wait 2-3 seconds
  repeat
```

Verification links expire after 10 minutes. If the user doesn't verify in time, re-initiate with [POST /api/shell-auth](/shell-auth/initiate).

## Org selection

The `orgs` array contains all organizations the user has access to. Use this to present an org picker to the user before creating an API key.

* Users with **one org** can skip the picker
* Users with **multiple orgs** should select which org to create the API key for
* The `role` field indicates the user's permissions in each org

## Example

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

## Next step

Once verified, create an API key with [POST /api/shell-auth/api-keys](/shell-auth/api-keys), passing the selected `org_name`.
