Contents

Inbound4 endpoints

Replies to your numbers, and opt-out keywords.

Base URLhttps://sms21.in

List replies

get/v1/inbound

Scopereports:read

Replies people sent to your numbers, newest first.

SMS21 acts on opt-out keywords itself: a reply starting with STOP (or UNSUBSCRIBE, CANCEL, …) adds the sender to your opt-out list, and START removes them. action says what happened.

Parameters9

  • fromquerystring

    Sender, international format.

  • toquerystring

    One of your numbers, international format.

  • actionquerystring

    Only replies SMS21 acted on (or did not).

  • receivedFromquerystring (date-time)

    Inclusive lower bound on arrival time.

  • receivedToquerystring (date-time)

    Inclusive upper bound on arrival time.

  • channelquerystring

    Only messages that arrived this way.

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

Responses

  • 200

    A page of replies.

  • 400

    Invalid filter or cursor.

    Example
    Response 400
    {
      "success": false,
      "error": {
        "code": "INVALID_RECIPIENT",
        "message": "The number is not a valid mobile number",
        "details": [
          {
            "field": "from",
            "message": "must be in international format"
          }
        ]
      },
      "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/inbound" \
  -H "X-API-Key: $SMS21_API_KEY"
Response 200
{
  "success": true,
  "data": [
    {
      "inboundId": "inb_01k55q8y4m3d9v7x2c6b0n1r8t",
      "from": "919876543210",
      "to": "919812345678",
      "numberId": "num_01k55q8y4m3d9v7x2c6b0n1r8t",
      "text": "STOP",
      "segments": 1,
      "keyword": "STOP",
      "action": "opt_out",
      "receivedAt": "2026-09-15T10:30:00.000Z",
      "channel": "sms",
      "deviceId": null,
      "senderName": null,
      "groupId": null,
      "media": null
    }
  ],
  "pagination": {
    "limit": 20,
    "hasMore": false,
    "nextCursor": null
  }
}

Simulate a reply (test keys)

post/v1/inbound/simulate

Scopereports:read

Delivers a reply through the sandbox as if a handset had sent it, so you can build an integration before a number is live: keyword handling, the opt-out list and your webhooks all run.

Test keys only, and only to a number assigned to the same project.

Body3

  • fromstringrequired
  • tostringrequired

    One of your numbers, assigned to this project.

  • textstringrequired

Responses

  • 202

    Queued for delivery through the sandbox.

  • 400

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

    Example
    Response 400
    {
      "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"
    }
  • 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

    Live keys cannot simulate inbound messages.

    Example
    Response 403
    {
      "success": false,
      "error": {
        "code": "FORBIDDEN",
        "message": "Inbound messages can only be simulated with a test API key"
      },
      "requestId": "0199491c-8f3a-7c2e-9b1d-5e7f3a2c4b6d"
    }
  • 404

    The number is not assigned to this project.

    Example
    Response 404
    {
      "success": false,
      "error": {
        "code": "NOT_FOUND",
        "message": "No active inbound number of this project has that number"
      },
      "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/inbound/simulate" \
  -H "X-API-Key: $SMS21_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"from":"919876543210","to":"919812345678","text":"STOP"}'
Response 202
{
  "success": true,
  "accepted": true
}

Fetch one reply

get/v1/inbound/{inboundId}

Scopereports:read

Parameters1

  • inboundIdpathstringrequired

    Inbound message ID (inb_…).

Responses

  • 200

    The reply.

  • 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/inbound/{inboundId}" \
  -H "X-API-Key: $SMS21_API_KEY"
Response 200
{
  "success": true,
  "inboundId": "inb_01k55q8y4m3d9v7x2c6b0n1r8t",
  "from": "919876543210",
  "to": "919812345678",
  "numberId": "num_01k55q8y4m3d9v7x2c6b0n1r8t",
  "text": "STOP",
  "segments": 1,
  "keyword": "STOP",
  "action": "opt_out",
  "receivedAt": "2026-09-15T10:30:00.000Z",
  "channel": "sms",
  "deviceId": null,
  "senderName": null,
  "groupId": null,
  "media": null
}

Download an attached file

get/v1/inbound/{inboundId}/media

Scopereports:read

The photo, video, voice note, document or sticker someone sent with a WhatsApp message (the media.url of a message.received webhook).

The body is the file itself. Images, video, audio and PDFs are served inline with their type; anything else as application/octet-stream with Content-Disposition: attachment. A WhatsApp Official file is available a few seconds after the event (404 until then).

Parameters1

  • inboundIdpathstringrequired

    Inbound message ID (inb_…).

Responses

  • 200

    The file.

  • 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/inbound/{inboundId}/media" \
  -H "X-API-Key: $SMS21_API_KEY"