Moderation API reference
Moderate one text block, image, or video per synchronous request. Artany charges once per completed request and returns consistent class labels and scores.
Overview
POST /v1/moderations
Authentication: Authorization: Bearer <ARTANY_API_KEY>. An Idempotency-Key of 8–128 characters is recommended.
Request
Set modality to text, image, or video. Text uses text; image and video use an Artany-processable HTTP(S) url.
curl -X POST "https://api.artany.ai/v1/moderations" \
-H "Authorization: Bearer $ARTANY_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: moderation-20260722-001" \
-d '{"modality":"image","url":"https://cdn.example.com/upload.jpg"}'| Field | Required | Description |
|---|---|---|
| modality | Yes | text, image, or video. |
| text | Text only | 1–1,024 characters. |
| url | Image/video | Public or signed HTTP(S) media URL. |
Response
classes contains Artany labels and confidence scores. Video results also include a frame timestamp in seconds. Artany initially returns decision: "review"; enforce your own allow/review/block policy from the returned classes.
{
"provider": "artany",
"decision": "review",
"classes": [{ "label": "general_nsfw", "score": 0.91, "time": 0 }],
"billing": { "charged_credits": "2", "idempotent": false }
}Billing & idempotency
- Text, image, and video are billed per request at the published Moderation API price.
- Credits are pre-authorized before processing and automatically returned if the request cannot be processed.
- Retrying an identical request with the same Idempotency-Key returns the saved result without another charge.
Policy integration
Treat Artany moderation signals as an input to your policy. A typical implementation blocks clearly disallowed labels above a strict threshold, sends uncertain scores to review, and retains the returned classes and request identifier for auditability. Do not depend on a fixed label list: the available labels evolve with the service.
Errors
| Code | HTTP | Meaning |
|---|---|---|
| INVALID_REQUEST | 400 | Unsupported modality, missing input, invalid URL, or text over 1,024 characters. |
| INSUFFICIENT_CREDITS | 402 | The workspace cannot cover this request. |
| PROVIDER_UNAVAILABLE | 503 | Content moderation is temporarily unavailable; no completed request is charged. |