curl --request POST \
--url https://attend.hackclub.com/api/v1/bans \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "banned@example.com",
"emails": [
"<string>"
],
"reason": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://attend.hackclub.com/api/v1/bans"
payload = {
"email": "banned@example.com",
"emails": ["<string>"],
"reason": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
email: 'banned@example.com',
emails: ['<string>'],
reason: '<string>',
expires_at: '2023-11-07T05:31:56Z'
})
};
fetch('https://attend.hackclub.com/api/v1/bans', 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://attend.hackclub.com/api/v1/bans",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'email' => 'banned@example.com',
'emails' => [
'<string>'
],
'reason' => '<string>',
'expires_at' => '2023-11-07T05:31:56Z'
]),
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://attend.hackclub.com/api/v1/bans"
payload := strings.NewReader("{\n \"email\": \"banned@example.com\",\n \"emails\": [\n \"<string>\"\n ],\n \"reason\": \"<string>\",\n \"expires_at\": \"2023-11-07T05:31:56Z\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://attend.hackclub.com/api/v1/bans")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"banned@example.com\",\n \"emails\": [\n \"<string>\"\n ],\n \"reason\": \"<string>\",\n \"expires_at\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://attend.hackclub.com/api/v1/bans")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"banned@example.com\",\n \"emails\": [\n \"<string>\"\n ],\n \"reason\": \"<string>\",\n \"expires_at\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"ban": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"emails": [
"<string>"
],
"reason": "<string>",
"status": "Indefinite",
"active": true,
"expires_at": "2023-11-07T05:31:56Z",
"revoked_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"created_by": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
}
}
}{
"error": "Unauthorized"
}{
"error": "Unauthorized"
}{
"error": "<string>",
"bans": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"emails": [
"<string>"
],
"reason": "<string>",
"status": "Indefinite",
"active": true,
"expires_at": "2023-11-07T05:31:56Z",
"revoked_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"created_by": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
}
}
]
}{
"error": "Unauthorized"
}Add emails to the ban list
Ban one person from every event. A ban holds one or more emails, so send all of a person’s addresses in a single call rather than creating a ban per address. Omitting expires_at makes the ban indefinite.
Requires a global admin — a mobile token belonging to one, or a global API token. Event API keys are rejected.
This is the only endpoint reachable by a token scoped to bans:write, so an integration that just needs to ban people can hold a credential that can do nothing else.
curl --request POST \
--url https://attend.hackclub.com/api/v1/bans \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "banned@example.com",
"emails": [
"<string>"
],
"reason": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://attend.hackclub.com/api/v1/bans"
payload = {
"email": "banned@example.com",
"emails": ["<string>"],
"reason": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
email: 'banned@example.com',
emails: ['<string>'],
reason: '<string>',
expires_at: '2023-11-07T05:31:56Z'
})
};
fetch('https://attend.hackclub.com/api/v1/bans', 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://attend.hackclub.com/api/v1/bans",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'email' => 'banned@example.com',
'emails' => [
'<string>'
],
'reason' => '<string>',
'expires_at' => '2023-11-07T05:31:56Z'
]),
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://attend.hackclub.com/api/v1/bans"
payload := strings.NewReader("{\n \"email\": \"banned@example.com\",\n \"emails\": [\n \"<string>\"\n ],\n \"reason\": \"<string>\",\n \"expires_at\": \"2023-11-07T05:31:56Z\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://attend.hackclub.com/api/v1/bans")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"banned@example.com\",\n \"emails\": [\n \"<string>\"\n ],\n \"reason\": \"<string>\",\n \"expires_at\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://attend.hackclub.com/api/v1/bans")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"banned@example.com\",\n \"emails\": [\n \"<string>\"\n ],\n \"reason\": \"<string>\",\n \"expires_at\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"ban": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"emails": [
"<string>"
],
"reason": "<string>",
"status": "Indefinite",
"active": true,
"expires_at": "2023-11-07T05:31:56Z",
"revoked_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"created_by": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
}
}
}{
"error": "Unauthorized"
}{
"error": "Unauthorized"
}{
"error": "<string>",
"bans": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"emails": [
"<string>"
],
"reason": "<string>",
"status": "Indefinite",
"active": true,
"expires_at": "2023-11-07T05:31:56Z",
"revoked_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"created_by": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
}
}
]
}{
"error": "Unauthorized"
}Authorizations
Mobile token, global API token, series API key, or event API key. See Authentication above for which endpoints each one reaches.
Body
A single email to ban. Use emails for several.
"banned@example.com"
Every email belonging to the person. Case and surrounding whitespace are normalised, and duplicates collapse.
Free text shown to admins in the ban list.
ISO 8601 timestamp the ban lifts at. Omit for an indefinite ban. A value that isn't ISO 8601 is rejected rather than treated as absent.
Response
Ban created.
Show child attributes
Show child attributes
Was this page helpful?