# Test an API key with GET /api/v1/me

> Test a Mujib API key with GET /api/v1/me, which returns your business name and the key's name and scopes. Examples in curl, JavaScript and Python, plus errors.

To test an API key, call `GET /api/v1/me`: a valid key gets back your business name and the key's own name and scopes, and an invalid one gets a 401. It needs no scope, so it is the first request to send after you create a key.

## What does the key test return?

It returns the name of the business the key belongs to, the name you gave the key when you created it, and the key's scopes:

| Field | Type | Meaning |
| --- | --- | --- |
| `workspace.name` | string | Your business name in Mujib |
| `key.name` | string | The name you gave the key when you created it |
| `key.scopes` | array of strings | The key's scopes: `contacts.read`, `bookings.read`, or both |

This request takes no parameters.

## How do I send the request?

Send it with your key in the `Authorization` header:

```bash
curl https://api.mujib.ai/api/v1/me \
  -H "Authorization: Bearer $MUJIB_API_KEY"
```

```js
const res = await fetch('https://api.mujib.ai/api/v1/me', {
  headers: { Authorization: `Bearer ${process.env.MUJIB_API_KEY}` },
});
const body = await res.json();
if (!res.ok) throw new Error(`${res.status} ${body.error.code}: ${body.error.message}`);
console.log(body.workspace.name, body.key.scopes);
```

```python
import os
import requests

res = requests.get(
    "https://api.mujib.ai/api/v1/me",
    headers={"Authorization": f"Bearer {os.environ['MUJIB_API_KEY']}"},
    timeout=30,
)
body = res.json()
if not res.ok:
    raise RuntimeError(f"{res.status_code} {body['error']['code']}: {body['error']['message']}")
print(body["workspace"]["name"], body["key"]["scopes"])
```

## What does the response look like?

A 200, with both fields at the top level of the body and no `data` wrapper:

```json
{
  "workspace": { "name": "مركز النخبة" },
  "key": { "name": "تقارير المبيعات", "scopes": ["contacts.read", "bookings.read"] }
}
```

The response carries the key's budget headers `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`, as [API errors and rate limits](https://docs.mujib.ai/en/developers/errors-limits/) explains.

## When should I use this request?

Use it to confirm a key works and carries the scope your system needs, before you read any data.

- **When your system starts:** on a 401, stop the sync and alert whoever runs the system, instead of failing every request after it.
- **Before reading bookings:** if `bookings.read` is not in `key.scopes`, skip bookings instead of collecting 403s.
- **After replacing a key:** confirm the new key works before you revoke the old one, as [API keys](https://docs.mujib.ai/en/developers/authentication/) explains.

## What errors can it return?

| HTTP | `code` | Why |
| --- | --- | --- |
| 401 | `UNAUTHORIZED` | No key, or a key that is invalid, revoked or expired, or a business account that is not active |
| 429 | `RATE_LIMITED` | You went over a rate limit |
| 500 | `INTERNAL` | An unexpected server error |

## Frequently asked questions

### Does this request need a scope?

No. Any valid key can call it, whatever its scopes.

### Does it count toward the rate limit?

Yes, like any other request with a valid key. Do not send it before every request; send it when your system starts or after you change the key.

### Why is there no data in this response?

Because it describes the key and its business, not a list or a record. The response carries workspace and key directly.

---

Source: https://docs.mujib.ai/en/developers/api-me/ · Last updated: 2026-11-04
