SMS Phone Confirmation API — Send OTP

Support DQE
Support DQE
  • Updated
SMS Phone Confirmation API

The /GDPR_MSG/ endpoint sends an SMS containing a verification code to a phone number, along with the selected GDPR communication consent channels.

When to use this endpoint - Call GDPR_MSG to send a one-time SMS verification code to a phone number. Once the user replies with the code, verify it using SMS Phone Confirmation API — Verify OTP (/GDPR_VERIF/) →

/GDPR_MSG/

Request

Both GET and POST are supported.

{SERVER_ADDRESS} and {LICENCE_CODE} are provided by DQE upon account creation. Contact your DQE account manager to obtain these credentials.
GEThttps://{SERVER_ADDRESS}/GDPR_MSG/?Phone={PHONE}&Duration={DURATION}&Custom_sms={CUSTOM_SMS_CONTENT}&Phonecom={VALUE_PHONECOM}&Email={VALUE_EMAIL}&Post={VALUE_POST}&Sms={VALUE_SMS}&Country={COUNTRY_CODE}&Licence={LICENCE_CODE}&Company={COMPANY_NAME}

Code examples

Send a verification code

curl "https://{SERVER_ADDRESS}/GDPR_MSG/?Licence={LICENCE_CODE}&Phone=33612345678&Country=FRA&Company=MYCOMPANY&Custom_sms=Your%20confirmation%20code%20is"
fetch("https://{SERVER_ADDRESS}/GDPR_MSG/?" + new URLSearchParams({ Licence: "{LICENCE_CODE}", Phone: "33612345678", Country: "FRA", Company: "MYCOMPANY", Custom_sms: "Your confirmation code is" })) .then(r => r.json()) .then(data => console.log(data));
import requests response = requests.get( "https://{SERVER_ADDRESS}/GDPR_MSG/", params={ "Licence": "{LICENCE_CODE}", "Phone": "33612345678", "Country": "FRA", "Company": "MYCOMPANY", "Custom_sms": "Your confirmation code is", }, ) print(response.json())
<?php $params = http_build_query([ 'Licence' => '{LICENCE_CODE}', 'Phone' => '33612345678', 'Country' => 'FRA', 'Company' => 'MYCOMPANY', 'Custom_sms' => 'Your confirmation code is', ]); $ch = curl_init("https://{SERVER_ADDRESS}/GDPR_MSG/?{$params}"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); $data = json_decode($response, true);
const axios = require('axios'); axios.get('https://{SERVER_ADDRESS}/GDPR_MSG/', { params: { Licence: '{LICENCE_CODE}', Phone: '33612345678', Country: 'FRA', Company: 'MYCOMPANY', Custom_sms: 'Your confirmation code is' } }) .then(response => console.log(response.data));
HttpClient client = HttpClient.newHttpClient(); String url = "https://{SERVER_ADDRESS}/GDPR_MSG/" + "?Licence={LICENCE_CODE}&Phone=33612345678&Country=FRA&Company=MYCOMPANY&Custom_sms=Your+confirmation+code+is"; HttpRequest request = HttpRequest.newBuilder() .uri(URI.create(url)) .GET() .build(); HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body());
using var client = new HttpClient(); var url = "https://{SERVER_ADDRESS}/GDPR_MSG/" + "?Licence={LICENCE_CODE}&Phone=33612345678&Country=FRA&Company=MYCOMPANY&Custom_sms=Your+confirmation+code+is"; var response = await client.GetAsync(url); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body);
package main import ( "fmt" "io" "net/http" ) func main() { url := "https://{SERVER_ADDRESS}/GDPR_MSG/" + "?Licence={LICENCE_CODE}&Phone=33612345678&Country=FRA&Company=MYCOMPANY&Custom_sms=Your+confirmation+code+is" resp, err := http.Get(url) if err != nil { panic(err) } defer resp.Body.Close() body, _ := io.ReadAll(resp.Body) fmt.Println(string(body)) }
POSThttps://{SERVER_ADDRESS}/GDPR_MSG/

Send all parameters in the request body using Content-Type: application/x-www-form-urlencoded. The server address remains in the URL.

Code examples

Send a verification code

