Docs / Errors

INSUFFICIENT_SCOPE

403Insufficient scope

Why it happens

The key is valid, but it lacks the right the call needs. Each masjid key holds a right per product (none, read or edit):

  • a read on a product the key holds as none;
  • a write with a key that only reads the product;
  • any write with a publishable key, which never edits, whatever its rights say;
  • a developer key on the masjid API (/v1/masjid/*), which only a masjid's own key reaches.

What to do

  • In your Masjidbox dashboard, under API → Keys, check the key's rights. To write, use a secret key with edit on the product.
  • Rights cannot be changed on an existing key: create a new key with the rights you need, then revoke the old one.
  • Building an app for many masjids? Use the public API with a key from the developer console.

Example response

http
HTTP/1.1 403
{
  "type": "https://hub.masjidbox.com/docs/errors/INSUFFICIENT_SCOPE",
  "title": "Insufficient scope",
  "status": 403,
  "detail": "The key lacks the right this operation needs on its product: a read on a product set to none, a write without edit, any write with a publishable key, a masjid key on the public API.",
  "instance": "/v1/masjids/msj_abc123defg",
  "code": "INSUFFICIENT_SCOPE",
  "requestId": "req_8f14e45fceea167a5a36dedd4bea2543",
  "requestLogUrl": "https://hub.masjidbox.com/console/logs/req_8f14e45fceea167a5a36dedd4bea2543"
}