# Me

The key making the request and the organisation it belongs to.

**Endpoints**

- `GET/v1/me`

## Get the calling key

GET/v1/me

Returns the API key the request was made with, the user it belongs to and the organisation it acts in, with the scopes the key may use now: those its owner’s permissions (a person’s role, or a service account’s roles) still grant. It takes no parameters and needs no permission, so it is the call to make first to check that a key works.

### Returns

`200 OK`:

The key, its user and its organisation.

Each failure is a problem document with a stable `code`; the response panel's status selector shows each one this operation can answer, and [errors](https://developer.watchtower15.com/api/errors/) lists them all.

**GET /v1/me**

curl:

```bash
curl https://rest.watchtower15.com/v1/me \
  -H "Authorization: Bearer $WT15_API_KEY"
```

PHP:

```php
$wt15 = WatchTower15\Client::fromEnvironment();

$me = $wt15->me();
echo $me->keyName, ' in ', $me->organisationName;
```

Node.js:

```ts
const wt15 = WatchTower15.fromEnvironment();

const me = await wt15.me();
console.log(me.key.name, me.organisation.name);
```

Python:

```python
client = Client.from_environment()

me = client.me()
print(me.key.name, me.organisation.name)
```

**Response (200 OK)**

```json
{
  "data": {
    "key": {
      "uuid": "75666699-b77d-4631-b576-041e8102a55b",
      "name": "example",
      "last_four": "example",
      "redacted_key": "example",
      "scopes": [
        "example"
      ],
      "effective_scopes": [
        "example"
      ],
      "created_at": 1794214800000,
      "expires_at": 1794214800000
    },
    "user": {
      "uuid": "75666699-b77d-4631-b576-041e8102a55b",
      "name": "example",
      "email": "example",
      "account_type": "person",
      "roles": [
        {
          "uuid": "75666699-b77d-4631-b576-041e8102a55b",
          "name": "example"
        }
      ]
    },
    "organisation": {
      "uuid": "75666699-b77d-4631-b576-041e8102a55b",
      "name": "example"
    }
  }
}
```

**Response (401 Unauthorized)**

The API key is missing, malformed, expired or revoked.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/unauthorized/",
  "title": "Unauthorized",
  "status": 401,
  "code": "unauthorized",
  "detail": "The API key is missing, malformed, expired or revoked",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

**Response (403 Forbidden)**

The key or its owner does not hold what the operation needs.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/forbidden/",
  "title": "Forbidden",
  "status": 403,
  "code": "forbidden",
  "detail": "This key does not have the domains.edit scope",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

**Response (429 Too Many Requests)**

A rate limit or the organisation's daily limit is reached; `Retry-After` says when to retry.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/rate_limited/",
  "title": "Rate limited",
  "status": 429,
  "code": "rate_limited",
  "detail": "Too many requests: the limit is 240 a minute",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d",
  "limit": 60
}
```

**Response (500 Internal Server Error)**

An unexpected error.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/internal_error/",
  "title": "Internal error",
  "status": 500,
  "code": "internal_error",
  "detail": "An unexpected error has happened",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

Source: https://developer.watchtower15.com/api/reference/me/
