POST/ banned-users/
Add banned email or domain
You can ban a specific email or domain. It results in stopped sending to defined users.
Attributes
Optional unless marked required
- banned_name
- A list of banned emails.
- is_domain
- A flag that determines if banned name is email or domain.
Request
- cURL
- JavaScript
- PHP
- Python
curl -X POST "https://<your_app_subdomain>.user.com/api/public/banned-users/" \
-H "Authorization: Token <your_64_char_api_key>" \
-H "Accept: */*; version=2" \
-H "Content-Type: application/json" \
-d '{
"banned_name": "blocked@example.com"
}'
const response = await fetch(
"https://<your_app_subdomain>.user.com/api/public/banned-users/",
{
method: "POST",
headers: {
Authorization: "Token <your_64_char_api_key>",
Accept: "*/*; version=2",
"Content-Type": "application/json",
},
body: JSON.stringify({
banned_name: "blocked@example.com",
}),
},
);
const data = await response.json();
console.log(data);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://<your_app_subdomain>.user.com/api/public/banned-users/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Token <your_64_char_api_key>",
"Accept: */*; version=2",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"banned_name" => "blocked@example.com",
]),
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
response = requests.post(
"https://<your_app_subdomain>.user.com/api/public/banned-users/",
headers={
"Authorization": "Token <your_64_char_api_key>",
"Accept": "*/*; version=2",
},
json={
"banned_name": "blocked@example.com",
},
)
print(response.json())
Response examples
- 200 OK
{
"id": 36,
"banned_name": "test@mail.com",
"is_domain": false
}
Response fields
Fields returned in the 200 OK response body.
- id
- A unique identifier for the campaign which is given by User
- banned_name
- A list of banned emails.
- is_domain
- A flag that determines if banned name is email or domain.
note
Errors that can come from any endpoint (401, 429, 500, 502, 504) are described in HTTP response codes.