API Opt-in

Programmatically opt-in a phone number as subscriber via API

Creating an API Opt-in Campaign

Checkout List Building - User Guide  to know more about creating a campaign

Getting a Campaign ID

When creating or editing an API opt-in campaign, the CampaignId to be provided in the API request can be found in the URL after "list-building".

Note: Double Opt-in is required for compliance.

Implementing API Opt-in 

Replace <CAMPAIGN_ID> with your API-specific Campaign ID

Phone numbers must be formatted using a '+' and country code

e.g., +16175551212 (E.164 format)

API Details


POST /api/v2/subscriber HTTP/1.1
Host: vyg.mobi
Accept: application/json
Content-Type: application/json

"phoneNumber": "+15134XXXXXX‬",
"campaignId": <CAMPAIGN_ID>


subscriberId: 99999,
state: "Subscribed",



curl --location --request POST 'https://vyg.mobi/api/v2/subscriber' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{ "phoneNumber": "+15134XXXXXX‬","campaignId": <CAMPAIGN_ID> }'


const data = {
phoneIn: "+15134XXXXXX‬",
campaignId: "<CAMPAIGN_ID>"

fetch('https://vyg.mobi/api/events/SubscribeNumber', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
body: JSON.stringify(data)
.then(response => response.json())
.then(data => {
console.log('Success:', data);
// Success: { subscriberId: 00000, state: "Subscribed" }
.catch((error) => {
console.error('Error:', error);
// Error: "Bad Request: Must be a US number starting with +1"

Note: CORS-supported to allow all origins.


Already Subscribed Messages are never sent via API Opt-In to prevent people who are already subscribed from receiving messages if spamming or a bulk import of numbers is done via API.

As a standard approach we recommend returning a 200 (Already Subscribed) vs. 201 (Subscribed Successfully) in the API call response which should be handled by the developer to present an already subscribed message to the customer on the UI.