Contents

Contacts10 endpoints

Saved audiences a campaign can be sent to.

Base URLhttps://sms21.in

List contact lists

get/v1/contacts/lists

Scopecontacts:read

Lists of the key’s company, newest first.

Parameters3

  • 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

    Contact lists.

  • 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"
    }
curl -X GET "https://sms21.in/v1/contacts/lists" \
  -H "X-API-Key: $SMS21_API_KEY"
Response 200
{
  "success": true,
  "data": [
    {
      "id": "lst_01k55q8y4m3d9v7x2c6b0n1r8t",
      "name": "October offers",
      "description": null,
      "contactCount": 2,
      "createdAt": "2026-09-15T10:30:00.000Z",
      "updatedAt": "2026-09-15T10:30:00.000Z"
    }
  ],
  "pagination": {
    "limit": 25,
    "hasMore": false,
    "nextCursor": null
  }
}

Create a contact list

post/v1/contacts/lists

Scopecontacts:manage

A saved audience. Send a campaign to it with listId instead of listing recipients.

Body2

  • namestringrequired
  • descriptionstring

Responses

  • 201

    The list.

  • 400

    The request is not valid.

    Example
    Response 400
    {
      "success": false,
      "error": {
        "code": "VALIDATION_FAILED",
        "message": "Request validation failed",
        "details": [
          {
            "field": "name",
            "message": "must be 1 to 120 characters"
          }
        ]
      },
      "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"
    }
  • 409

    The name is taken, or the company has too many lists.

    Example
    Response 409
    {
      "success": false,
      "error": {
        "code": "CONFLICT",
        "message": "A contact list with this name already exists"
      },
      "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"
    }
curl -X POST "https://sms21.in/v1/contacts/lists" \
  -H "X-API-Key: $SMS21_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"October offers"}'
Response 201
{
  "success": true,
  "id": "lst_01k55q8y4m3d9v7x2c6b0n1r8t",
  "name": "October offers",
  "description": null,
  "contactCount": 2,
  "createdAt": "2026-09-15T10:30:00.000Z",
  "updatedAt": "2026-09-15T10:30:00.000Z"
}

Get a contact list

get/v1/contacts/lists/{listId}

Scopecontacts:read

Parameters1

  • listIdpathstringrequired

Responses

  • 200

    The list.

  • 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"
    }
curl -X GET "https://sms21.in/v1/contacts/lists/{listId}" \
  -H "X-API-Key: $SMS21_API_KEY"
Response 200
{
  "success": true,
  "id": "lst_01k55q8y4m3d9v7x2c6b0n1r8t",
  "name": "October offers",
  "description": null,
  "contactCount": 2,
  "createdAt": "2026-09-15T10:30:00.000Z",
  "updatedAt": "2026-09-15T10:30:00.000Z"
}

Delete a contact list

delete/v1/contacts/lists/{listId}

Scopecontacts:manage

Deletes the list, its contacts and its import history. Campaigns already created are untouched.

Parameters1

  • listIdpathstringrequired

Responses

  • 204

    Deleted.

  • 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"
    }
curl -X DELETE "https://sms21.in/v1/contacts/lists/{listId}" \
  -H "X-API-Key: $SMS21_API_KEY"

Rename a contact list

patch/v1/contacts/lists/{listId}

Scopecontacts:manage

Parameters1

  • listIdpathstringrequired

Body2

  • namestringrequired
  • descriptionstring

Responses

  • 200

    The list.

  • 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"
    }
  • 409

    The name is taken.

    Example
    Response 409
    {
      "success": false,
      "error": {
        "code": "CONFLICT",
        "message": "A contact list with this name already exists"
      },
      "requestId": "0199491c-8f3a-7c2e-9b1d-5e7f3a2c4b6d"
    }
curl -X PATCH "https://sms21.in/v1/contacts/lists/{listId}" \
  -H "X-API-Key: $SMS21_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"October offers (India)"}'
Response 200
{
  "success": true,
  "id": "lst_01k55q8y4m3d9v7x2c6b0n1r8t",
  "name": "October offers",
  "description": null,
  "contactCount": 2,
  "createdAt": "2026-09-15T10:30:00.000Z",
  "updatedAt": "2026-09-15T10:30:00.000Z"
}

Import contacts from CSV

post/v1/contacts/lists/{listId}/import

Scopecontacts:manage

Uploads the file as the request body with Content-Type: text/csv.

