Skip to main content

Prayers API

The Prayers API enables creation, management, and discovery of prayer sessions within the PRAYSAP platform.

Endpoints Overview

MethodEndpointDescription
POST/api/prayersCreate a new prayer
GET/api/prayersSearch and discover prayers
GET/api/prayers/{id}Get specific prayer details
POST/api/prayers/{id}/joinJoin a prayer session
POST/api/prayers/{id}/leaveLeave a prayer session
POST/api/prayers/{id}/check-inCheck-in to a prayer
GET/api/prayers/mapGet prayers for map view

Create Prayer

Create a new prayer session. Prayer times are automatically calculated based on type, date, and location.

Endpoint: POST /api/prayers

Authentication: Required

Request Body

{
"type": "Fajr",
"date": "2025-08-01",
"location": {
"address": "Bangalore, India",
"geo": {
"type": "Point",
"coordinates": [77.5946, 12.9716]
}
},
"spaceType": "Home",
"genderPolicy": {
"type": "MEN"
},
"description": "Early morning prayer at my home.",
"capacity": 10,
"unlimitedCapacity": false,
"resources": [
{
"type": "Prayer mats",
"available": 5,
"requested": 2
}
],
"recurrence": "none",
"locationPrivacy": "exact",
"autoApproveAttendees": true
}

Request Parameters

FieldTypeRequiredDescription
typestringYesPrayer type: "Fajr", "Dhuhr", "Asr", "Maghrib", "Isha", "Jummah"
datestringYesPrayer date in YYYY-MM-DD format
location.addressstringYesHuman-readable address
location.geoobjectYesGeoJSON Point with coordinates [longitude, latitude]
spaceTypestringYesType of space: "Home", "Mosque", "Office", "Outdoor", etc.
genderPolicy.typestringYesGender policy: "MEN", "WOMEN", "MIXED"
descriptionstringNoDescription of the prayer session
capacitynumberNoMaximum number of attendees
unlimitedCapacitybooleanNoWhether to allow unlimited attendees
resourcesarrayNoAvailable resources (prayer mats, etc.)
recurrencestringNoRecurrence pattern: "none", "daily", "weekly"
locationPrivacystringNoLocation visibility: "exact", "approximate", "hidden"
autoApproveAttendeesbooleanNoWhether to auto-approve join requests

Response

Status: 201 Created

{
"id": "prayer_id_123",
"type": "Fajr",
"date": "2025-07-01T04:30:00.000Z",
"time": "04:30",
"location": {
"geo": {
"type": "Point",
"coordinates": [77.5946, 12.9716]
},
"address": "123 Main St, Bangalore"
},
"genderPolicy": {
"type": "MEN"
},
"description": "Early morning prayer at my home.",
"rules": ["Bring your own prayer mat"],
"capacity": 10,
"unlimitedCapacity": false,
"resources": [
{
"type": "mat",
"available": 5,
"requested": 2
}
],
"spaceType": "Home",
"recurrence": "none",
"locationPrivacy": "exact",
"autoApproveAttendees": true,
"host": {
"userId": "user123",
"name": "Host Name"
},
"attendees": [],
"status": "scheduled",
"createdAt": "2025-07-01T00:00:00.000Z"
}

Search Prayers

Discover prayers based on various filters and search criteria.

Endpoint: GET /api/prayers

Authentication: Required

Query Parameters

ParameterTypeDescription
locationstringFilter by location/address
typestringFilter by prayer type
datestringFilter by specific date
genderstringFilter by gender policy
radiusnumberSearch radius in kilometers
latnumberLatitude for location-based search
lngnumberLongitude for location-based search
pagenumberPage number for pagination
limitnumberNumber of results per page
sortstringSort order: "dateAsc", "dateDesc", "distance"

Response

Status: 200 OK

{
"items": [
{
"id": "prayer_id_123",
"type": "Fajr",
"date": "2025-07-01T04:30:00.000Z",
"time": "04:30",
"location": {
"address": "Bangalore, India",
"approximate": {
"type": "Point",
"coordinates": [77.59, 12.97]
}
},
"host": {
"name": "Host Name",
"verified": true
},
"capacity": 10,
"attendeesCount": 3,
"availableSpots": 7,
"distance": 2.5
}
],
"total": 25,
"page": 1,
"limit": 10,
"hasNextPage": true
}

Get Prayer Details

Retrieve detailed information about a specific prayer.

Endpoint: GET /api/prayers/{id}

Authentication: Required

Path Parameters

ParameterTypeRequiredDescription
idstringYesPrayer ID

Response

Status: 200 OK