curl -X POST "https://{SERVER_ADDRESS}/GDPR_MSG/" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "Licence={LICENCE_CODE}" \ -d "Phone=33612345678" \ -d "Country=FRA" \ -d "Company=MYCOMPANY" \ -d "Custom_sms=Your confirmation code is"
fetch("https://{SERVER_ADDRESS}/GDPR_MSG/", { method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded" }, body: new URLSearchParams({ Licence: "{LICENCE_CODE}", Phone: "33612345678", Country: "FRA", Company: "MYCOMPANY", Custom_sms: "Your confirmation code is" }) }) .then(r => r.json()) .then(data => console.log(data));
import requests response = requests.post( "https://{SERVER_ADDRESS}/GDPR_MSG/", data={ "Licence": "{LICENCE_CODE}", "Phone": "33612345678", "Country": "FRA", "Company": "MYCOMPANY", "Custom_sms": "Your confirmation code is", }, ) print(response.json())
<?php $ch = curl_init("https://{SERVER_ADDRESS}/GDPR_MSG/"); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([ 'Licence' => '{LICENCE_CODE}', 'Phone' => '33612345678', 'Country' => 'FRA', 'Company' => 'MYCOMPANY', 'Custom_sms' => 'Your confirmation code is', ])); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); $data = json_decode($response, true);
const axios = require('axios'); const qs = require('querystring'); axios.post('https://{SERVER_ADDRESS}/GDPR_MSG/', qs.stringify({ Licence: '{LICENCE_CODE}', Phone: '33612345678', Country: 'FRA', Company: 'MYCOMPANY', Custom_sms: 'Your confirmation code is' })) .then(response => console.log(response.data));
HttpClient client = HttpClient.newHttpClient(); String form = "Licence={LICENCE_CODE}&Phone=33612345678&Country=FRA&Company=MYCOMPANY&Custom_sms=Your+confirmation+code+is"; HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://{SERVER_ADDRESS}/GDPR_MSG/")) .header("Content-Type", "application/x-www-form-urlencoded") .POST(HttpRequest.BodyPublishers.ofString(form)) .build(); HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body());
using var client = new HttpClient(); var form = new Dictionary<string, string> { ["Licence"] = "{LICENCE_CODE}", ["Phone"] = "33612345678", ["Country"] = "FRA", ["Company"] = "MYCOMPANY", ["Custom_sms"] = "Your confirmation code is" }; var response = await client.PostAsync( "https://{SERVER_ADDRESS}/GDPR_MSG/", new FormUrlEncodedContent(form)); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body);
package main import ( "fmt" "io" "net/http" "net/url" ) func main() { form := url.Values{} form.Set("Licence", "{LICENCE_CODE}") form.Set("Phone", "33612345678") form.Set("Country", "FRA") form.Set("Company", "MYCOMPANY") form.Set("Custom_sms", "Your confirmation code is") resp, err := http.PostForm("https://{SERVER_ADDRESS}/GDPR_MSG/", form) if err != nil { panic(err) } defer resp.Body.Close() body, _ := io.ReadAll(resp.Body) fmt.Println(string(body)) }

Parameters

Parameter Description Mand / Opt
Licence Licence code assigned to your account. Mandatory
Phone Phone number in international format, without the + prefix and without spaces (for example, 44XXXXXXXXXX for the United Kingdom). Mandatory
Country ISO 3-letter country code. Mandatory
Company Company name used as the SMS sender. Minimum 3 characters and maximum 11 characters. Mandatory
Custom_sms Custom SMS content. Limited to 125 characters. The verification code is automatically appended. Mandatory
Duration Validity duration of the SMS code, in minutes. Optional
Phonecom 1 or 0. Indicates whether phone communication consent was selected. Optional
Email 1 or 0. Indicates whether email communication consent was selected. Optional
Post 1 or 0. Indicates whether postal communication consent was selected. Optional
Sms 1 or 0. Indicates whether SMS communication consent was selected. Optional
Note - The Phonecom, Email, Post and Sms parameters are each optional, but at least one of them must be set to 1 — the request fails with error code 11 if none is enabled.

Optional multi-contact consent parameters:SMS2–SMS5, PHONE2–PHONE5, EMAIL2–EMAIL5, POST2–POST5 (consent for secondary contacts, same 1/0 format as the primary channels above).

Response

The JSON response contains the SMS delivery status and verification metadata.

Key Description Type
status SMS delivery status. See the Status values table below. String
timeout Validity duration of the code in minutes. String
companyName Company name used as the sender. String
country ISO 3-letter country code. String
to Recipient phone number in international format. String
channels Selected communication channels. Object
errors Error details. See the Error codes table below. Object
smsToken Unique identifier of the SMS. Pass this value to GDPR_VERIF as the Token parameter. String
dateTime Date and time the SMS was sent. String

Status values

Status Description
PENDING The SMS was sent to the operator.
DELIVERED The SMS was successfully delivered.
UNDELIVERABLE The SMS could not be delivered.
EXPIRED The SMS expired before delivery confirmation.
REJECTED The SMS was rejected by the operator.

Error codes

Code Description
00 No errors.
01 Missing parameters.
02 Service not authorized for this licence.
03 Invalid phone number.
04 Invalid country code.
05 Invalid duration.
06 Country not found.
07 Invalid company name.
08 Internal API error.
09 No delivery status received.
10 Invalid consent values.
11 At least one communication channel must be enabled.

Response example

Successful delivery
{ "channels": { "phone": 0, "post": 0, "sms": 1, "email": 1 }, "to": "33612345678", "errors": { "00": "00 - No errors" }, "status": "DELIVERED", "smsToken": "C6hfYZIER3CVoGVYwTiZLg", "timeout": "3", "companyName": "MYCOMPANY", "country": "FRA", "dateTime": "2019-07-29 11:32:32.876709" }

Test the API

Click the button below to test this endpoint live in your browser.

Open console

See also

Related to

Was this article helpful?

0 out of 0 found this helpful