Contents

SMS1 endpoint

Transactional SMS with DLT templates.

Base URLhttps://sms21.in

Send an SMS

post/v1/sms/send

Scopesms:send

Queues one SMS (202 Accepted). Follow its status with webhooks or GET /messages/{messageId}.

Send exactly one of:

  • templateId + variables: an approved DLT template. Required for live SMS to DLT countries (India). The sender ID comes from the template.
  • text (optionally senderId): free text, for test keys and destinations without DLT rules.

A single SMS holds 160 GSM-7 or 70 Unicode (UCS-2) characters; longer texts are split into segments (153 / 67 characters each) and billed per segment, up to 10 segments.

Parameters1

  • Idempotency-Keyheaderstring

    Makes the request safe to retry: repeating it with the same key and body returns the original result (with Idempotent-Replayed: true) instead of sending again. Use one key per logical message, e.g. derived from your order or login-attempt ID. Reusing a key with a different body is 409 IDEMPOTENCY_KEY_REUSED.

Body5

  • tostringrequired

    Recipient in international format: "919876543210" or "+919876543210".

  • templateIdstring

    Approved SMS template of the key's company. Required for live SMS to DLT countries (India); the sender ID comes from the template.

  • variablesobject

    Values for the template {{variables}}. Only with templateId.

  • textstring

    Free text: test keys and destinations without DLT rules only. At most 10 SMS segments.

  • senderIdstring

    Free text only: alphanumeric sender (3-11 characters) or a phone number.

Responses

  • 202

    Accepted and queued.

  • 400

    Invalid request or content.

    Example
    Response 400
    {
      "success": false,
      "error": {
        "code": "INVALID_RECIPIENT",
        "message": "The recipient is not a valid mobile number",
        "details": [
          {
            "field": "to",
            "message": "to must be a mobile number in international format, e.g. 919876543210"
          }
        ]
      },
      "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"
    }
  • 402

    Live keys only: the wallet cannot cover the message. Add funds; retrying will not help.

    Example
    Response 402
    {
      "success": false,
      "error": {
        "code": "INSUFFICIENT_BALANCE",
        "message": "Insufficient wallet balance"
      },
      "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

    The template does not exist in this company.

    Example
    Response 404
    {
      "success": false,
      "error": {
        "code": "NOT_FOUND",
        "message": "Template not found",
        "details": [
          {
            "field": "templateId",
            "message": "no such template"
          }
        ]
      },
      "requestId": "0199491c-8f3a-7c2e-9b1d-5e7f3a2c4b6d"
    }
  • 409

    Conflicting state.

    Example
    Response 409
    {
      "success": false,
      "error": {
        "code": "IDEMPOTENCY_KEY_REUSED",
        "message": "This Idempotency-Key was already used with a different request"
      },
      "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 POST "https://sms21.in/v1/sms/send" \
  -H "X-API-Key: $SMS21_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"to":"919876543210","templateId":"tmpl_01k55q8y4m3d9v7x2c6b0n1r8t","variables":{"order":"1042"}}'
Response 202
{
  "success": true,
  "messageId": "msg_01k55q8y4m3d9v7x2c6b0n1r8t",
  "status": "queued",
  "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": null,
  "sentAt": null,
  "deliveredAt": null,
  "failedAt": null
}