Skip to content

    Arabic or English · ↑↓ to move · Enter to open · Esc to close

    العربية
    On this page

    Pagination

    Cursor pagination on every list: ?limit= and ?cursor=, answered with { data, nextCursor }.

    Lists return the newest items first, a page at a time:

    GET /v2/messages?limit=2
    {
      "data": [
        {
          "id": "3EB0A1B2C3D4E5F60718",
          "status": "read"
        },
        {
          "id": "3EB0C9D8E7F6A5B40312",
          "status": "delivered"
        }
      ],
      "nextCursor": "eyJ0IjoiMjAyNi0xMC0xM1QwODowMDowMC4wMDBaIn0"
    }
    ParameterMeaning
    limitMeaning1–100, default 25 (campaign recipients: 1–500, default 50). Otherwise 400 PAGINATION_LIMIT_INVALID.
    cursorMeaningThe nextCursor of the previous page, unchanged. A tampered cursor answers 400 PAGINATION_CURSOR_INVALID.

    nextCursor: null means you reached the last page. Cursors are opaque: don’t build or parse them. Items added while you page don’t shift or duplicate the next pages.

    Reading every page

    Python
    import os, requests
    
    def all_messages(**filters):
        cursor = None
        while True:
            params = {"limit": 100, **filters, **({"cursor": cursor} if cursor else {})}
            res = requests.get("https://mursilat.com/api/v2/messages",
                               headers={"Authorization": f"Bearer {os.environ['WASLA_API_KEY']}"},
                               params=params, timeout=30)
            res.raise_for_status()
            page = res.json()
            yield from page["data"]
            cursor = page["nextCursor"]
            if not cursor:
                break