Update a subscriber
curl --request PUT \
--url https://app.letterbucket.com/api/v1/subscribers/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "new@example.com",
"name": "New Name"
}
'import requests
url = "https://app.letterbucket.com/api/v1/subscribers/{id}"
payload = {
"email": "new@example.com",
"name": "New Name"
}
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({email: 'new@example.com', name: 'New Name'})
};
fetch('https://app.letterbucket.com/api/v1/subscribers/{id}', 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://app.letterbucket.com/api/v1/subscribers/{id}",
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([
'email' => 'new@example.com',
'name' => 'New Name'
]),
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://app.letterbucket.com/api/v1/subscribers/{id}"
payload := strings.NewReader("{\n \"email\": \"new@example.com\",\n \"name\": \"New Name\"\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://app.letterbucket.com/api/v1/subscribers/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"new@example.com\",\n \"name\": \"New Name\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.letterbucket.com/api/v1/subscribers/{id}")
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 \"email\": \"new@example.com\",\n \"name\": \"New Name\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"email": "jsmith@example.com",
"name": "<string>",
"created_at": "2023-11-07T05:31:56Z"
}
}{
"success": false,
"code": "validation_error",
"message": "The request contains invalid data."
}{
"success": false,
"code": "unauthorized",
"message": "Invalid API key."
}{
"success": false,
"code": "not_found",
"message": "Subscriber not found."
}{
"success": false,
"code": "validation_error",
"message": "The request contains invalid data.",
"errors": {
"email": [
"Enter a valid email address."
]
}
}{
"success": false,
"code": "rate_limit_exceeded",
"message": "Too many requests. Please try again later.",
"errors": {
"retry_after": 42
}
}Subscribers
Update a subscriber
Update email, name or status.
PUT
/
subscribers
/
{id}
Update a subscriber
curl --request PUT \
--url https://app.letterbucket.com/api/v1/subscribers/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "new@example.com",
"name": "New Name"
}
'import requests
url = "https://app.letterbucket.com/api/v1/subscribers/{id}"
payload = {
"email": "new@example.com",
"name": "New Name"
}
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({email: 'new@example.com', name: 'New Name'})
};
fetch('https://app.letterbucket.com/api/v1/subscribers/{id}', 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://app.letterbucket.com/api/v1/subscribers/{id}",
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([
'email' => 'new@example.com',
'name' => 'New Name'
]),
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://app.letterbucket.com/api/v1/subscribers/{id}"
payload := strings.NewReader("{\n \"email\": \"new@example.com\",\n \"name\": \"New Name\"\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://app.letterbucket.com/api/v1/subscribers/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"new@example.com\",\n \"name\": \"New Name\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.letterbucket.com/api/v1/subscribers/{id}")
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 \"email\": \"new@example.com\",\n \"name\": \"New Name\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"email": "jsmith@example.com",
"name": "<string>",
"created_at": "2023-11-07T05:31:56Z"
}
}{
"success": false,
"code": "validation_error",
"message": "The request contains invalid data."
}{
"success": false,
"code": "unauthorized",
"message": "Invalid API key."
}{
"success": false,
"code": "not_found",
"message": "Subscriber not found."
}{
"success": false,
"code": "validation_error",
"message": "The request contains invalid data.",
"errors": {
"email": [
"Enter a valid email address."
]
}
}{
"success": false,
"code": "rate_limit_exceeded",
"message": "Too many requests. Please try again later.",
"errors": {
"retry_after": 42
}
}At least one field must be provided. If
status is omitted, the current status does not change.
Setting status to pending triggers a confirmation email.Authorizations
Your API key, sent as Authorization: Bearer sk_....
Path Parameters
Subscriber ID (UUID).
Body
application/json
Was this page helpful?
⌘I