API reference
Both APIs on one page: the public data of every masjid, for a developer key, and your own masjid's, for its own key. Generated from the OpenAPI documents the API is built from.
The Masjidbox API answers JSON over HTTPS, at resource-oriented URLs, with standard HTTP status codes. One base URL for everyone: the key you send decides what you reach.
Every example uses curl: there is no SDK to install yet.
https://hub.masjidbox.comAuthentication
Every call carries a key in the Authorization: Bearer header. Two kinds of key reach the same API.
| Key | Where you get it | What it reaches |
|---|---|---|
| Developer key | The developer console, once your project is approved | Every published masjid, without changing it (/v1/masjids/…), this project's contribution totals, referral links and masjid suggestions |
| Masjid key | Your Masjidbox dashboard, under API → Keys | Your organization: /v1/masjid/…, with a right per product (none, read, edit). Never the public API, not even for your own masjid. |
Both come as publishable (mbx_pk_live_…, made to embed in an app or other code you ship, never changes a masjid's data) or secret (mbx_sk_live_…, a server only). There are no test keys: every key reads the live data.
A developer key on /v1/masjid/… is refused with INSUFFICIENT_SCOPE, and so is a masjid key on /v1/masjids/….
curl "https://hub.masjidbox.com/v1/masjids/msj_abc123defg" \
-H "Authorization: Bearer $MASJIDBOX_KEY"Errors
A refusal answers an RFC 9457 problem: type links to the code's page, code is stable, requestId finds the call in your log.
401INVALID_API_KEYInvalid API key400INVALID_INPUTInvalid input400INVALID_MASJID_IDInvalid masjid id400INVALID_COORDINATESInvalid coordinates404MASJID_NOT_FOUNDMasjid not found404DONATION_CAMPAIGN_NOT_FOUNDDonation campaign not found404NOT_FOUNDNot found429RATE_LIMIT_EXCEEDEDRate limit exceeded429PROJECT_QUOTA_EXCEEDEDProject quota exceeded403ORIGIN_NOT_ALLOWEDOrigin not allowed403SECRET_KEY_IN_BROWSERSecret key in a browser500SERVER_ERRORServer error403INSUFFICIENT_SCOPEInsufficient scope404RESOURCE_NOT_FOUNDResource not found409RESOURCE_CONFLICTResource conflict400INVALID_CURSORInvalid cursor409IDEMPOTENCY_KEY_REUSEDIdempotency key reused409IDEMPOTENCY_REQUEST_UNSETTLEDIdempotent request unsettled503SERVICE_UNAVAILABLEService unavailable
{
"type": "https://hub.masjidbox.com/docs/errors/MASJID_NOT_FOUND",
"title": "Masjid not found",
"status": 404,
"detail": "No published masjid has this id.",
"instance": "/v1/masjids/msj_abc123defg",
"code": "MASJID_NOT_FOUND",
"requestId": "req_8f14e45fceea167a5a36dedd4bea2543",
"requestLogUrl": "https://hub.masjidbox.com/console/logs/req_8f14e45fceea167a5a36dedd4bea2543"
}Request ids
Every answer, served or refused, carries a request id, req_ and 32 hexadecimal characters, in the Masjidbox-Request-Id header and in the requestId of every error body. Quote it when you ask for help, never your key.
Masjidbox-Request-Id: req_8f14e45fceea167a5a36dedd4bea2543Limits
Limits are counted per developer project, or per masjid organization, all its keys together.
| Requests, per project | 3,600 / hour |
|---|---|
| Distinct masjids, per project | 300 / day |
| Burst, per key | 600 / minute |
| Reads | 3,600 / hour |
|---|---|
| Writes | 30 / hour and 300 / day |
A reached limit answers 429 with a Retry-After header, in seconds: wait for it before you call again.
HTTP/1.1 429 Too Many Requests
Retry-After: 42Versioning & changelog
The version is in the path: /v1/…. Additive changes (a new field, a new operation) can land inside V1; a breaking change would be a new version.
v1