Docs / For your masjid

Keys & rights

Every call sends a key in the Authorization header:

http
Authorization: Bearer mbx_sk_live_…

Keys are created and revoked in your Masjidbox dashboard, under API → Keys, by a manager with the API permission. The developer console does not create masjid keys, and a developer key does not reach /v1/masjid/*: it is refused with INSUFFICIENT_SCOPE.

A masjid key serves your own masjids only. It reads and edits them through /v1/masjid/*, and is refused with INSUFFICIENT_SCOPE on the public API, /v1/masjids/*, including for your own masjids.

Publishable or secret

  • A publishable key (mbx_pk_live_…) only reads. It is made to sit in a web page, a widget or a mobile app, where anyone can see it.
  • A secret key (mbx_sk_live_…) reads and edits. Keep it on a server. Anyone who reads the code of a page or an app can copy a key and change your prayer times with it.

Rights per product

Each key holds a right per product: none, read or edit (edit includes read). A key cannot hold more than the manager who creates it.

ProductWhat it covers
Masjid profilethe masjid's public profile
Prayer timesprayer, iqamah and jumu'ah times
Donation campaignsthe organization's campaigns

A call without the right it needs is refused with INSUFFICIENT_SCOPE. A publishable key never edits, whatever its rights say.

Changing a key

A manager with API write can change a key's label and rights from API → Keys. The kind and the expiry stay as created. A right the key holds above that manager's own access stays as it is. New rights apply within a minute, and the owner is emailed when a key gains an edit right.

Expiry and revoking

A key may expire 7, 30 or 90 days or a year after its creation, or never; the owner of the organization is emailed 7 days before. Revoking a key in the dashboard refuses it within a minute with INVALID_API_KEY. Every key creation, change and revocation shows in your dashboard's activity log, and the owner is emailed when a secret key that can edit is created.