# `api.user.m7.org` API Reference

`api.user.m7.org` is the management API for M7 accounts, organizations,
organization members, two-factor and email sign-in settings, OAuth applications,
API keys, and offline-access records. Use it after a person or application has obtained an access token
from M7 SSO.

Manage accounts, authenticators, organizations, applications, API keys, and offline access in
the [M7 user application](https://user.m7.org/).

## Base URL

`https://api.user.m7.org/api/v2`

## Authorization

This service uses a [project-specific authorization profile](https://m7.org/docs/api/api.user.m7.org/authorization.md).
Every documented endpoint except `/oauth/clients/connections/verify` expects an
access token in the `Authorization` header:

```http
Authorization: Bearer <ACCESS_TOKEN>
```

An API key is not a substitute for this management access token. API-key
creation, editing, and lifecycle routes use the same authenticated management
boundary as the other resources in this API.

Some human sessions are additionally bound to a DPoP key, a fingerprint, or
both. Requests made with a bound session must include the companion headers
described in the authorization guide.

Use the [M7 SSO API documentation](https://m7.org/docs/api/sso.user.m7.org/)
for the standards-facing OAuth and OpenID Connect endpoints, including:

- `https://sso.user.m7.org/authorize`
- `https://sso.user.m7.org/token`
- `https://sso.user.m7.org/device_authorization`
- `https://sso.user.m7.org/register`

For delegated access between apps, configure
[application connections and exchange approval](https://m7.org/docs/api/api.user.m7.org/oauth-clients.md#application-connections)
here, then call [SSO Token Exchange](https://m7.org/docs/api/sso.user.m7.org/token#token-exchange-rfc-8693).
The [authorization guide](https://m7.org/docs/api/api.user.m7.org/authorization.md#audience-scopes-and-client-identity)
explains API.User's exact resource audiences, scopes and requester/target claims.

[Authorized Apps](https://m7.org/docs/api/api.user.m7.org/authorized-apps.md) lists a user's saved OAuth consent and
supports removing consent with optional app-scoped token/session revocation.

Access tokens are scoped to a principal. Use the token that matches the work
you need to perform:

| Token principal | Supported use |
| --- | --- |
| Consumer user | The user's account and personal applications, plus organizations where the user has active Management-group access. |
| Organization member | `/session/me` and any other endpoint that explicitly documents organization-member support. |
| Ordinary application | Eligible organization routes for the app's own live Management memberships, with a live human manager; independent of registration owner/directory. Applications cannot create organizations. |

`/session/me` rejects application tokens. Organization operations require
access to the selected organization; personal application operations require
the signed-in user's ownership of that application. An organization-member
token alone does not authorize organization-management routes. The connection
verification endpoint is a token-check helper: it accepts a `token` request
field instead of a bearer token.

## Request and response format

Send JSON request bodies with `Content-Type: application/json`. The current
handlers accept several methods for compatibility, but `POST` is the supported
integration contract used throughout this reference. Every relative route in
the guide tables is therefore a `POST` route under the base URL.

Successful calls use this envelope:

```json
{
  "status": 1,
  "comment": "ACTION",
  "data": {}
}
```

Failures use this envelope:

```json
{
  "status": 0,
  "code": 400,
  "comment": "Invalid token"
}
```

`status` is an application result (`1` or `0`), not the HTTP status. Handle
the HTTP status independently. Common examples are `400` for an invalid token,
`404` for an unknown path, and `501` for an unimplemented route.

The `comment` is a stable action result such as `OK`, `INSERT`, `SET_KNOBS`, or
`ISSUE_WEB`. Use the documented `data` fields for program flow rather than
matching a human-readable error message.

## Pagination

List and search endpoints accept the pagination fields below. Send at least one
of them to receive a pageable object in `data`; otherwise, most endpoints
return a raw array in `data`.

| Field | Required | Notes |
| --- | --- | --- |
| `limit` | No | Default is usually `20`. Values below `1` fall back to the default; valid values are capped at the endpoint maximum, usually `100`. |
| `page_number` | No | One-based page number. Invalid values fail the request. |
| `offset` | No | Offset-based alternative to `page_number`. |
| `cursor` | No | Opaque continuation value. Send the previous response's `next_cursor`. |

A pageable response has these `data` keys:

```json
{
  "items": [],
  "limit": 20,
  "total_count": 0,
  "next_offset": 20,
  "page_number": 1,
  "page_total": 0,
  "next_cursor": null
}
```

## Object map

The API uses a few similarly named objects. These terms distinguish them.

| Name | Path or payload key | Meaning |
| --- | --- | --- |
| User | `/account/me/*` | A consumer account. |
| Organization | `/org/*` | An organization and its member pool. |
| Org member | `/org/client/*` | An organization-scoped member record. The route path uses `client`; product language uses *member*. `/session/me` returns this as `data.client`. |
| OAuth app | `/oauth/clients/*` | An OAuth application registration. Its public identifier is `client_id`; its API record identifier is `id`. |
| API key | `/api_keys/*` | An independently managed API credential. Its management record `id` is separate from the complete key returned once at creation or rotation. |
| Management group | `/org/manage/*` | The built-in organization administration group. It is distinct from `/org/group/*`. |
| Principal list | `/lists/*` | A personal or organization-owned actor association list. Its members are independent of OAuth app ownership and organization Management membership. |

## Guides

- [`/session/me`](https://m7.org/docs/api/api.user.m7.org/session-me.md) — inspect the active user or organization-member session
- [Account sessions](https://m7.org/docs/api/api.user.m7.org/sessions.md) — inspect root login records and revoke an owned root family with back-channel logout
- [Account management](https://m7.org/docs/api/api.user.m7.org/account.md) — profile, email, sign-in methods, preferences, and account activity
- [Authorized Apps](https://m7.org/docs/api/api.user.m7.org/authorized-apps.md) — inspect saved account consent, withdraw it, and optionally revoke the selected app’s grant-bound token sessions
- [Two-factor authentication](https://m7.org/docs/api/api.user.m7.org/two-factor-authentication.md) — link an authenticator, change password, email, Device Code and account/session checks, generate recovery codes, and unlink
- [Organization invitations and applications](https://m7.org/docs/api/api.user.m7.org/org-relationships.md) — Member invitations, requests, consent and delivery
- [Organization management](https://m7.org/docs/api/api.user.m7.org/org.md) — organizations, management access, groups, and members
- [Principal lists](https://m7.org/docs/api/api.user.m7.org/principal-lists.md) — normalized actors, owned lists, enrollment, receiver ACL policy and shared membership expiry
- [Tenant member security](https://m7.org/docs/api/api.user.m7.org/tenant-member-security.md) — human manager email verification, identity unlink, factor reset, audit and revocation
- [Tenant policy](https://m7.org/docs/api/api.user.m7.org/tenant-policy.md) — browser-direct org/app allowances and org-only member-security switches
- [OAuth client management](https://m7.org/docs/api/api.user.m7.org/oauth-clients.md) — application registration, response-mode allowlists, JARM signing policy, groups, and connections
- [API key management](https://m7.org/docs/api/api.user.m7.org/api-keys.md) — create, configure, activate, rotate, revoke, and delete personal or organization keys
- [Client credentials tokens](https://m7.org/docs/api/api.user.m7.org/oauth-client-credentials.md) — browser-assisted `client_credentials` issuance and issued-record management
- [Device and offline access](https://m7.org/docs/api/api.user.m7.org/offline-access-device.md) — offline-access grants, refresh bundles, and grant administration

## Organization access across services

- [Organization roles, scope tags, public data and departure](https://m7.org/docs/api/api.user.m7.org/org.md)
- [Owner-controlled organization disclosure](https://m7.org/docs/api/api.user.m7.org/org.md#organization-discovery-policy)
- [Service capability discovery and organization-member permissions](https://m7.org/docs/api/api.user.m7.org/service-capability-discovery.md) — proposed approval contract, standalone runtime consumer, and current Blog tag-name resolution with publication permission boundaries
- [OAuth ownership and directory scope](https://m7.org/docs/api/api.user.m7.org/oauth-clients.md#ownership-and-directory-context)
- [Organization upgrade and installation order](https://m7.org/docs/api/api.user.m7.org/organization-upgrade.md)
- [Consented consumer org discovery at SSO](https://m7.org/docs/api/sso.user.m7.org/userinfo-orgs.md)
- [SDK acquisition and release boundary](https://m7.org/docs/sdk/m7-identity/cli/organization-access.md)
