Publication context
Use the context endpoint after selecting a publication to discover the caller's role and permitted actions. It is useful for adapting an editorial interface to the authenticated principal.
Authentication
POST /context/get requires a bearer token. User and delegate principals need
an active membership in the selected publication; trusted internal principals
use their service-wide scope. It accepts archived publications so a caller can
inspect the remaining read and cleanup permissions.
Route
| Route | Required fields | Optional fields | Success result |
|---|---|---|---|
POST /context/get |
publication_id or publication_slug |
— | context with the selected publication, resolved role, scope, and capabilities. |
Request fields
| Field | Required | Type | Description |
|---|---|---|---|
publication_id |
One selector required | UUID | Stable publication identifier. |
publication_slug |
One selector required | String | Publication slug. |
curl -sS https://api.blog.service.m7.org/v1/context/get \
-H 'Authorization: Bearer ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"publication_slug":"engineering-notes"}'
{
"status": 1,
"comment": "context loaded",
"data": {
"context": {
"publication": {
"publication_id": "PUBLICATION_UUID",
"slug": "engineering-notes",
"name": "Engineering Notes",
"status": "active",
"archived": 0
},
"role": "editor",
"scope": "member",
"capabilities": ["post.list", "post.save", "page.list"]
}
}
}
Treat capabilities as the authority for enabling a route in the current
publication. A 403 means the selected principal lacks the required
publication access or capability.