The first row names the columns. One of them must be the number (to, mobile, phone, number or msisdn); every other column becomes a template variable available as {{name}}.

Rows that cannot be used are reported with their line numbers and the rest are imported, so a file with three bad numbers still loads the other 4,997. Duplicate numbers within the file are collapsed, keeping the first.

Re-importing a number updates its attributes but never its status: someone who unsubscribed stays unsubscribed.

Parameters3

  • listIdpathstringrequired
  • modequerystring

    merge (default) updates and adds; replace empties the list first.

  • fileNamequerystring

    Recorded with the import so uploads can be told apart.

Responses

  • 201

    What the upload did.

  • 400

    The file cannot be read, or carries too many rows.

    Example
    Response 400
    {
      "success": false,
      "error": {
        "code": "CSV_INVALID",
        "message": "No number column found; name one of them to, mobile, phone, number, msisdn"
      },
      "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"
    }
  • 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"
    }
  • 409

    The list would grow beyond its limit.

    Example
    Response 409
    {
      "success": false,
      "error": {
        "code": "CONTACTS_LIMIT_REACHED",
        "message": "A list may hold at most 50000 contacts"
      },
      "requestId": "0199491c-8f3a-7c2e-9b1d-5e7f3a2c4b6d"
    }
curl -X POST "https://sms21.in/v1/contacts/lists/{listId}/import" \
  -H "X-API-Key: $SMS21_API_KEY"
Response 201
{
  "success": true,
  "id": "imp_01k55q8y4m3d9v7x2c6b0n1r8t",
  "fileName": "october.csv",
  "totalRows": 4,
  "imported": 2,
  "updated": 0,
  "invalid": 1,
  "duplicates": 1,
  "errors": [
    {
      "line": 3,
      "message": "\"not-a-number\" is not a mobile number in international format"
    }
  ],
  "createdAt": "2026-09-15T10:30:00.000Z"
}

List imports

get/v1/contacts/lists/{listId}/imports

Scopecontacts:read

What each upload did, newest first.

Parameters4

  • listIdpathstringrequired
  • 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

    Imports.

  • 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"
    }
curl -X GET "https://sms21.in/v1/contacts/lists/{listId}/imports" \
  -H "X-API-Key: $SMS21_API_KEY"
Response 200
{
  "success": true,
  "data": [],
  "pagination": {
    "limit": 25,
    "hasMore": false,
    "nextCursor": null
  }
}

List contacts

get/v1/contacts/lists/{listId}/contacts

Scopecontacts:read

Parameters6

  • listIdpathstringrequired
  • statusquerystring

    Only contacts in this state.

  • mobilequerystring

    Exact number lookup.

  • 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

    Contacts.

  • 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"
    }
curl -X GET "https://sms21.in/v1/contacts/lists/{listId}/contacts" \
  -H "X-API-Key: $SMS21_API_KEY"
Response 200
{
  "success": true,
  "data": [],
  "pagination": {
    "limit": 25,
    "hasMore": false,
    "nextCursor": null
  }
}

Remove a contact

delete/v1/contacts/lists/{listId}/contacts/{contactId}

Scopecontacts:manage

Deletes the row. To keep the record but stop sending, use unsubscribe.

Parameters2

  • listIdpathstringrequired
  • contactIdpathstringrequired

Responses

  • 204

    Removed.

  • 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"
    }
curl -X DELETE "https://sms21.in/v1/contacts/lists/{listId}/contacts/{contactId}" \
  -H "X-API-Key: $SMS21_API_KEY"

Unsubscribe a contact

post/v1/contacts/lists/{listId}/contacts/{contactId}/unsubscribe

Scopecontacts:manage

Takes the contact out of campaigns built from this list, keeping the record. Re-importing the number does not undo it.

Parameters2

  • listIdpathstringrequired
  • contactIdpathstringrequired

Responses

  • 200

    The contact.

  • 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"
    }
curl -X POST "https://sms21.in/v1/contacts/lists/{listId}/contacts/{contactId}/unsubscribe" \
  -H "X-API-Key: $SMS21_API_KEY"
Response 200
{
  "success": true,
  "id": "cnt_01k55q8y4m3d9v7x2c6b0n1r8t",
  "to": "919876543210",
  "attributes": {
    "name": "Asha"
  },
  "status": "unsubscribed",
  "createdAt": "2026-09-15T10:30:00.000Z",
  "updatedAt": "2026-09-15T10:30:00.000Z"
}