# Session and permissions API

> Who the caller is acting as and what they may do. With curl and TypeScript examples.

## `GET /v1/me/scope-check`

Ask what the API would answer a call that needs these scopes

Answers 200 when the credential holds every scope listed. Otherwise it answers exactly what a call needing them would: 403 `insufficient_scope`, or, for an OAuth token whose grant is smaller than its person's role allows, 403 `oauth_consent_required` with `consent_url` and `missing_access` so the person can pick `"Read and publish"`. Nothing is run or stored.

Operation `checkMyScopes`. No scope needed.

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `scopes` | query | string | yes | The scopes the call would need, separated by commas. |

**Responses**

| Status | Meaning | Content type |
| --- | --- | --- |
| `200` | The credential holds every scope listed. | `application/json` |
| `400` | `validation_failed`: `scopes` is not a comma-separated list of known scopes. | `application/problem+json` |
| `401` | `unauthenticated`: no credentials, or credentials that prove nothing. | `application/problem+json` |
| `403` | `mfa_required`: a portal session that must still verify or set up MFA (see `mfa_reason`). `insufficient_scope`: the credential lacks a scope listed (see `missing_scopes`). `oauth_consent_required`: an OAuth token whose grant is smaller than its person's role allows (see `consent_url` and `missing_access`). | `application/problem+json` |
| `405` | `method_not_allowed`: the path exists, but not for this method; `Allow` lists the methods it answers. | `application/problem+json` |
| `429` | `rate_limited`: the limit of the route class (`rate_limit.limit_class`: read, write, publish, heavy, approval, diff, metrics, destructive or ip) was reached. Wait `Retry-After` seconds. `rate_limiter_unavailable` (503) is answered for `heavy` routes and destructive calls when the limiter itself fails, and for a valid OAuth token with no grant when the consent-link limiter fails (never a 401, so an MCP client does not log in again). | `application/problem+json` |
| `500` | `internal_error` (nothing about the failure; quote `request_id`) or `configuration_error`. | `application/problem+json` |
| `503` | `database_unavailable`: the API could not reach its database (timeout, dropped connection). Wait `Retry-After` seconds and send the same request again: repeating is safe with the same `Idempotency-Key`; without it a POST may already have been applied. | `application/problem+json` |

```sh title="curl"
curl "https://api.taggor.dev/v1/me/scope-check?scopes=components%3Aread%2Ccomponents%3Awrite" \
  -H "Authorization: Bearer $TAGGOR_API_KEY"
```

```ts title="TypeScript"
const response = await fetch("https://api.taggor.dev/v1/me/scope-check?scopes=components%3Aread%2Ccomponents%3Awrite", {
  headers: { authorization: `Bearer ${process.env.TAGGOR_API_KEY}` },
});
if (!response.ok) throw new Error(await response.text());
const result: unknown = await response.json();
console.log(result);
```

```json title="Example response"
{
  "scopes": [
    "components:read"
  ]
}
```

## `GET /v1/me/permissions`

Get the current workspace role and its effective permissions

Operation `getMyPermissions`. No scope needed.

**Responses**

| Status | Meaning | Content type |
| --- | --- | --- |
| `200` | Current role permissions. | `application/json` |
| `401` | `unauthenticated`: no credentials, or credentials that prove nothing. | `application/problem+json` |
| `403` | `mfa_required`: a portal session that must still verify or set up MFA (see `mfa_reason`). `insufficient_scope`: the credential has no membership in the workspace it acts in. | `application/problem+json` |
| `405` | `method_not_allowed`: the path exists, but not for this method; `Allow` lists the methods it answers. | `application/problem+json` |
| `429` | `rate_limited`: the limit of the route class (`rate_limit.limit_class`: read, write, publish, heavy, approval, diff, metrics, destructive or ip) was reached. Wait `Retry-After` seconds. `rate_limiter_unavailable` (503) is answered for `heavy` routes and destructive calls when the limiter itself fails, and for a valid OAuth token with no grant when the consent-link limiter fails (never a 401, so an MCP client does not log in again). | `application/problem+json` |
| `500` | `internal_error` (nothing about the failure; quote `request_id`) or `configuration_error`. | `application/problem+json` |
| `503` | `database_unavailable`: the API could not reach its database (timeout, dropped connection). Wait `Retry-After` seconds and send the same request again: repeating is safe with the same `Idempotency-Key`; without it a POST may already have been applied. | `application/problem+json` |

```sh title="curl"
curl "https://api.taggor.dev/v1/me/permissions" \
  -H "Authorization: Bearer $TAGGOR_API_KEY"
```

```ts title="TypeScript"
const response = await fetch("https://api.taggor.dev/v1/me/permissions", {
  headers: { authorization: `Bearer ${process.env.TAGGOR_API_KEY}` },
});
if (!response.ok) throw new Error(await response.text());
const result: unknown = await response.json();
console.log(result);
```

```json title="Example response"
{
  "role": "viewer",
  "user": {
    "id": "usr_000000000000000000000000aa",
    "name": "Ana",
    "email": "ana@example.com",
    "locale": "en"
  },
  "workspace": {
    "id": "ws_000000000000000000000000aa",
    "slug": "acme",
    "name": "Acme"
  },
  "payment_required": false,
  "actions": [
    "site_read",
    "component_read",
    "data_read"
  ],
  "scopes": [
    "components:read",
    "sites:read",
    "data:read",
    "metrics:read"
  ]
}
```
