Skip to content
Reader API

Reader API

The Reader API is for building a media’s website or app: home and section pages, content, menus, search, reader login, subscriptions, ads… Base: https://<host>/api/media/v1. Full reference: Reader API.

What you need

ItemWhere to find it
Client ID and secretAdministration › ReaderHub › Clients (see)
Media IDAdministration › Publisher › Medias
Keys of menus, block configurations, templates, profile types, featuresFrom the editorial team, or in API responses (assocs)

Authenticating

Get a token

POST /api/media/v1/oauth/token
Content-Type: application/json

{
  "grant_type": "client_credentials",
  "client_id": "…",
  "client_secret": "…",
  "scope": "user"
}

The response holds access_token (valid 1 hour), refresh_token (valid 90 days) and expires_in. The secret can also be sent as Authorization: Basic.

Call the API

Each call carries the token and, for a media’s data, the media ID:

GET /api/media/v1/overview
Authorization: Bearer <access_token>
x-omerlo-media-id: <media ID>

Refresh the token

POST /api/media/v1/oauth/token

{ "grant_type": "refresh_token", "refresh_token": "…" }

The previous token pair stays valid for 30 seconds, and a given refresh_token can only be used once.

The client secret gives access to the API on behalf of your organization: keep it server-side, never in code sent to the browser or in a published mobile app.

Scopes

ScopeObtained withGives access to
userclient_credentials or a reader loginReading content and most operations
profileA reader login (authorization_code), if they have an accountTheir account (/account/me), event registrations, invitations
applicationclient_credentials, requested aloneServer-to-server operations: linking an account (/oauth/verify), sending email (/mail/send)

Building pages

NeedCall
Start: the media and its treeGET /overview
Home page (root section) and its blocksGET /sections/:root_section_id, then GET /blocks/:block_id
A section’s feedGET /sections/:section_id/contents
A contentGET /contents/:id
SearchGET /contents/search?q=…
MenuGET /menus/:key
List of fixed pagesGET /webpages
A fixed page, by its slugGET /webpages/~/:slug (the slug may contain /: ~/about/team); GET /webpages/~ for the page whose slug is empty
Template of a fixed page built with the editorGET /webpages/templates/:hash, with the template.hash returned by the page
AnnouncementsGET /announcements
Events, people, organizations, projectsGET /community/events, /community/people…
Digital editionsGET /distributions, GET /distributions/:id/releases
AdvertisingGET /ads/random?format=300x250 (204 if none)
SitemapGET /sitemap/contents, /sitemap/events…

Responses look like { "data": …, "meta": …, "assocs": { … } }: assocs gathers related items (a block’s contents, templates, sections, categories…), to avoid extra calls.

Content is only returned if it is published (between its start and end dates). Profiles and events are only listed if they have a completed status.

Logging readers in

List the providers

GET /oauth-providers returns the configured login providers (Google…).

Have the reader log in

Redirect the reader to the provider, with your return address (to be allowed in the provider’s console).

Exchange the code

POST /api/media/v1/oauth/token

{
  "grant_type": "authorization_code",
  "client_id": "…",
  "code": "…",
  "redirect_uri": "…",
  "oauth_provider_id": "…"
}

Link the account

With an application scope token, your server calls POST /oauth/verify with the reader’s verified address: Omerlo creates their account, or links the existing anonymous one. The reader then gets the profile scope.

Then: GET /account/me (their account), GET /account/me/entitlements (their access, by feature_key).

Subscriptions, votes, registrations

NeedCall
The media’s mailing listsGET /newsletter/mailinglists
Subscribe an addressPOST /newsletter/subscriptions with email and mailinglist_id
The logged-in reader’s subscriptionsGET / DELETE /newsletter/subscriptions
Vote on a questionPOST /contents/:id/votes (409 if already voted)
Register for an eventPOST /community/events/:id/registration (profile scope)

Cache

Public responses are cached by the delivery network for 60 seconds (sections, blocks, announcements) or 5 minutes (content, menus, categories, events, issues…). A change in Omerlo can therefore take a few minutes to show. Personal data (account, subscriptions) and ads are never cached.

Common errors

StatusUsual cause
400 missing header x-omerlo-media-idMissing media header
401Missing, expired or invalid token: refresh it
403 incorrect authorization for the mediaThe media does not belong to the client’s organization
403 Token missing scopeThe token’s scope is not enough