Access
Your app lists the scopes it needs in its manifest’s scopes field. When someone installs the app, Ghost shows that list, and an Administrator approves it once for the whole site. If a later version asks for more, an Administrator approves again before the app opens.
Declare scopes
A scope is one thing your app can do, named by a permission key such as post:edit. List the permission keys your app needs:
"scopes": ["post:browse", "post:edit", "slug:generate"]The rules:
scopesis required. An app that needs nothing from the site declares[].- Each entry is a permission key from Scopes, as a string
- Each permission key appears once. Ghost refuses wildcards such as
post:*, and permission keys it doesn’t know. optional_scopesis reserved for optional scopes, which are on the way. Ghost refuses it until they arrive, so every scope is required for now.
Declare exactly the scopes your app’s calls use, and nothing more. Publishers see the whole list before they install, and Ghost refuses any call that needs a scope the site didn’t approve.
Where your app uses its scopes
Approving a scope lets your app use it in two places, with different limits:
- Your app’s page, while someone has the app open. It acts as that person, so a call goes through only when the approved scopes cover it and the person’s role allows it.
- Your app’s backend, at any time, with nobody present, once backend tokens arrive. Only the approved scopes will limit it, since there’s no person whose role applies. Until then, your backend has no way to call Ghost.
Only the site’s Owner and Administrators can open apps for now, and their role allows everything the scopes cover. So in practice, the approved scopes decide what your app can do, from its page and from its backend. Declare each scope knowing your app may use it unattended.
Scopes
Ghost knows these scopes, by permission key, and shows publishers the wording here for each. Ghost groups them by resource, the kind of object they act on, such as post, as the review screen does. Your manifest lists them without grouping. Pages come under the post scopes.
| Resource | Permission key | What it lets your app do |
|---|---|---|
post (Posts and pages) |
post:browse |
List, search and read every post and page, drafts included. |
post:read |
Read any post or page. | |
post:add |
Create posts and pages, including published ones, choose who can read them and their authors, and create tags for them. | |
post:edit |
Edit, publish and email posts and pages, change who can read them and their authors, and create tags for them. | |
post:destroy |
Delete posts and pages. | |
post:read_stats |
See how each post performed, by email, in signups and in feedback. | |
tag (Tags) |
tag:browse |
List and search tags. |
tag:read |
Read any tag. | |
tag:add |
Create tags. | |
tag:edit |
Edit tags. | |
tag:destroy |
Delete tags. | |
product (Tiers) |
product:browse |
List your tiers and their prices. |
newsletter (Newsletters) |
newsletter:browse |
List your newsletters. |
slug (URL slugs) |
slug:generate |
Ask Ghost for an unused URL slug. |
user (Staff) |
user:browse |
List staff users, with their profiles and email addresses. |
Tiers are called product in Ghost’s permissions, so their permission key is product:browse.
There are no scopes for members, settings, webhooks, themes, routes, or redirects, so apps can’t reach them. The permission keys may still change while apps are in beta.
Which scope a call needs
Each Admin API path your app calls through fetch belongs to one scope. Ghost Admin refuses a call whose scope the site didn’t approve, with a blocked error that names the scope:
| Call | Scope |
|---|---|
GET /posts/, GET /pages/, GET /search-index/posts/, GET /search-index/pages/ |
post:browse |
GET /posts/{id}/, GET /posts/slug/{slug}/, and the same for /pages/ |
post:read |
POST /posts/, POST /pages/ |
post:add |
PUT /posts/{id}/, PUT /pages/{id}/ |
post:edit |
DELETE /posts/{id}/, DELETE /pages/{id}/ |
post:destroy |
GET /tags/, GET /search-index/tags/ |
tag:browse |
GET /tags/{id}/, GET /tags/slug/{slug}/ |
tag:read |
POST /tags/ |
tag:add |
PUT /tags/{id}/ |
tag:edit |
DELETE /tags/{id}/ |
tag:destroy |
GET /tiers/ |
product:browse |
GET /newsletters/ |
newsletter:browse |
GET /slugs/{type}/{name}/ |
slug:generate |
GET /users/ |
user:browse |
GET /site/ |
None. Any app can read the site’s public details. |
A post or page call can include related objects, and each one needs its own scope as well as the call’s:
| Include | Scope |
|---|---|
authors |
None. Authors come with reading posts. |
tags |
tag:browse |
tiers |
product:browse |
newsletter |
newsletter:browse |
post_revisions |
None |
email, email.*, count.* such as count.signups, and sentiment |
post:read_stats, which also covers sorting by them |
For example, GET /posts/?include=tags,email,count.clicks needs post:browse, tag:browse, and post:read_stats. Without include, Ghost returns the related objects your app’s approved scopes cover.
GET /newsletters/ can include count.posts, but not count.members or count.active_members, since no scope covers members.
What publishers see
When someone installs your app, Ghost Admin lists its scopes, one line per resource, with Ghost’s wording for each scope you declared. An app that declares [] shows that it needs no access.
Changing scopes
Ghost compares your new manifest’s scopes with the ones the site approved:
- Adding a scope needs approval: Ghost Admin marks the app Needs approval, and it doesn’t open until an Administrator approves the new scope. The review screen lists what’s new.
- Removing a scope applies right away: Your app has less access, and nobody needs to approve it
- Reordering changes nothing
So when your app starts calling a new path, add its scope in the same change. Each site that has your app installed approves it the next time someone opens the app.
While apps are in beta
- Apps can make only the calls listed in Which scope a call needs. Any other call, or an
includenot listed there, fails with ablockederror, whatever your app’s scopes. - Staff email addresses come with staff records for now. That’s
GET /users/withuser:browse, and posts’ and pages’ authors, which are full staff records, so any app that reads posts gets them. Ghost will stop sending them to apps, so build your app without relying on them.