# me

Source: https://developers.newjune.co/api-reference/me

> The API key making the request, and its limits.

The API key making the request, and its limits.

Scope: any valid key. Base URL: `https://data.newjune.co`.

The key making the request. Use it to check that a key works, which scopes it has, and the limits that apply to it. It returns no golf data.

## Endpoints

- `GET /v1/me`: Get the current API key

Responses carry `Request-Id`, `RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset`, and a `429` adds `Retry-After`. See [Headers](https://developers.newjune.co/conventions#headers).

## The key context object

| Field | Type | Description |
| --- | --- | --- |
| `object` | string | Always "api_key_context". |
| `key` | object | The key used for this request. |
| `key.object` | string | Always "api_key". |
| `key.id` | string | Unique id of the API key. |
| `key.name` | string | The name you gave the key. |
| `key.prefix` | string | The first characters of the key, for telling keys apart. |
| `key.scopes` | array of strings | What the key may read. |
| `key.expires_at` | string (timestamp) or null | When the key stops working. Null when it does not expire. |
| `limits` | object | Rate limits that apply to this key. |
| `limits.requests_per_minute` | integer | Requests this key may make per minute. |
| `limits.requests_per_day` | integer | Requests per UTC day, shared by all of your keys. Resets at midnight UTC. |

Example key context:

```json
{
  "object": "api_key_context",
  "key": {
    "object": "api_key",
    "id": "53e13cb8-f578-4bf4-958c-3c3faea4c7d4",
    "name": "Spreadsheet sync",
    "prefix": "nj_live_3f9a",
    "scopes": [
      "plans:read",
      "rounds:read"
    ],
    "expires_at": "2027-06-01T00:00:00.000Z"
  },
  "limits": {
    "requests_per_minute": 60,
    "requests_per_day": 1000
  }
}
```

### Get the current API key

`GET /v1/me`

The key used for this request, its scopes, and its limits. Works with any valid key.

Scope: any valid key. Operation id: `getMe`.

#### Example request

curl:

```bash
curl "https://data.newjune.co/v1/me" \
  -H "Authorization: Bearer $NEW_JUNE_API_KEY"
```

TypeScript:

```ts
const response = await fetch('https://data.newjune.co/v1/me', {
  headers: { Authorization: `Bearer ${process.env.NEW_JUNE_API_KEY}` },
});
const body = await response.json();
console.log(body);
```

Python:

```python
import os
import requests

response = requests.get(
    "https://data.newjune.co/v1/me",
    headers={"Authorization": f"Bearer {os.environ['NEW_JUNE_API_KEY']}"},
    timeout=30,
)
print(response.json())
```

#### Responses

- `200`: The key context.
- `401`: The API key is missing, not valid, revoked, or expired.
- `403`: The key lacks the scope this endpoint needs, or the account is suspended.
- `429`: Too many requests. See the RateLimit and Retry-After headers.
- `500`: Something went wrong on our side.
- `503`: The API is temporarily unavailable.
