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

Masjid key · Content: read

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 · query

    Items per page, 1 to 100.

  • cursorstring · query

    The previous page's pagination.nextCursor; absent for the first page.

Returns

A page of polls.

  • objectlist

    Always list.

  • dataobject[]

    The items of this page.

    Show child attributes (16)
    • objectpoll

      Always poll.

    • idstring

      The poll id.

    • titlestring

      The question asked.

    • choicesobject[]

      The choices, each with its count.

    • choices[].idstring | null

      The choice id, to keep it on a change.

    • choices[].choicenumber | null

      The number of the choice.

    • choices[].textstring | null

      Its label.

    • choices[].votesinteger

      The votes it holds, one per voter.

    • totalVotesinteger

      Every vote counted, one per voter.

    • finishedboolean | null

      Whether voting has ended.

    • mediaobject | null

      The media it shows.

    • media.idstring

      The media id.

    • media.typestring | null

      picture, video or document.

    • media.urlstring | null

      The URL to show it from.

    • createdAtstring | null

      When it was created (ISO-8601).

    • updatedAtstring | null

      When it last changed (ISO-8601).

  • paginationobject

    Where this page stands.

    Show child attributes (3)
    • limitinteger

      The page size asked for.

    • hasMoreboolean

      Whether another page follows: stop on false, never on a short page.

    • nextCursorstring | null

      The cursor of the next page; null on the last one.

GET /v1/masjid/polls
curl "https://hub.masjidbox.com/v1/masjid/polls" \
  -H "Authorization: Bearer $MASJIDBOX_KEY"
200 · MasjidPollsPage
{
  "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

Masjid key · Content: read

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 · pathrequired

    The poll id.

Returns

The poll.

  • objectpoll

    Always poll.

  • idstring

    The poll id.

  • titlestring

    The question asked.

  • choicesobject[]

    The choices, each with its count.

    Show child attributes (4)
    • idstring | null

      The choice id, to keep it on a change.

    • choicenumber | null

      The number of the choice.

    • textstring | null

      Its label.

    • votesinteger

      The votes it holds, one per voter.

  • totalVotesinteger

    Every vote counted, one per voter.

  • finishedboolean | null

    Whether voting has ended.

  • mediaobject | null

    The media it shows.

    Show child attributes (3)
    • idstring

      The media id.

    • typestring | null

      picture, video or document.

    • urlstring | null

      The URL to show it from.

  • createdAtstring | null

    When it was created (ISO-8601).

  • updatedAtstring | null

    When it last changed (ISO-8601).

GET /v1/masjid/polls/{id}
curl "https://hub.masjidbox.com/v1/masjid/polls/pol_6af5c9e2bc095fbd2dc57365" \
  -H "Authorization: Bearer $MASJIDBOX_KEY"
200 · MasjidPoll
{
  "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

Masjid key · secret · Content: edit

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)
    • idstring

      A stored choice's id, to keep it and its votes; absent, a new one.

    • choiceintegerrequired

      The number of the choice, unique in the poll.

    • textstringrequired

      Its label.

  • finishedboolean

    Whether voting has ended.

  • mediastring | null

    A media of your organization (upload it first); null removes it.

  • titlestringrequired

    The question asked.

Returns

The poll, as stored.

  • objectpoll

    Always poll.

  • idstring

    The poll id.

  • titlestring

    The question asked.

  • choicesobject[]

    The choices, each with its count.

    Show child attributes (4)
    • idstring | null

      The choice id, to keep it on a change.

    • choicenumber | null

      The number of the choice.

    • textstring | null

      Its label.

    • votesinteger

      The votes it holds, one per voter.

  • totalVotesinteger

    Every vote counted, one per voter.

  • finishedboolean | null

    Whether voting has ended.

  • mediaobject | null

    The media it shows.

    Show child attributes (3)
    • idstring

      The media id.

    • typestring | null

      picture, video or document.

    • urlstring | null

      The URL to show it from.

  • createdAtstring | null

    When it was created (ISO-8601).

  • updatedAtstring | null

    When it last changed (ISO-8601).

POST /v1/masjid/polls
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"}'
Example request · MasjidPollCreate
{
  "choices": [
    {
      "choice": 1,
      "text": "Al-Fatiha"
    }
  ],
  "title": "Favourite surah"
}
201 · MasjidPoll
{
  "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

Masjid key · secret · Content: edit

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 · pathrequired

    The 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)
    • idstring

      A stored choice's id, to keep it and its votes; absent, a new one.

    • choiceintegerrequired

      The number of the choice, unique in the poll.

    • textstringrequired

      Its label.

  • finishedboolean

    Whether voting has ended.

  • mediastring | null

    A media of your organization (upload it first); null removes it.

  • titlestring

    The question asked.

Returns

The poll after the change.

  • objectpoll

    Always poll.

  • idstring

    The poll id.

  • titlestring

    The question asked.

  • choicesobject[]

    The choices, each with its count.

    Show child attributes (4)
    • idstring | null

      The choice id, to keep it on a change.

    • choicenumber | null

      The number of the choice.

    • textstring | null

      Its label.

    • votesinteger

      The votes it holds, one per voter.

  • totalVotesinteger

    Every vote counted, one per voter.

  • finishedboolean | null

    Whether voting has ended.

  • mediaobject | null

    The media it shows.

    Show child attributes (3)
    • idstring

      The media id.

    • typestring | null

      picture, video or document.

    • urlstring | null

      The URL to show it from.

  • createdAtstring | null

    When it was created (ISO-8601).

  • updatedAtstring | null

    When it last changed (ISO-8601).

PATCH /v1/masjid/polls/{id}
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}'
Example request · MasjidPollPatch
{
  "finished": true
}
200 · MasjidPoll
{
  "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

Masjid key · secret · Content: edit

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 · pathrequired

    The poll id.

Returns

Deleted. No body.

204 · No response body.

DELETE /v1/masjid/polls/{id}
curl -X DELETE "https://hub.masjidbox.com/v1/masjid/polls/pol_6af5c9e2bc095fbd2dc57365" \
  -H "Authorization: Bearer $MASJIDBOX_KEY"