# Account

Introspect the API key used for the request.

## Get current key

```http
GET /api/public/v1/me
```

**Scope**: none. Works with any valid key.

Returns the key in use and its owner. Call this to verify that a key is valid and inspect its granted scopes.

### Response fields

| Field   | Type                                      | Description                               |
| :------ | :---------------------------------------- | :---------------------------------------- |
| `key`   | [ApiKeySummary](#api-key-summary-fields) | API key metadata. The secret is never returned. |
| `owner` | [AccountOwner](#account-owner-fields)    | Account that owns the key.                |

### API key summary fields

| Field       | Type     | Description                            |
| :---------- | :------- | :------------------------------------- |
| `id`        | string   | API key ID.                            |
| `name`      | string   | Key label set when the key was created. |
| `scopes`    | string[] | Scopes granted to this key.            |
| `expiresAt` | string   | ISO 8601 UTC expiry timestamp.         |

### Account owner fields

| Field    | Type   | Description                                     |
| :------- | :----- | :---------------------------------------------- |
| `sairId` | string | SAIR ID of the account that owns the key.       |
| `email`  | string | Email address of the account that owns the key. |

```json
{
  "ok": true,
  "data": {
    "key": {
      "id": "key_a1b2c3d4",
      "name": "Local training submitter",
      "scopes": ["competition.read", "competition.write"],
      "expiresAt": "2026-08-01T00:00:00Z"
    },
    "owner": {
      "sairId": "U-9f7e1c00",
      "email": "you@example.com"
    }
  }
}
```

This endpoint is distinct from [`GET /api/public/v1/competitions/{competitionId}/me`](./competitions.md#my-participation), which returns participation status in one competition.

## Errors

See [Errors](../errors.md) for the envelope shape.

| Code               | HTTP | When                         |
| :----------------- | :--: | :--------------------------- |
| `API_KEY_REQUIRED` | 401  | No `Authorization` header.   |
| `INVALID_API_KEY`  | 401  | Format wrong or hash mismatch. |
| `API_KEY_REVOKED`  | 401  | Key was revoked.             |
| `API_KEY_EXPIRED`  | 401  | Past `expiresAt`.            |
