Update a ban
curl -X PATCH "https://mail.haltman.io/api/admin/bans/123" \
-H "Content-Type: application/json" \
-H "X-CSRF-Token: YOUR_API_KEY" \
-d '{
"ban_type": "email",
"ban_value": "example_string",
"reason": "example_string",
"expires_at": "2024-12-25T10:00:00Z",
"revoked": true,
"revoked_reason": "example_string"
}'
import requests
import json
url = "https://mail.haltman.io/api/admin/bans/123"
headers = {
"Content-Type": "application/json",
"X-CSRF-Token": "YOUR_API_KEY"
}
data = {
"ban_type": "email",
"ban_value": "example_string",
"reason": "example_string",
"expires_at": "2024-12-25T10:00:00Z",
"revoked": true,
"revoked_reason": "example_string"
}
response = requests.patch(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://mail.haltman.io/api/admin/bans/123", {
method: "PATCH",
headers: {
"Content-Type": "application/json",
"X-CSRF-Token": "YOUR_API_KEY"
},
body: JSON.stringify({
"ban_type": "email",
"ban_value": "example_string",
"reason": "example_string",
"expires_at": "2024-12-25T10:00:00Z",
"revoked": true,
"revoked_reason": "example_string"
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"ban_type": "email",
"ban_value": "example_string",
"reason": "example_string",
"expires_at": "2024-12-25T10:00:00Z",
"revoked": true,
"revoked_reason": "example_string"
}`)
req, err := http.NewRequest("PATCH", "https://mail.haltman.io/api/admin/bans/123", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-CSRF-Token", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://mail.haltman.io/api/admin/bans/123')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(uri)
request['Content-Type'] = 'application/json'
request['X-CSRF-Token'] = 'YOUR_API_KEY'
request.body = '{
"ban_type": "email",
"ban_value": "example_string",
"reason": "example_string",
"expires_at": "2024-12-25T10:00:00Z",
"revoked": true,
"revoked_reason": "example_string"
}'
response = http.request(request)
puts response.body
{
"ok": true,
"created": true,
"updated": true,
"deleted": true,
"disabled_aliases": 42,
"message": "example_string",
"item": {
"id": 123,
"ban_type": "email",
"ban_value": "example_string",
"reason": "example_string",
"created_at": "2024-12-25T10:00:00Z",
"expires_at": "2024-12-25T10:00:00Z",
"revoked_at": "2024-12-25T10:00:00Z",
"revoked_reason": "example_string",
"active": true
}
}
{
"error": "example_string",
"field": "example_string",
"reason": "example_string",
"hint": "example_string",
"constraints": {}
}
{
"error": "example_string"
}
{
"error": "Unauthorized",
"message": "Authentication required. Please provide a valid API token",
"code": 401
}
{
"error": "Forbidden",
"message": "You don't have permission to access this resource",
"code": 403
}
{
"error": "Not Found",
"message": "The requested resource was not found",
"code": 404
}
{
"error": "example_string",
"where": "example_string",
"reason": "example_string"
}
PATCH
/api/admin/bans/{id}PATCH
API Key (cookie: __Host-access)
__Host-accessstring
RequiredAccess-session cookie used for user and admin authentication.
Access-session cookie used for user and admin authentication.
API Key (header: X-CSRF-Token)
X-CSRF-Tokenstring
RequiredCSRF token derived from the current session family.
CSRF token derived from the current session family.
path
idinteger
RequiredResource identifier.
Content-Typestring
RequiredThe media type of the request body
Options: application/json
ban_typestring
Options: email, domain, ip, name
expires_atstring
Format: date-time
Request Preview
Response
Response will appear here after sending the request
Authentication
path
parameterstring
RequiredAPI Key for authentication. Access-session cookie used for user and admin authentication.
header
X-CSRF-Tokenstring
RequiredAPI Key for authentication. CSRF token derived from the current session family.
Path Parameters
idinteger
RequiredResource identifier.
Body
application/json
ban_typestring
Allowed values:
emaildomainipnameResponses
okboolean
Requiredcreatedboolean
updatedboolean
deletedboolean
disabled_aliasesinteger
Number of aliases deactivated when disable_matching_aliases was true.
messagestring
itemobject
RequiredWas this page helpful?
Last updated 2 days ago
Built with Documentation.AI