Contents

Messages2 endpoints

Delivery status and message reports.

Base URLhttps://sms21.in

List messages

get/v1/messages

Scopereports:read

Messages of the API key project, newest first. Filters combine with AND. Unknown query parameters are rejected.

Parameters10

  • limitqueryinteger
  • cursorquerystring

    pagination.nextCursor of the previous page.

  • pagequeryinteger

    Page number (1-based) for numbered pagination with pagination.total. Ignored with cursor; to read everything, follow cursor instead (faster on large lists).

  • statusquerystring

    Only this status.

  • typequerystring

    Only this type.

  • channelquerystring

    Only this channel.

  • mobilequerystring

    Recipient in international format.

  • templateIdquerystring

    SMS template (tmpl_…).

  • createdFromquerystring (date-time)

    Created at or after (ISO 8601).

  • createdToquerystring (date-time)

    Created at or before (ISO 8601).

Responses

  • 200

    A page of messages.

  • 400

    Invalid filter.

    Example
    Response 400
    {
      "success": false,
      "error": {
        "code": "VALIDATION_FAILED",
        "message": "Invalid filter",
        "details": [
          {
            "field": "createdFrom",
            "message": "must not be after createdTo"
          }
        ]
      },
      "requestId": "0199491c-8f3a-7c2e-9b1d-5e7f3a2c4b6d"
    }
  • 401

    The API key is missing, malformed, unknown, revoked or expired.

    Example
    Response 401
    {
      "success": false,
      "error": {
        "code": "AUTHENTICATION_REQUIRED",
        "message": "An API key is required; send it in the X-API-Key header or as \"Authorization: Bearer <key>\""
      },
      "requestId": "0199491c-8f3a-7c2e-9b1d-5e7f3a2c4b6d"
    }
  • 403

    The key may not do this: missing scope, IP not on the allow-list, company, project or key suspended by SMS21, project archived, wallet suspended or destination blocked.

    Example
    Response 403
    {
      "success": false,
      "error": {
        "code": "INSUFFICIENT_SCOPE",
        "message": "This API key does not have the required scope",
        "details": [
          {
            "message": "requires scope sms:send"
          }
        ]
      },
      "requestId": "0199491c-8f3a-7c2e-9b1d-5e7f3a2c4b6d"
    }
  • 429

    Rate limited. Wait Retry-After seconds, then retry with the same Idempotency-Key.

    Example
    Response 429
    {
      "success": false,
      "error": {
        "code": "RATE_LIMITED",
        "message": "Rate limit exceeded for this API key"
      },
      "requestId": "0199491c-8f3a-7c2e-9b1d-5e7f3a2c4b6d"
    }
  • 503

    Temporarily unavailable, or live sending paused by SMS21. Retry later with the same Idempotency-Key.

    Example
    Response 503
    {
      "success": false,
      "error": {
        "code": "SERVICE_UNAVAILABLE",
        "message": "Service temporarily unavailable"
      },
      "requestId": "0199491c-8f3a-7c2e-9b1d-5e7f3a2c4b6d"
    }
curl -X GET "https://sms21.in/v1/messages" \
  -H "X-API-Key: $SMS21_API_KEY"
Response 200
{
  "success": true,
  "data": [
    {
      "messageId": "msg_01k55q8y4m3d9v7x2c6b0n1r8t",
      "status": "delivered",
      "channel": "sms",
      "type": "transactional",
      "environment": "live",
      "to": "919876543210",
      "templateId": "tmpl_01k55q8y4m3d9v7x2c6b0n1r8t",
      "whatsappTemplateId": null,
      "segments": 1,
      "encoding": "gsm7",
      "failure": null,
      "queuedAt": "2026-09-15T10:30:00.000Z",
      "submittedAt": "2026-09-15T10:30:00.000Z",
      "sentAt": "2026-09-15T10:30:00.000Z",
      "deliveredAt": "2026-09-15T10:30:04.000Z",
      "failedAt": null
    }
  ],
  "pagination": {
    "limit": 20,
    "hasMore": true,
    "nextCursor": "eyJpZCI6IjAxOTk0OTFjIn0"
  }
}

Get a message

get/v1/messages/{messageId}

Scopereports:read

Current status of one message of this project. Prefer webhooks; if you poll, back off (for example 5 s, 30 s, 2 min) and stop at a final status (delivered, failed, rejected, expired).

Parameters1

  • messageIdpathstringrequired

Responses

  • 200

    The message.

  • 401

    The API key is missing, malformed, unknown, revoked or expired.

    Example
    Response 401
    {
      "success": false,
      "error": {
        "code": "AUTHENTICATION_REQUIRED",
        "message": "An API key is required; send it in the X-API-Key header or as \"Authorization: Bearer <key>\""
      },
      "requestId": "0199491c-8f3a-7c2e-9b1d-5e7f3a2c4b6d"
    }
  • 403

    The key may not do this: missing scope, IP not on the allow-list, company, project or key suspended by SMS21, project archived, wallet suspended or destination blocked.

    Example
    Response 403
    {
      "success": false,
      "error": {
        "code": "INSUFFICIENT_SCOPE",
        "message": "This API key does not have the required scope",
        "details": [
          {
            "message": "requires scope sms:send"
          }
        ]
      },
      "requestId": "0199491c-8f3a-7c2e-9b1d-5e7f3a2c4b6d"
    }
  • 404

    Not found, or not visible to the API key project.

    Example
    Response 404
    {
      "success": false,
      "error": {
        "code": "NOT_FOUND",
        "message": "Message not found"
      },
      "requestId": "0199491c-8f3a-7c2e-9b1d-5e7f3a2c4b6d"
    }
  • 429

    Rate limited. Wait Retry-After seconds, then retry with the same Idempotency-Key.

    Example
    Response 429
    {
      "success": false,
      "error": {
        "code": "RATE_LIMITED",
        "message": "Rate limit exceeded for this API key"
      },
      "requestId": "0199491c-8f3a-7c2e-9b1d-5e7f3a2c4b6d"
    }
  • 503

    Temporarily unavailable, or live sending paused by SMS21. Retry later with the same Idempotency-Key.

    Example
    Response 503
    {
      "success": false,
      "error": {
        "code": "SERVICE_UNAVAILABLE",
        "message": "Service temporarily unavailable"
      },
      "requestId": "0199491c-8f3a-7c2e-9b1d-5e7f3a2c4b6d"
    }
curl -X GET "https://sms21.in/v1/messages/{messageId}" \
  -H "X-API-Key: $SMS21_API_KEY"
Response 200
{
  "success": true,
  "messageId": "msg_01k55q8y4m3d9v7x2c6b0n1r8t",
  "status": "failed",
  "channel": "sms",
  "type": "transactional",
  "environment": "live",
  "to": "919876543210",
  "templateId": "tmpl_01k55q8y4m3d9v7x2c6b0n1r8t",
  "whatsappTemplateId": null,
  "segments": 1,
  "encoding": "gsm7",
  "failure": {
    "code": "DELIVERY_FAILED"
  },
  "queuedAt": "2026-09-15T10:30:00.000Z",
  "submittedAt": "2026-09-15T10:30:00.000Z",
  "sentAt": null,
  "deliveredAt": null,
  "failedAt": "2026-09-15T10:31:00.000Z"
}