{
  "info": {
    "name": "Resala API",
    "description": "The Resala SMS and verification-code API. Set the token variable to your API key before sending.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    {
      "key": "baseUrl",
      "value": "https://dev.resala.ly/api/v1"
    },
    {
      "key": "token",
      "value": ""
    }
  ],
  "item": [
    {
      "name": "Send a verification code (pins)",
      "request": {
        "method": "POST",
        "description": "Generates a one-time code, texts it, and returns it to you.",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer {{token}}"
          },
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/pins?service_name=MyApp",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "pins"
          ],
          "query": [
            {
              "key": "service_name",
              "value": "MyApp"
            },
            {
              "key": "test",
              "value": "",
              "disabled": true
            },
            {
              "key": "len",
              "value": "6",
              "disabled": true
            },
            {
              "key": "autofill",
              "value": "FA+9qCX9VSuA",
              "disabled": true
            },
            {
              "key": "sender",
              "value": "MyBrand",
              "disabled": true
            }
          ]
        },
        "body": {
          "mode": "raw",
          "raw": "{\n  \"phone\": \"218910001234\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        }
      }
    },
    {
      "name": "Send a templated message (send-template)",
      "request": {
        "method": "POST",
        "description": "Sends an approved template to one or more recipients, filling its variables.",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer {{token}}"
          },
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/messages/send-template?sms_template_id=TEMPLATE_ID",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "messages",
            "send-template"
          ],
          "query": [
            {
              "key": "sms_template_id",
              "value": "TEMPLATE_ID"
            },
            {
              "key": "test",
              "value": "",
              "disabled": true
            },
            {
              "key": "sender",
              "value": "MyBrand",
              "disabled": true
            },
            {
              "key": "scheduled_at",
              "value": "2026-10-20 09:00",
              "disabled": true
            }
          ]
        },
        "body": {
          "mode": "raw",
          "raw": "{\n  \"records\": [\n    { \"phone\": \"218910001234\", \"$1\": \"رسالة\", \"$2\": \"أحمد علي\" },\n    { \"phone\": \"218910001234\", \"$1\": \"رسالة\", \"$2\": \"سارة\", \"scheduled_at\": \"2026-10-20 09:00\" }\n  ]\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        }
      }
    },
    {
      "name": "Message history (sent-view)",
      "request": {
        "method": "GET",
        "description": "Everything you sent, codes and messages, with the state each reached.",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer {{token}}"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/sent-view?filters=source:message|pin",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "sent-view"
          ],
          "query": [
            {
              "key": "filters",
              "value": "source:message|pin"
            },
            {
              "key": "q",
              "value": "910001234",
              "disabled": true
            },
            {
              "key": "sorts",
              "value": "-created_at",
              "disabled": true
            },
            {
              "key": "page",
              "value": "1",
              "disabled": true
            },
            {
              "key": "paginate",
              "value": "20",
              "disabled": true
            }
          ]
        }
      }
    }
  ]
}