# Account

Use this endpoint to check that a key works and to see which account and permissions it has. It needs no particular permission, so it is a good first call and a good health check.

## Get the customer and API key for this request

`GET /v1/me`

| Property | Value |
|---|---|
| URL | `https://api.rephut.com/v1/me` |
| Permission | Any valid key |
| Access | Read: counts towards the read limit and works while your account is on hold |
| Idempotency-Key | Not used |
| Success | 200 OK |

### Headers

| Header | Required | Value |
|---|---|---|
| `Authorization` | Yes | `Bearer <your API key>`. See [Authentication](https://docs.rephut.com/developers/authentication). |

### Response

`200` with `data`, an object with the fields below.

| Field | Type | Description |
|---|---|---|
| `customer` | object | The account the key belongs to. |
| `customer.id` | string | Your account id. |
| `customer.name` | string | Your company name, as we have it on file. |
| `apiKey` | object | The key that made this request. |
| `apiKey.id` | string | Key id. |
| `apiKey.name` | string | The name you gave the key in the portal. |
| `apiKey.keyPrefix` | string | The first characters of the key, as shown in the portal. They can't be used to authenticate. |
| `apiKey.scopes` | array of strings | The key's permissions, for example `orders:read`. See [Authentication](https://docs.rephut.com/developers/authentication#permissions). |

### Errors

| Code | HTTP status | Meaning |
|---|---|---|
| `invalid_api_key` | 401 | The API key is missing, malformed, revoked or no longer valid. |
| `account_action_required` | 403 | Sign in to the portal and finish the required account steps first. |
| `api_not_enabled` | 403 | API access is not enabled for this account. |
| `validation_failed` | 422 | The input is not valid. `details` lists each field and the reason. |
| `rate_limited` | 429 | Too many requests. Wait for the number of seconds in Retry-After. |
| `internal_error` | 500 | Unexpected error. Quote X-Request-Id when you contact support. |

Handle errors by `code`. See [Errors](https://docs.rephut.com/developers/errors).

```bash example=curl
curl 'https://api.rephut.com/v1/me' \
  -H "Authorization: Bearer $FULFILLBOT_API_KEY"
```

```js example=node
const response = await fetch("https://api.rephut.com/v1/me", {
  headers: {
    Authorization: `Bearer ${process.env.FULFILLBOT_API_KEY}`,
  },
});
const result = await response.json();
console.log(response.status, result);
```

```python example=python
import os

import requests

response = requests.get(
    "https://api.rephut.com/v1/me",
    headers={
        "Authorization": f"Bearer {os.environ['FULFILLBOT_API_KEY']}",
    },
    timeout=30,
)
print(response.status_code, response.json())
```

```json example=response status=200
{
  "success": true,
  "data": {
    "customer": {
      "id": "cm2x8k1p40000abcd1234wxyz",
      "name": "Northwind Goods"
    },
    "apiKey": {
      "id": "cm3a1b2c30000keyd5678abcd",
      "name": "Order sync",
      "keyPrefix": "pak_7Hq2Lm9X",
      "scopes": [
        "wallet:read",
        "catalog:read",
        "orders:read",
        "purchase_orders:read",
        "shipments:read",
        "requests:read",
        "quotes:read",
        "orders:write"
      ]
    }
  }
}
```
