Skip to main content
This quickstart shows a safe first sync for one mosque. It updates approved profile fields, creates manual prayer-time rows, and verifies the result.

1. Create A Key In PocketMusala

  1. Open the PocketMusala Developer API portal from the mosque management surface.
  2. Select the mosque to sync.
  3. Create a key named after the external system, such as Website weekly sync.
  4. Grant sync:write when the external system should update profile content, prayer rows, announcements, or events. sync:write includes read access.
  5. Copy the raw key and store it in the external server’s secret manager.
PocketMusala shows the raw key only during key creation or rotation. It should not be stored in a mobile app, browser local storage, analytics, logs, or source control.

2. Set Shell Variables

Use the official API base URL and the key created in the PocketMusala portal:
export POCKETMUSALA_BASE_URL="https://api.pocketmusala.com"
export POCKETMUSALA_API_KEY="replace_with_the_key_from_the_portal"
export POCKETMUSALA_MOSQUE_ID="4f1f1111-2222-4333-8444-555555555555"

3. Check Capabilities

curl --request GET "$POCKETMUSALA_BASE_URL/v1/mosques/$POCKETMUSALA_MOSQUE_ID/capabilities" \
  --header "Authorization: Bearer $POCKETMUSALA_API_KEY" \
  --header "X-Request-Id: weekly-sync-capabilities-2026-06-08"
The response lists supported resources, scopes, approved profile fields, and prayer keys.

4. Update The Mosque Profile

curl --request PATCH "$POCKETMUSALA_BASE_URL/v1/mosques/$POCKETMUSALA_MOSQUE_ID/profile" \
  --header "Authorization: Bearer $POCKETMUSALA_API_KEY" \
  --header "Content-Type: application/json" \
  --header "X-Request-Id: weekly-profile-2026-06-08" \
  --data '{
    "communityName": "Downtown Mosque",
    "address": "100 Main Street, Anytown, NY 10001",
    "latitude": 40.7128,
    "longitude": -74.0060,
    "timeZoneId": "America/New_York",
    "status": "Open for daily prayers",
    "message": "Weekly schedule refreshed by the mosque website.",
    "donationLink": "https://downtown.example/donate"
  }'
PocketMusala rejects fields outside the approved profile allowlist.

5. Replace Prayer Rows Safely

Manual prayer times are stored as rows. A weekly sync should reconcile rows:
  1. Read the current rows.
  2. Create missing rows with POST /v1/mosques/{mosqueId}/prayers.
  3. Update existing rows with PATCH /v1/mosques/{mosqueId}/prayers/{prayerId}.
  4. Delete stale rows with DELETE /v1/mosques/{mosqueId}/prayers/{prayerId}.
Read current rows:
curl --request GET "$POCKETMUSALA_BASE_URL/v1/mosques/$POCKETMUSALA_MOSQUE_ID/prayers" \
  --header "Authorization: Bearer $POCKETMUSALA_API_KEY" \
  --header "X-Request-Id: weekly-prayers-read-2026-06-08"
Create a Fajr row:
curl --request POST "$POCKETMUSALA_BASE_URL/v1/mosques/$POCKETMUSALA_MOSQUE_ID/prayers" \
  --header "Authorization: Bearer $POCKETMUSALA_API_KEY" \
  --header "Content-Type: application/json" \
  --header "X-Request-Id: weekly-prayers-fajr-2026-06-08" \
  --data '{
    "prayerKey": "fajr",
    "adhanTime": "04:21",
    "iqamahTime": "04:45"
  }'
Create two Jummah rows for a mosque with multiple Friday prayers:
curl --request POST "$POCKETMUSALA_BASE_URL/v1/mosques/$POCKETMUSALA_MOSQUE_ID/prayers" \
  --header "Authorization: Bearer $POCKETMUSALA_API_KEY" \
  --header "Content-Type: application/json" \
  --header "X-Request-Id: weekly-prayers-jummah-1-2026-06-08" \
  --data '{"prayerKey":"jummah","adhanTime":"13:15","iqamahTime":"13:30"}'

curl --request POST "$POCKETMUSALA_BASE_URL/v1/mosques/$POCKETMUSALA_MOSQUE_ID/prayers" \
  --header "Authorization: Bearer $POCKETMUSALA_API_KEY" \
  --header "Content-Type: application/json" \
  --header "X-Request-Id: weekly-prayers-jummah-2-2026-06-08" \
  --data '{"prayerKey":"jummah","adhanTime":"14:15","iqamahTime":"14:30"}'

6. Verify The Snapshot

curl --request GET "$POCKETMUSALA_BASE_URL/v1/mosques/$POCKETMUSALA_MOSQUE_ID/sync" \
  --header "Authorization: Bearer $POCKETMUSALA_API_KEY" \
  --header "X-Request-Id: weekly-sync-verify-2026-06-08"
Save the X-Request-Id values and response bodies in your sync logs. They are the fastest way for a mosque admin or PocketMusala support to investigate a failed setup.