Skip to content
Navigation

Create an opt-out

Opts a number out so messages are no longer sent to it. The number is added to your default opt-out list unless you pass opt_out_list_id or opt_out_list_name (not both). A list named by opt_out_list_name is created if it does not exist. If the number is already opted out, the existing opt-out is returned.

POST
https://app.touchsms.com.au/api/v2/optouts

Authorization

  • basicAuth
    HTTP
    required

Request body JSON required

  • number
    string
    required

    Number to opt out, ideally in E.164 format.

  • opt_out_list_id
    optional
    integer

    Add to this opt-out list. Cannot be combined with opt_out_list_name.

  • opt_out_list_name
    optional
    string

    Add to the list with this name, creating it if needed. Cannot be combined with opt_out_list_id.

    maxLength: 255

Returns

200

The number was already opted out; the existing opt-out is returned.

JSON
  • data
    optional
    object
    • id
      optional
      integer
    • user
      optional
      integer

      ID of the user that owns the opt-out.

    • number
      optional
      string

      Opted-out number in E.164 format.

    • method
      optional
      manual
      or
      import
      or
      link
      or
      reply
      or
      chat
      or
      api
      +2 more

      How the opt-out was created.

    • opt_out_list
      optional
      object

      The list this opt-out belongs to.

      • id
        optional
        integer
      • name
        optional
        string
      • is_default
        optional
        boolean
    • updated
      optional
      string
      format: date-time
    • created
      optional
      string
      format: date-time

201

Opt-out created.

JSON
  • data
    optional
    object
    • id
      optional
      integer
    • user
      optional
      integer

      ID of the user that owns the opt-out.

    • number
      optional
      string

      Opted-out number in E.164 format.

    • method
      optional
      manual
      or
      import
      or
      link
      or
      reply
      or
      chat
      or
      api
      +2 more

      How the opt-out was created.

    • opt_out_list
      optional
      object

      The list this opt-out belongs to.

      • id
        optional
        integer
      • name
        optional
        string
      • is_default
        optional
        boolean
    • updated
      optional
      string
      format: date-time
    • created
      optional
      string
      format: date-time

400

The number could not be parsed.

401

Missing, malformed or invalid API credentials.
JSON
  • message
    string
    required

422

The request failed validation. errors lists the messages for each invalid field.
JSON
  • message
    optional
    string
  • errors
    optional
    map of
    array<string>

Type to search…

↑↓ navigate↵ selectEsc close