API Reference / Take one of your actions on a request
API Reference

Take one of your actions on a request

POST/api/v1/moderation/{id}/actions

Records the action and sends it to your system as a moderation.action webhook. Detectivision does not carry it out. At most 60 a minute per account. Free.

Path parameters#

Parameter Type Description
id required integer The request's id.

Request body#

Content type: application/json.

  • action string required

    The key of one of your actions.

  • note string

    Sent with the action. At most 500 characters.

Responses#

201#

The action, recorded and on its way.

  • id integer required

  • key string required

  • label string required

  • by object (Actor) required

    Who took an action.

  • note string or null required

  • at integer required

    When, in Unix seconds.

by (Actor)

  • type string required

    One of: user, api. user: someone in the dashboard; api: a call with an API key.

  • name string required

    The person's name, or the API key's label.

400#

Not one of your actions (the message lists them), or a malformed body.

{
  "error": "invalid_request",
  "message": "Unknown action nope. Actions: ban, keep."
}

401#

Missing, unknown, revoked or expired API key, or the account is not active.

{
  "error": "unauthorized",
  "message": "The API key is not valid."
}

403#

The key may not do this: a read key on a write endpoint, or a restricted key.

{
  "error": "forbidden",
  "message": "This API key does not have write permission"
}

404#

No such request for this account.

{
  "error": "not_found",
  "message": "No such request."
}

429#

More than 60 actions in a minute through the API. Nothing was taken.

Header Retry-After: Seconds to wait before trying again.

{
  "error": "too_many_requests",
  "message": "At most 60 actions a minute through the API"
}

Request

curl -X POST https://api.detectivision.ai/api/v1/moderation/{id}/actions \
  -H "Api-Key: $DETECTIVISION_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "action": "ban",
  "note": "spam account"
}'
import os, requests

r = requests.post(
    "https://api.detectivision.ai/api/v1/moderation/{id}/actions",
    headers={"Api-Key": os.environ["DETECTIVISION_API_KEY"]},
    json={
      "action": "ban",
      "note": "spam account"
    },
)
print(r.status_code, r.json())
const res = await fetch("https://api.detectivision.ai/api/v1/moderation/{id}/actions", {
  method: "POST",
  headers: {
    "Api-Key": process.env.DETECTIVISION_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "action": "ban",
    "note": "spam account"
  }),
});
console.log(res.status, await res.json());