{
"id": "prayer_id_123",
"type": "Fajr",
"date": "2025-07-01T04:30:00.000Z",
"time": "04:30",
"location": {
"geo": {
"type": "Point",
"coordinates": [77.5946, 12.9716]
},
"address": "123 Main St, Bangalore"
},
"host": {
"userId": "host123",
"name": "Host Name",
"verified": true,
"image": "https://example.com/avatar.jpg"
},
"description": "Early morning prayer at my home.",
"rules": ["Bring your own prayer mat", "Arrive 10 minutes early"],
"genderPolicy": {
"type": "MEN"
},
"capacity": 10,
"attendees": [
{
"userId": "user456",
"name": "Attendee Name",
"joinedAt": "2025-06-30T20:00:00.000Z",
"status": "confirmed"
}
],
"resources": [
{
"type": "Prayer mats",
"available": 5,
"requested": 2
}
],
"spaceType": "Home",
"status": "scheduled",
"createdAt": "2025-06-30T18:00:00.000Z",
"updatedAt": "2025-06-30T19:30:00.000Z"
}

Status: 404 Not Found

{
"error": {
"message": "Prayer not found",
"code": "PRAYER_NOT_FOUND"
}
}

Join Prayer

Join a prayer session as an attendee.

Endpoint: POST /api/prayers/{id}/join

Authentication: Required

Path Parameters

ParameterTypeRequiredDescription
idstringYesPrayer ID

Response

Status: 200 OK

{
"message": "Successfully joined prayer",
"status": "confirmed",
"joinedAt": "2025-06-30T20:00:00.000Z"
}

Status: 400 Bad Request

{
"error": {
"message": "Already joined or request pending",
"code": "ALREADY_JOINED"
}
}

Leave Prayer

Leave a prayer session you previously joined.

Endpoint: POST /api/prayers/{id}/leave

Authentication: Required

Path Parameters

ParameterTypeRequiredDescription
idstringYesPrayer ID

Response

Status: 200 OK

{
"message": "Successfully left prayer",
"leftAt": "2025-06-30T21:00:00.000Z"
}

Status: 400 Bad Request

{
"error": {
"message": "Not an attendee of this prayer",
"code": "NOT_ATTENDEE"
}
}

Check-in to Prayer

Check-in to a prayer event to confirm attendance.

Endpoint: POST /api/prayers/{id}/check-in

Authentication: Required

Path Parameters

ParameterTypeRequiredDescription
idstringYesPrayer ID

Request Body

{
"lat": 12.9716,
"lng": 77.5946
}
FieldTypeRequiredDescription
latnumberYesCurrent latitude
lngnumberYesCurrent longitude

Response

Status: 200 OK

{
"message": "Successfully checked in",
"checkedInAt": "2025-07-01T04:25:00.000Z",
"distance": 0.05
}

Status: 400 Bad Request

{
"error": {
"message": "Too far from prayer location or invalid time",
"code": "CHECKIN_VALIDATION_ERROR"
}
}

Get Map View

Get prayers formatted for map display with location markers.

Endpoint: GET /api/prayers/map

Authentication: Required

Query Parameters

ParameterTypeDescription
boundsstringMap bounds in format "lat1,lng1,lat2,lng2"
zoomnumberCurrent map zoom level
typestringFilter by prayer type

Response

Status: 200 OK

{
"markers": [
{
"id": "prayer_id_123",
"type": "Fajr",
"coordinates": [77.5946, 12.9716],
"time": "04:30",
"date": "2025-07-01",
"attendeesCount": 3,
"capacity": 10,
"genderPolicy": "MEN",
"host": {
"name": "Host Name",
"verified": true
}
}
],
"bounds": {
"north": 13.0,
"south": 12.9,
"east": 77.7,
"west": 77.5
}
}

Prayer Types

Supported prayer types:

  • Fajr - Dawn prayer
  • Dhuhr - Midday prayer
  • Asr - Afternoon prayer
  • Maghrib - Sunset prayer
  • Isha - Night prayer
  • Jummah - Friday prayer
  • Tarawih - Ramadan night prayer
  • Eid - Eid prayers

Gender Policies

  • MEN - Men only
  • WOMEN - Women only
  • MIXED - Mixed gender with appropriate arrangements

Space Types

  • Home - Private residence
  • Mosque - Mosque or Islamic center
  • Office - Workplace prayer room
  • Outdoor - Park or outdoor location
  • Community - Community center
  • School - Educational institution

Prayer Status

  • scheduled - Prayer is scheduled and accepting attendees
  • in_progress - Prayer is currently happening
  • completed - Prayer has finished
  • cancelled - Prayer has been cancelled
  • archived - Prayer has been archived