# Me API

> The signed-in account - email, plan, plan expiry, concurrency limit, credit balance and minutes used this month.

Source: https://akaphone-docs.pages.dev/api/me/

## Get the current account

`GET /v1/me`

Returns who the key or session belongs to, the plan in force right now, and the exact credit balance. A cheap way to check that a key works.

```bash title="curl"
curl https://akaphone.abhgnx-417.workers.dev/v1/me \
  -H "Authorization: Bearer $AKAPHONE_API_KEY"
```
```typescript title="TypeScript"
const me = await fetch("https://akaphone.abhgnx-417.workers.dev/v1/me", {
  headers: { Authorization: `Bearer ${process.env.AKAPHONE_API_KEY}` },
}).then((r) => r.json());
console.log(`${me.user.email}: ${me.credits.balance} credits on ${me.user.plan}`);
```
```python title="Python"
import os, requests

me = requests.get(
    "https://akaphone.abhgnx-417.workers.dev/v1/me",
    headers={"Authorization": f"Bearer {os.environ['AKAPHONE_API_KEY']}"},
).json()
print(me["user"]["email"], me["credits"]["balance"])
```

**Response** `200 OK`

```json
{
  "user": {
    "id": "usr_01m5vqsywg3mxj7dyxv9q9",
    "email": "ada@example.com",
    "name": "Ada Lovelace",
    "avatar_url": "https://lh3.googleusercontent.com/a/ACg8ocK…",
    "plan": "dev",
    "plan_expires_at": null,
    "max_concurrent": 3
  },
  "credits": {
    "balance": 1292,
    "used_this_month": 143
  }
}
```

| Field | Description |
|---|---|
| `user.id` | `usr_…` |
| `user.email`, `user.name`, `user.avatar_url` | From your Google account. |
| `user.plan` | The plan in force now: `free`, `dev`, `team` or `enterprise`. An expired Team plan already shows as `dev`. |
| `user.plan_expires_at` | When the Team plan ends, otherwise `null`. |
| `user.max_concurrent` | How many devices you can have queued, creating or running at once. |
| `credits.balance` | Credits available now. Can be negative after a refund. |
| `credits.used_this_month` | Device-minutes charged since the start of the calendar month (UTC). |

`401 unauthorized` if the key is invalid or revoked; `403 forbidden` if the account is suspended.

## Sign in and out (dashboard only)

The dashboard uses Google sign-in rather than API keys. These endpoints are browser navigations, not API calls, and are listed for completeness:

| Endpoint | What it does |
|---|---|
| `GET /auth/google/start?redirect=/` | Redirects to Google. After sign-in you return to `https://akaphone.abhgnx-417.workers.dev` plus `redirect` (a path on the dashboard). |
| `POST /auth/logout` | Ends the session and clears the cookie. Returns `204`. |

Revoking API keys does not sign you out of the dashboard, and signing out does not revoke keys.
