# `api.post.service.m7.org` API Reference

`api.post.service.m7.org` lets an application create delivery policies, prepare message
content, and run notification or proof jobs. A proof job delivers an email
challenge and can then be verified or consumed by a recipient.

## Base URL

`https://api.post.service.m7.org`

Protected workflow routes use `POST` with a JSON request body. Capability
discovery uses `GET` and returns a raw JSON document.

## Management app

Use [post.service.m7.org](https://post.service.m7.org) to manage message groups and templates,
delivery policies, and jobs through the production interface. Use this API for
programmatic integrations with the same service.

## Authentication

Authorization is project-specific because this API combines authenticated
member resources with public, job-scoped proof credentials. See the complete
[authorization guide](https://m7.org/docs/api/api.post.m7.org/authorization.md).

Member routes require an M7 access token for an active service-list principal
with the exact `member`, `user`, `admin`, or `root` role:

```http
Authorization: Bearer ACCESS_TOKEN
```

Select Personal or an organization [workspace](https://m7.org/docs/api/api.post.m7.org/workspaces.md), then a
[project](https://m7.org/docs/api/api.post.m7.org/projects.md). Every message, policy, and job request requires
`project_id` and the matching capability through active project membership.
The service scopes resources to that project; do not send `owner`, `project`,
`principal_id`, or `actor_id` overrides. Service-wide Admin/Root does not grant
another workspace's project access. Organization grants further restrict actions.

The proof routes are different: they do not require a bearer token. They use
an active job's `job` or `job_id` as the lookup value, so treat that ID and the
delivered secret as sensitive workflow values.

## Request and response format

Send JSON with `Content-Type: application/json`. Successful responses use this
envelope:

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

Member authorization failures return an application error with an HTTP `401`
for a missing principal or `403` for insufficient access:

```json
{
  "status": 0,
  "code": 403,
  "comment": "Access denied",
  "reason": "access_denied"
}
```

Handle the HTTP status and the application-level `status` independently.
Delivery routes use success comment `OK`; workspace and project routes have
their own comments. Use documented `data` fields for application flow.

## Pagination

Message, policy, and job `list` routes accept the following fields. Page numbers are
one-based. Omit them to begin at the first page.

| Field | Required | Type | Behavior |
| --- | --- | --- | --- |
| `limit` | No | Integer | Defaults to `20`; values below `1` normalize to `3`; maximum `100`. |
| `offset` | No | Integer | Zero-based alternative to `page_number`. |
| `page_number` | No | Integer | One-based page number. |
| `cursor` | No | String | Opaque continuation value from `next_cursor`; takes precedence over the other paging fields. |

List responses place this object in `data`:

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

`next_cursor` is `null` when no next page is available. `next_offset` is
returned on every page; use `next_cursor` to decide whether to request more.

Project member lists use their separate `limit`/`offset` contract; see
[projects](https://m7.org/docs/api/api.post.m7.org/projects.md#membership-routes). Project lists are not paginated.

## Concepts

| Concept | Purpose |
| --- | --- |
| Message template | Reusable email or SMS content. |
| Message group | A named set of templates used when a job is activated. |
| Policy group | A named project-scoped collection of suppression and domain-policy records. |
| Job | A draft, active, completed, failed, or cancelled delivery workflow. |
| Proof | The public recipient step for an active job with `proof_policy` `single` or `any`. |

## Guides

- [Workspaces](https://m7.org/docs/api/api.post.m7.org/workspaces.md) — discover identity and select Personal or an organization.
- [Projects and access](https://m7.org/docs/api/api.post.m7.org/projects.md) — create/select projects, manage members, and choose capabilities.

- [Authorization](https://m7.org/docs/api/api.post.m7.org/authorization.md) — obtain and send an M7 access token,
  understand workspace and project access, and handle public proof credentials safely.
- [Message groups and templates](https://m7.org/docs/api/api.post.m7.org/messages.md) — create content and link it
  to a message group.
- [Jobs](https://m7.org/docs/api/api.post.m7.org/jobs.md) — create, activate, cancel, retry, and inspect workflows.
- [Policies](https://m7.org/docs/api/api.post.m7.org/policies.md) — manage policy groups, DNE entries, and domain
  policies.
- [Proof](https://m7.org/docs/api/api.post.m7.org/proof.md) — inspect, resend, verify, and consume email proof
  challenges.
