Make a sender the default
curl --request PATCH \
--url https://api.sendbaze.com/v1/senders/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"default": true
}
'const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({default: true})
};
fetch('https://api.sendbaze.com/v1/senders/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.sendbaze.com/v1/senders/{id}"
payload = { "default": True }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)require 'uri'
require 'net/http'
url = URI("https://api.sendbaze.com/v1/senders/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"default\": true\n}"
response = http.request(request)
puts response.read_body<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sendbaze.com/v1/senders/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'default' => true
]),
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.sendbaze.com/v1/senders/{id}"
payload := strings.NewReader("{\n \"default\": true\n}")
req, _ := http.NewRequest("PATCH", 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))
}{
"id": "sdr_01j9x7k2r4m8q3v5n6b7c8d9e0",
"value": "AcmeShop",
"kind": "numeric",
"status": "requested",
"isDefault": true,
"useCase": "<string>",
"countries": [
"ZA",
"BW"
],
"caveats": [
"<string>"
],
"reviewNote": "<string>",
"requestedAt": "2023-11-07T05:31:56Z",
"reviewedAt": "2023-11-07T05:31:56Z"
}{
"error": {
"code": "not_found",
"message": "No email with id em_x.",
"docs": "https://docs.sendbaze.com/errors#not_found"
}
}{
"error": {
"code": "validation_error",
"message": "The request has invalid fields.",
"docs": "https://docs.sendbaze.com/errors#validation_error",
"fields": {
"to.1": [
"must be a valid email address"
]
}
}
}Senders
Make a sender the default
Send { "default": true } to make an approved sender the one used when a send names no senderId. The previous default stops being it. Requires sms:send.
PATCH
/
v1
/
senders
/
{id}
Make a sender the default
curl --request PATCH \
--url https://api.sendbaze.com/v1/senders/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"default": true
}
'const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({default: true})
};
fetch('https://api.sendbaze.com/v1/senders/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.sendbaze.com/v1/senders/{id}"
payload = { "default": True }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)require 'uri'
require 'net/http'
url = URI("https://api.sendbaze.com/v1/senders/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"default\": true\n}"
response = http.request(request)
puts response.read_body<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sendbaze.com/v1/senders/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'default' => true
]),
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.sendbaze.com/v1/senders/{id}"
payload := strings.NewReader("{\n \"default\": true\n}")
req, _ := http.NewRequest("PATCH", 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))
}{
"id": "sdr_01j9x7k2r4m8q3v5n6b7c8d9e0",
"value": "AcmeShop",
"kind": "numeric",
"status": "requested",
"isDefault": true,
"useCase": "<string>",
"countries": [
"ZA",
"BW"
],
"caveats": [
"<string>"
],
"reviewNote": "<string>",
"requestedAt": "2023-11-07T05:31:56Z",
"reviewedAt": "2023-11-07T05:31:56Z"
}{
"error": {
"code": "not_found",
"message": "No email with id em_x.",
"docs": "https://docs.sendbaze.com/errors#not_found"
}
}{
"error": {
"code": "validation_error",
"message": "The request has invalid fields.",
"docs": "https://docs.sendbaze.com/errors#validation_error",
"fields": {
"to.1": [
"must be a valid email address"
]
}
}
}Authorizations
Response
The sender