curl -X POST 'https://api.moderationapi.com/v1/actions/execute' \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-d '{
"contentIds": [
"60c9e1c0e4e7e1001c7a0e1e",
"60c9e1c0e4e7e1001c7a0e1f"
],
"actionId": "suspend-author",
"value": "Spam"
}'
import ModerationAPI from "@moderation-api/sdk";
// Uses environment variable MODAPI_SECRET_KEY
const moderationApi = new ModerationAPI();
// Or pass key explicitly
// const moderationApi = new ModerationAPI({ secretKey: '<token>' });
await moderationApi.actions.execute({
contentIds: ["60c9e1c0e4e7e1001c7a0e1e", "60c9e1c0e4e7e1001c7a0e1f"],
actionId: "suspend-author",
value: "Spam",
});
require 'moderation_api'
ModerationApi.configure do |config|
config.access_token = '<token>'
end
api = ModerationApi::QueueActionsApi.new
api.actions_execute(
content_ids: [
'60c9e1c0e4e7e1001c7a0e1e',
'60c9e1c0e4e7e1001c7a0e1f'
],
action_id: 'suspend-author',
value: 'Spam'
)
import requests
url = "https://api.moderationapi.com/v1/actions/execute"
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
payload = {
"contentIds": [
"60c9e1c0e4e7e1001c7a0e1e",
"60c9e1c0e4e7e1001c7a0e1f"
],
"actionId": "suspend-author",
"value": "Spam"
}
response = requests.post(url, headers=headers, json=payload)
<?php
$url = "https://api.moderationapi.com/v1/actions/execute";
$headers = array(
"Authorization: Bearer <token>",
"Content-Type: application/json"
);
$data = array(
"contentIds" => array(
"60c9e1c0e4e7e1001c7a0e1e",
"60c9e1c0e4e7e1001c7a0e1f"
),
"actionId" => "suspend-author",
"value" => "Spam"
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
?>
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
String url = "https://api.moderationapi.com/v1/actions/execute";
String requestBody = """
{
"contentIds": [
"60c9e1c0e4e7e1001c7a0e1e",
"60c9e1c0e4e7e1001c7a0e1f"
],
"actionId": "suspend-author",
"value": "Spam"
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(requestBody))
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
url := "https://api.moderationapi.com/v1/actions/execute"
data := map[string]interface{}{
"contentIds": []string{
"60c9e1c0e4e7e1001c7a0e1e",
"60c9e1c0e4e7e1001c7a0e1f",
},
"actionId": "suspend-author",
"value": "Spam",
}
jsonData, _ := json.Marshal(data)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result)
}
{
"success": true
}{
"code": "BAD_REQUEST",
"message": "Invalid input data",
"issues": []
}{
"code": "UNAUTHORIZED",
"message": "Authorization not provided",
"issues": []
}{
"code": "NOT_FOUND",
"message": "Not found",
"issues": []
}Execute moderation action
Execute a moderation action on one or more content items.
curl -X POST 'https://api.moderationapi.com/v1/actions/execute' \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-d '{
"contentIds": [
"60c9e1c0e4e7e1001c7a0e1e",
"60c9e1c0e4e7e1001c7a0e1f"
],
"actionId": "suspend-author",
"value": "Spam"
}'
import ModerationAPI from "@moderation-api/sdk";
// Uses environment variable MODAPI_SECRET_KEY
const moderationApi = new ModerationAPI();
// Or pass key explicitly
// const moderationApi = new ModerationAPI({ secretKey: '<token>' });
await moderationApi.actions.execute({
contentIds: ["60c9e1c0e4e7e1001c7a0e1e", "60c9e1c0e4e7e1001c7a0e1f"],
actionId: "suspend-author",
value: "Spam",
});
require 'moderation_api'
ModerationApi.configure do |config|
config.access_token = '<token>'
end
api = ModerationApi::QueueActionsApi.new
api.actions_execute(
content_ids: [
'60c9e1c0e4e7e1001c7a0e1e',
'60c9e1c0e4e7e1001c7a0e1f'
],
action_id: 'suspend-author',
value: 'Spam'
)
import requests
url = "https://api.moderationapi.com/v1/actions/execute"
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
payload = {
"contentIds": [
"60c9e1c0e4e7e1001c7a0e1e",
"60c9e1c0e4e7e1001c7a0e1f"
],
"actionId": "suspend-author",
"value": "Spam"
}
response = requests.post(url, headers=headers, json=payload)
<?php
$url = "https://api.moderationapi.com/v1/actions/execute";
$headers = array(
"Authorization: Bearer <token>",
"Content-Type: application/json"
);
$data = array(
"contentIds" => array(
"60c9e1c0e4e7e1001c7a0e1e",
"60c9e1c0e4e7e1001c7a0e1f"
),
"actionId" => "suspend-author",
"value" => "Spam"
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
?>
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
String url = "https://api.moderationapi.com/v1/actions/execute";
String requestBody = """
{
"contentIds": [
"60c9e1c0e4e7e1001c7a0e1e",
"60c9e1c0e4e7e1001c7a0e1f"
],
"actionId": "suspend-author",
"value": "Spam"
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(requestBody))
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
url := "https://api.moderationapi.com/v1/actions/execute"
data := map[string]interface{}{
"contentIds": []string{
"60c9e1c0e4e7e1001c7a0e1e",
"60c9e1c0e4e7e1001c7a0e1f",
},
"actionId": "suspend-author",
"value": "Spam",
}
jsonData, _ := json.Marshal(data)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result)
}
{
"success": true
}{
"code": "BAD_REQUEST",
"message": "Invalid input data",
"issues": []
}{
"code": "UNAUTHORIZED",
"message": "Authorization not provided",
"issues": []
}{
"code": "NOT_FOUND",
"message": "Not found",
"issues": []
}curl -X POST 'https://api.moderationapi.com/v1/actions/execute' \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-d '{
"contentIds": [
"60c9e1c0e4e7e1001c7a0e1e",
"60c9e1c0e4e7e1001c7a0e1f"
],
"actionId": "suspend-author",
"value": "Spam"
}'
import ModerationAPI from "@moderation-api/sdk";
// Uses environment variable MODAPI_SECRET_KEY
const moderationApi = new ModerationAPI();
// Or pass key explicitly
// const moderationApi = new ModerationAPI({ secretKey: '<token>' });
await moderationApi.actions.execute({
contentIds: ["60c9e1c0e4e7e1001c7a0e1e", "60c9e1c0e4e7e1001c7a0e1f"],
actionId: "suspend-author",
value: "Spam",
});
require 'moderation_api'
ModerationApi.configure do |config|
config.access_token = '<token>'
end
api = ModerationApi::QueueActionsApi.new
api.actions_execute(
content_ids: [
'60c9e1c0e4e7e1001c7a0e1e',
'60c9e1c0e4e7e1001c7a0e1f'
],
action_id: 'suspend-author',
value: 'Spam'
)
import requests
url = "https://api.moderationapi.com/v1/actions/execute"
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
payload = {
"contentIds": [
"60c9e1c0e4e7e1001c7a0e1e",
"60c9e1c0e4e7e1001c7a0e1f"
],
"actionId": "suspend-author",
"value": "Spam"
}
response = requests.post(url, headers=headers, json=payload)
<?php
$url = "https://api.moderationapi.com/v1/actions/execute";
$headers = array(
"Authorization: Bearer <token>",
"Content-Type: application/json"
);
$data = array(
"contentIds" => array(
"60c9e1c0e4e7e1001c7a0e1e",
"60c9e1c0e4e7e1001c7a0e1f"
),
"actionId" => "suspend-author",
"value" => "Spam"
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
?>
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
String url = "https://api.moderationapi.com/v1/actions/execute";
String requestBody = """
{
"contentIds": [
"60c9e1c0e4e7e1001c7a0e1e",
"60c9e1c0e4e7e1001c7a0e1f"
],
"actionId": "suspend-author",
"value": "Spam"
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(requestBody))
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
url := "https://api.moderationapi.com/v1/actions/execute"
data := map[string]interface{}{
"contentIds": []string{
"60c9e1c0e4e7e1001c7a0e1e",
"60c9e1c0e4e7e1001c7a0e1f",
},
"actionId": "suspend-author",
"value": "Spam",
}
jsonData, _ := json.Marshal(data)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result)
}
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Input parameters
ID or key of the action to execute
IDs of the content items to apply the action to. Provide this or authorIds.
IDs of the authors to apply the action to. Provide this or contentIds.
Optional value to provide with the action
Optional queue ID if the action is queue-specific
Optional duration in milliseconds for actions with timeouts
Required range:
x >= 0Response
Action executed successfully
Execution result
Whether the action was executed successfully
Was this page helpful?
⌘I