To get started with the Bot Butcher API, follow these simple steps:
API key
.true
(spam) or false
(not spam).Detects if a given message is spam or not.
Base URL: https://api.botbutcher.com
Method: POST
x-api-key
: (Required) API key to authenticate the request.message
: (Required, string) The text to classify as spam or not.domain
: (Optional, string) the root domain where the contact form is located (boosts accuracy).metadata
: (Optional, object) Any information you want us to store with the request.Example Payload:
{
"message": "The spammy message posted to your contact form.",
"domain": "my-business-website.com"
}
Example Request:
curl -X POST \ -H 'Content-Type: application/json' \ -H 'x-api-key: YOUR-API-KEY' \ -d '{"message": "The spammy message posted to your contact form.", "domain": "my-business-website.com"}' \ 'https://api.botbutcher.com'
import requests headers = { 'Content-Type': 'application/json', 'x-api-key': 'YOUR-API-KEY' } data = { 'message': 'The spammy message posted to your contact form.', 'domain': 'my-business-website.com' } response = requests.post('https://api.botbutcher.com', json=data, headers=headers) print(response.json())
const xhr = new XMLHttpRequest(); const data = JSON.stringify({ message: 'The spammy message posted to your contact form.', domain: 'my-business-website.com' }); xhr.open('POST', 'https://api.botbutcher.com'); xhr.setRequestHeader('Content-Type', 'application/json'); xhr.setRequestHeader('x-api-key', 'YOUR-API-KEY'); xhr.send(data); xhr.onload = function() { if (xhr.status === 200) { console.log(JSON.parse(xhr.responseText)); } };
import axios from 'axios'; const apiKey: string = 'YOUR-API-KEY'; const data = { message: 'The spammy message posted to your contact form.', domain: 'my-business-website.com' }; axios.post('https://api.botbutcher.com', data, { headers: { 'Content-Type': 'application/json', 'x-api-key': apiKey } }).then(response => { console.log(response.data); }).catch(error => { console.error(error); });
import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; public class Main { public static void main(String[] args) throws Exception { URL url = new URL("https://api.botbutcher.com"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/json"); conn.setRequestProperty("x-api-key", "YOUR-API-KEY"); conn.setDoOutput(true); String jsonInputString = "{ \"message\": \"The spammy message posted to your contact form.\", \"domain\": \"my-business-website.com\" }"; try (OutputStream os = conn.getOutputStream()) { byte[] input = jsonInputString.getBytes("utf-8"); os.write(input, 0, input.length); } if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) { System.out.println("Request successful"); } else { System.out.println("Request failed"); } } }
using System; using System.Net.Http; using System.Text; using System.Threading.Tasks; class Program { static async Task Main(string[] args) { var client = new HttpClient(); var url = "https://api.botbutcher.com"; var apiKey = "YOUR-API-KEY"; var data = new { message = "The spammy message posted to your contact form.", domain = "my-business-website.com" }; var json = System.Text.Json.JsonSerializer.Serialize(data); var content = new StringContent(json, Encoding.UTF8, "application/json"); client.DefaultRequestHeaders.Add("x-api-key", apiKey); var response = await client.PostAsync(url, content); if (response.IsSuccessStatusCode) { var result = await response.Content.ReadAsStringAsync(); Console.WriteLine(result); } else { Console.WriteLine("Request failed"); } } }
spam
: (boolean) Indicates if the message is classified as spam
(true
) or not (false
).message_id
: (string) A unique identifier for the message.status_code
: (integer) HTTP status code indicating the success or failure of the request.Example Response:
{
"spam": true,
"message_id": "2383k0f-s5cPjaQBi1-87s10"
"status_code": 200
}
Malformed request
: Returned when there's a missing JSON payload value,
or required headers. Status code: 400
.Unauthorized
: Returned when the authentication fails. Status code: 401
.If a domain is supplied in the request that is not a valid domain an additional "notes" array will be returned in the response with any error messages such as "invalid domain". If a domain is invalid a classification will still occur but with less accuracy.
Retrieve any message previously sent by the message_id
Base URL: https://api.botbutcher.com
Endpoint: /message/<message_id>
Method: GET
Allows user to retrieve a Message object by its unique identifier.
x-api-key
: (Required) API key to authenticate the request.message_id
: (Required, string) The unique identifier of the message to be retrieved.Example Request:
In this example we want to retrieve message with a message_id of 8anb591P-76sn1pn-850fknj
curl -X GET \ -H 'x-api-key: YOUR-API-KEY' \ 'https://api.botbutcher.com/message/8anb591P-76sn1pn-850fknj'
import requests headers = { 'x-api-key': 'YOUR-API-KEY' } response = requests.get('https://api.botbutcher.com/message/8anb591P-76sn1pn-850fknj', headers=headers) print(response.json())
const xhr = new XMLHttpRequest(); xhr.open('GET', 'https://api.botbutcher.com/message/8anb591P-76sn1pn-850fknj'); xhr.setRequestHeader('x-api-key', 'YOUR-API-KEY'); xhr.send(); xhr.onload = function() { if (xhr.status === 200) { console.log(JSON.parse(xhr.responseText)); } };
import axios from 'axios'; const apiKey: string = 'YOUR-API-KEY'; const url: string = 'https://api.botbutcher.com/message/8anb591P-76sn1pn-850fknj'; axios.get(url, { headers: { 'x-api-key': apiKey } }).then(response => { console.log(response.data); }).catch(error => { console.error(error); });
import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; public class Main { public static void main(String[] args) throws Exception { URL url = new URL("https://api.botbutcher.com/message/8anb591P-76sn1pn-850fknj"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); conn.setRequestProperty("x-api-key", "YOUR-API-KEY"); if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) { try (BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()))) { String inputLine; StringBuilder content = new StringBuilder(); while ((inputLine = in.readLine()) != null) { content.append(inputLine); } System.out.println(content); } } else { System.out.println("Request failed"); } } }
using System; using System.Net.Http; using System.Threading.Tasks; class Program { static async Task Main(string[] args) { var client = new HttpClient(); var url = "https://api.botbutcher.com/message/8anb591P-76sn1pn-850fknj"; var apiKey = "YOUR-API-KEY"; client.DefaultRequestHeaders.Add("x-api-key", apiKey); var response = await client.GetAsync(url); if (response.IsSuccessStatusCode) { var result = await response.Content.ReadAsStringAsync(); Console.WriteLine(result); } else { Console.WriteLine("Request failed"); } } }
status_code
: (integer) HTTP status code indicating the success or failure of the request.timestamp
: (string) The ISO 8601 format timestamp representing when the message was created.message
: (string) The text content of the message.spam
: (boolean) Indicates if the message is classified as spam
(true
) or not (false
).domain
: (string) The root domain where the contact form exists (when provided).metadata
: (object) The optional data sent with the classify request (when provided).Example Response:
{
"status_code": 200,
"timestamp": "2022-04-18T10:15:30Z",
"message": "I want to schedule an appointment to fix my car. Please call me.",
"spam": false,
"domain": "local-car-dealership.com"
"metadata: {"repair-order": 1234567, "phone": "+13105555555"}
}
Malformed request
: Returned when there's a missing message_id
,
unknown message_id
, or required headers. Status code: 400
.Unauthorized
: Returned when the authentication fails. Status code: 401
.