curl --request PUT \
--url https://api.wave.sa/v1/consents/{phone} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"evidence": "<string>"
}
'import requests
url = "https://api.wave.sa/v1/consents/{phone}"
payload = { "evidence": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({evidence: '<string>'})
};
fetch('https://api.wave.sa/v1/consents/{phone}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.wave.sa/v1/consents/{phone}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'evidence' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.wave.sa/v1/consents/{phone}"
payload := strings.NewReader("{\n \"evidence\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.wave.sa/v1/consents/{phone}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"evidence\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wave.sa/v1/consents/{phone}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"evidence\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"phone": "+966501234567",
"status": "opted_out",
"source": "keyword",
"evidence": "<string>",
"changed_at": "2023-11-07T05:31:56Z"
}{
"error_code": "INVALID_API_KEY",
"message": "<string>",
"message_ar": "<string>",
"request_id": "<string>",
"docs_url": "<string>"
}{
"error_code": "INVALID_API_KEY",
"message": "<string>",
"message_ar": "<string>",
"request_id": "<string>",
"docs_url": "<string>"
}{
"error_code": "INVALID_API_KEY",
"message": "<string>",
"message_ar": "<string>",
"request_id": "<string>",
"docs_url": "<string>"
}{
"error_code": "INVALID_API_KEY",
"message": "<string>",
"message_ar": "<string>",
"request_id": "<string>",
"docs_url": "<string>"
}{
"error_code": "INVALID_API_KEY",
"message": "<string>",
"message_ar": "<string>",
"request_id": "<string>",
"docs_url": "<string>"
}Record a number's consent
Records an opt-out or an opt-in for one number, with its evidence. An opt-in must carry evidence (where you collected it). Commercial messages (templates and broadcasts) to an opted-out number are refused. Every change is audited. An end user’s own STOP / START reply on WhatsApp also changes the record. An end user’s STOP is locked: an opt-in over it is refused (409 CONSENT_LOCKED_BY_END_USER); only the end user’s START lifts it, and an opt-out over it leaves the record unchanged. Requires the messages:write scope. Messaging is enabled per environment: where it is not enabled, every messaging, broadcast and contact route answers 503 with MESSAGES_DISABLED.
curl --request PUT \
--url https://api.wave.sa/v1/consents/{phone} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"evidence": "<string>"
}
'import requests
url = "https://api.wave.sa/v1/consents/{phone}"
payload = { "evidence": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({evidence: '<string>'})
};
fetch('https://api.wave.sa/v1/consents/{phone}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.wave.sa/v1/consents/{phone}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'evidence' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.wave.sa/v1/consents/{phone}"
payload := strings.NewReader("{\n \"evidence\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.wave.sa/v1/consents/{phone}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"evidence\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wave.sa/v1/consents/{phone}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"evidence\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"phone": "+966501234567",
"status": "opted_out",
"source": "keyword",
"evidence": "<string>",
"changed_at": "2023-11-07T05:31:56Z"
}{
"error_code": "INVALID_API_KEY",
"message": "<string>",
"message_ar": "<string>",
"request_id": "<string>",
"docs_url": "<string>"
}{
"error_code": "INVALID_API_KEY",
"message": "<string>",
"message_ar": "<string>",
"request_id": "<string>",
"docs_url": "<string>"
}{
"error_code": "INVALID_API_KEY",
"message": "<string>",
"message_ar": "<string>",
"request_id": "<string>",
"docs_url": "<string>"
}{
"error_code": "INVALID_API_KEY",
"message": "<string>",
"message_ar": "<string>",
"request_id": "<string>",
"docs_url": "<string>"
}{
"error_code": "INVALID_API_KEY",
"message": "<string>",
"message_ar": "<string>",
"request_id": "<string>",
"docs_url": "<string>"
}Authorizations
Your API key from the Wave dashboard. Sandbox keys start sk_sandbox_; production keys start sk_live_. Send as Authorization: Bearer <key>. Some endpoints require a production key and specific scopes.
Path Parameters
The phone number, in any accepted form (+9665…, 9665… or 05…). URL-encode the +.
"+966501234567"
Body
Response
The consent is recorded
The number in E.164.
"+966501234567"
opted_out, opted_in keyword = the end user's STOP / START reply; api = this API; contact = the contact opt-out toggle.
keyword, api, contact 
