Scopes and Permissions
To protect merchant data, SitePack uses a scope-based permission system. Apps must declare which scopes they require in their app.json manifest. These scopes are then authorized by the merchant during the app installation process.
How Scopes Work
When your app interacts with the SitePack API, it does so within the context of the granted scopes. If your app attempts to access a resource or perform an action that isn't covered by its authorized scopes, the API will return a 403 Forbidden error.
Principle of Least Privilege
You should only request the minimum set of scopes required for your app to function. Requesting unnecessary scopes can decrease merchant trust and may lead to your app being rejected during the review process.
Available Scopes
Scopes are generally structured as resource:action. Common actions include read and write.
Content
| Scope | Description |
|---|---|
content:read | Read access to site pages, blocks, and content. |
content:write | Write access to site pages and content. |
Media
| Scope | Description |
|---|---|
media:read | View and list media files in the library. |
media:write | Upload and manage media files. |
Leads
| Scope | Description |
|---|---|
leads:read | Read form submissions and lead data. |
leads:write | Create or update lead information. |
Payments
| Scope | Description |
|---|---|
payments:read | View transaction history and payment status. |
payments:write | Initiate or manage payments (where applicable). |
Declaring Scopes
Scopes are defined in the auth section of your app.json:
{
"uuid": "my-app",
"auth": {
"scopes": [
"content:read",
"media:read",
"leads:write"
]
}
}
Scoped Security
SitePack enforces these scopes at several levels:
- OAuth2 Authorization: The merchant is shown the list of requested scopes during install.
- API Gateway: Every REST API request is validated against the app's granted scopes.
- Webhook Delivery: Apps only receive webhooks for resources they have at least
readaccess to.
Next Steps
- Authentication (OAuth): How to obtain tokens with the scopes you've defined.
- App Manifest (app.json): Where to declare your app's scopes.
- Webhooks: Learn how scopes affect webhook data access.
- Publishing & Monetization: Understand how scopes are reviewed during the publication process.