Create an alias
curl -X POST "https://mail.haltman.io/api/admin/aliases" \
-H "Content-Type: application/json" \
-H "X-CSRF-Token: YOUR_API_KEY" \
-d '{
"address": "123 Main St",
"goto": "example_string",
"active": true
}'
import requests
import json
url = "https://mail.haltman.io/api/admin/aliases"
headers = {
"Content-Type": "application/json",
"X-CSRF-Token": "YOUR_API_KEY"
}
data = {
"address": "123 Main St",
"goto": "example_string",
"active": true
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://mail.haltman.io/api/admin/aliases", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-CSRF-Token": "YOUR_API_KEY"
},
body: JSON.stringify({
"address": "123 Main St",
"goto": "example_string",
"active": true
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"address": "123 Main St",
"goto": "example_string",
"active": true
}`)
req, err := http.NewRequest("POST", "https://mail.haltman.io/api/admin/aliases", 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/aliases')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request['X-CSRF-Token'] = 'YOUR_API_KEY'
request.body = '{
"address": "123 Main St",
"goto": "example_string",
"active": true
}'
response = http.request(request)
puts response.body
{
"ok": true,
"created": true,
"updated": true,
"deleted": true,
"item": {
"id": 123,
"address": "123 Main St",
"goto": "example_string",
"active": 42,
"domain_id": 123,
"created": "2024-12-25T10:00:00Z",
"modified": "2024-12-25T10:00:00Z"
}
}
{
"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": "Conflict",
"message": "The request conflicts with the current state of the resource",
"code": 409,
"details": "Resource already exists"
}
{
"error": "example_string",
"where": "example_string",
"reason": "example_string"
}
POST
/api/admin/aliases
POST
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.
Content-Typestring
RequiredThe media type of the request body
Options: application/json
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.
Responses
Was this page helpful?
Last updated 2 days ago
Built with Documentation.AI