Your masjid · Content
Your polls
Your polls and their results, counted per choice. Never a vote: a vote carries the voter's IP.
Right on the key: Content: read for a read, edit (secret key) for a write.
Your polls
GET/v1/masjid/polls
Your organization's polls, each with its results counted per choice, one vote per voter: aggregates only, newest first, by cursor (limit 1 to 100, 25 by default; cursor from the previous page). Needs Content: read.
Parameters
limitinteger · queryItems per page, 1 to 100.
cursorstring · queryThe previous page's
pagination.nextCursor; absent for the first page.
Returns
A page of polls.
objectlistAlways
list.dataobject[]The items of this page.
Show child attributes (16)
objectpollAlways
poll.idstringThe poll id.
titlestringThe question asked.
choicesobject[]The choices, each with its count.
choices[].idstring | nullThe choice id, to keep it on a change.
choices[].choicenumber | nullThe number of the choice.
choices[].textstring | nullIts label.
choices[].votesintegerThe votes it holds, one per voter.
totalVotesintegerEvery vote counted, one per voter.
finishedboolean | nullWhether voting has ended.
mediaobject | nullThe media it shows.
media.idstringThe media id.
media.typestring | nullpicture,videoordocument.media.urlstring | nullThe URL to show it from.
createdAtstring | nullWhen it was created (ISO-8601).
updatedAtstring | nullWhen it last changed (ISO-8601).
paginationobjectWhere this page stands.
Show child attributes (3)
limitintegerThe page size asked for.
hasMorebooleanWhether another page follows: stop on false, never on a short page.
nextCursorstring | nullThe
cursorof the next page; null on the last one.
Errors
curl "https://hub.masjidbox.com/v1/masjid/polls" \
-H "Authorization: Bearer $MASJIDBOX_KEY"{
"data": [
{
"choices": [
{
"choice": 1,
"id": "000000000000000000000071",
"text": "Al-Fatiha",
"votes": 12
},
{
"choice": 2,
"id": "000000000000000000000072",
"text": "Al-Ikhlas",
"votes": 7
}
],
"createdAt": "2026-11-12T08:00:00.000Z",
"finished": false,
"id": "pol_6af5c9e2bc095fbd2dc57365",
"media": null,
"object": "poll",
"title": "Favourite surah",
"totalVotes": 19,
"updatedAt": "2026-11-12T08:00:00.000Z"
}
],
"object": "list",
"pagination": {
"hasMore": false,
"limit": 25,
"nextCursor": null
}
}One of your polls
GET/v1/masjid/polls/{id}
A poll of your organization and its results: the votes per choice and in all. Needs Content: read.
Parameters
idstring · pathrequiredThe poll id.
Returns
The poll.
objectpollAlways
poll.idstringThe poll id.
titlestringThe question asked.
choicesobject[]The choices, each with its count.
Show child attributes (4)
idstring | nullThe choice id, to keep it on a change.
choicenumber | nullThe number of the choice.
textstring | nullIts label.
votesintegerThe votes it holds, one per voter.
totalVotesintegerEvery vote counted, one per voter.
finishedboolean | nullWhether voting has ended.
mediaobject | nullThe media it shows.
Show child attributes (3)
idstringThe media id.
typestring | nullpicture,videoordocument.urlstring | nullThe URL to show it from.
createdAtstring | nullWhen it was created (ISO-8601).
updatedAtstring | nullWhen it last changed (ISO-8601).
Errors
curl "https://hub.masjidbox.com/v1/masjid/polls/pol_6af5c9e2bc095fbd2dc57365" \
-H "Authorization: Bearer $MASJIDBOX_KEY"{
"choices": [
{
"choice": 1,
"id": "000000000000000000000071",
"text": "Al-Fatiha",
"votes": 12
},
{
"choice": 2,
"id": "000000000000000000000072",
"text": "Al-Ikhlas",
"votes": 7
}
],
"createdAt": "2026-11-12T08:00:00.000Z",
"finished": false,
"id": "pol_6af5c9e2bc095fbd2dc57365",
"media": null,
"object": "poll",
"title": "Favourite surah",
"totalVotes": 19,
"updatedAt": "2026-11-12T08:00:00.000Z"
}Create a poll
POST/v1/masjid/polls
Creates a poll: the question and its choices (each numbered, unique in the poll). Nothing can vote through the API. Needs a secret key with Content: edit. Counts against the write quota: 30 writes an hour and 300 a day per organization.
Parameters
No parameters.
Request body
choicesobject[]The choices: the list replaces the poll's; a choice kept by its id keeps its votes.
Show child attributes (3)
idstringA stored choice's id, to keep it and its votes; absent, a new one.
choiceintegerrequiredThe number of the choice, unique in the poll.
textstringrequiredIts label.
finishedbooleanWhether voting has ended.
mediastring | nullA media of your organization (upload it first); null removes it.
titlestringrequiredThe question asked.
Returns
The poll, as stored.
objectpollAlways
poll.idstringThe poll id.
titlestringThe question asked.
choicesobject[]The choices, each with its count.
Show child attributes (4)
idstring | nullThe choice id, to keep it on a change.
choicenumber | nullThe number of the choice.
textstring | nullIts label.
votesintegerThe votes it holds, one per voter.
totalVotesintegerEvery vote counted, one per voter.
finishedboolean | nullWhether voting has ended.
mediaobject | nullThe media it shows.
Show child attributes (3)
idstringThe media id.
typestring | nullpicture,videoordocument.urlstring | nullThe URL to show it from.
createdAtstring | nullWhen it was created (ISO-8601).
updatedAtstring | nullWhen it last changed (ISO-8601).
Errors
curl -X POST "https://hub.masjidbox.com/v1/masjid/polls" \
-H "Authorization: Bearer $MASJIDBOX_KEY" \
-H "Content-Type: application/json" \
-d '{"choices":[{"choice":1,"text":"Al-Fatiha"}],"title":"Favourite surah"}'{
"choices": [
{
"choice": 1,
"text": "Al-Fatiha"
}
],
"title": "Favourite surah"
}{
"choices": [
{
"choice": 1,
"id": "000000000000000000000071",
"text": "Al-Fatiha",
"votes": 12
},
{
"choice": 2,
"id": "000000000000000000000072",
"text": "Al-Ikhlas",
"votes": 7
}
],
"createdAt": "2026-11-12T08:00:00.000Z",
"finished": false,
"id": "pol_6af5c9e2bc095fbd2dc57365",
"media": null,
"object": "poll",
"title": "Favourite surah",
"totalVotes": 19,
"updatedAt": "2026-11-12T08:00:00.000Z"
}Change a poll
PATCH/v1/masjid/polls/{id}
JSON Merge Patch: a field you leave out stays, null clears it. A media must be one of your organization's (med_ id), else 400. choices replaces the list: a choice kept by its id keeps its votes, a choice left out loses them. Nothing can vote through the API. Needs a secret key with Content: edit. Counts against the write quota: 30 writes an hour and 300 a day per organization.
Parameters
idstring · pathrequiredThe poll id.
Request body
choicesobject[]The choices: the list replaces the poll's; a choice kept by its id keeps its votes.
Show child attributes (3)
idstringA stored choice's id, to keep it and its votes; absent, a new one.
choiceintegerrequiredThe number of the choice, unique in the poll.
textstringrequiredIts label.
finishedbooleanWhether voting has ended.
mediastring | nullA media of your organization (upload it first); null removes it.
titlestringThe question asked.
Returns
The poll after the change.
objectpollAlways
poll.idstringThe poll id.
titlestringThe question asked.
choicesobject[]The choices, each with its count.
Show child attributes (4)
idstring | nullThe choice id, to keep it on a change.
choicenumber | nullThe number of the choice.
textstring | nullIts label.
votesintegerThe votes it holds, one per voter.
totalVotesintegerEvery vote counted, one per voter.
finishedboolean | nullWhether voting has ended.
mediaobject | nullThe media it shows.
Show child attributes (3)
idstringThe media id.
typestring | nullpicture,videoordocument.urlstring | nullThe URL to show it from.
createdAtstring | nullWhen it was created (ISO-8601).
updatedAtstring | nullWhen it last changed (ISO-8601).
Errors
curl -X PATCH "https://hub.masjidbox.com/v1/masjid/polls/pol_6af5c9e2bc095fbd2dc57365" \
-H "Authorization: Bearer $MASJIDBOX_KEY" \
-H "Content-Type: application/json" \
-d '{"finished":true}'{
"finished": true
}{
"choices": [
{
"choice": 1,
"id": "000000000000000000000071",
"text": "Al-Fatiha",
"votes": 12
},
{
"choice": 2,
"id": "000000000000000000000072",
"text": "Al-Ikhlas",
"votes": 7
}
],
"createdAt": "2026-11-12T08:00:00.000Z",
"finished": false,
"id": "pol_6af5c9e2bc095fbd2dc57365",
"media": null,
"object": "poll",
"title": "Favourite surah",
"totalVotes": 19,
"updatedAt": "2026-11-12T08:00:00.000Z"
}Delete a poll
DELETE/v1/masjid/polls/{id}
Deletes a poll and its votes. Needs a secret key with Content: edit. Counts against the write quota: 30 writes an hour and 300 a day per organization.
Parameters
idstring · pathrequiredThe poll id.
Returns
Deleted. No body.
204 · No response body.
Errors
curl -X DELETE "https://hub.masjidbox.com/v1/masjid/polls/pol_6af5c9e2bc095fbd2dc57365" \
-H "Authorization: Bearer $MASJIDBOX_KEY"