/api/v1/moderation/{id}The request's stored answer, your metadata, whether anyone acted on it (state) and the actions taken. Any key that is not restricted can read.
Path parameters#
| Parameter | Type | Description |
|---|---|---|
id required |
integer |
The request's id. |
Responses#
200#
The request.
-
idinteger required -
typestring requiredOne of:
text_moderation,image_moderation,video_moderation,audio_moderation,live_stream_moderation. The kind of content to check.live_stream_moderationis done with live sessions (400 here). -
createdAtinteger requiredWhen it was made, in Unix seconds.
-
metadataobjectYour
metadatafrom the request, when you sent one. -
statestring requiredOne of:
pending,actioned.pendinguntil the first action is taken. -
actionsarray of ActionTaken requiredThe actions taken, oldest first.
-
modestringOne of:
detect,capture,censor.detect: flags and confidence only.capture: alsodetections, which say where each flag was found for flags with positions.censor: also a censored copy of what flags with positions found. Text and image flags have no positions, so for them all three return the flags and their confidence, at the same price. -
statusstringOne of:
queued,processing,completed,partial,unavailable.queuedorprocessing: an async request waiting or being checked (a live session in progress isprocessingtoo).completedorpartial: as in the moderation answer.unavailable: the check could not run (seeerror). -
flaggedbooleantruewhen at least one flag was raised. -
flagsarray of FlagResultThe flags raised, empty when the content is clean.
-
checkedarray of stringFlags that were checked.
-
uncheckedarray of stringFlags that could not be checked. A flag missing here and from
flagswas checked and not found. -
messagestringPartial results and checks that could not run: what happened.
-
mediaobject (Media)Videos: how the video was sampled.
-
trackingbooleanVideos asked with
tracking: alwaystrue. Detections carrytrack, and the ones tracking addedtracked. -
censoredTextstringText with
mode: "censor": the text with the flagged spans masked by*(same length). Only flags with positions are masked, and text flags have none, so it is the text as you sent it. -
tookMsintegerProcessing time in milliseconds.
-
usageobjectWhat the request was charged.
-
chargedintegerChecks that could not run: 0, nothing was charged.
-
retryAfterinteger or nullSeconds to wait (also sent as the
Retry-Afterheader);nullfornot_available_yet. -
statusUrlstring -
liveobject (LiveSession) or objectLive streams: a session's entry carries the session as it ended; a moment carries the session it belongs to and when.
-
erroranyA check that could not run:
temporarily_unavailableornot_available_yet(see Errors); for an async request that failed, any error code.
actions[] (ActionTaken)
-
idinteger required -
keystring required -
labelstring required -
byobject (Actor) requiredWho took an action.
-
notestring or null required -
atinteger requiredWhen, in Unix seconds.
by (Actor)
-
typestring requiredOne of:
user,api.user: someone in the dashboard;api: a call with an API key. -
namestring requiredThe person's name, or the API key's label.
flags[] (FlagResult)
-
flagstring requiredThe flag's key, one of those
GET /api/v1/flagslists. See Flags. -
confidencenumber requiredThe highest confidence among the flag's detections. From 0 to 1.
-
detectionsarray of DetectionThe flag's findings, strongest first. Not present in
detectmode. For text and image flags they have no position.
detections[] (Detection)
-
labelstring requiredThe model's own label for the finding (informational; may change). Use
flagfor decisions. -
confidencenumber requiredHow sure the model is. From 0 to 1.
-
bboxarray of numberImages and videos, for a flag with positions: the box
[x1, y1, x2, y2]in pixels of the original image or video frame. -
polygonarray of array of numberImages and videos, when the model outlines the finding: its outline as
[x, y]points in original pixels. -
tnumberVideos, for a flag with positions: seconds from the start of the video.
-
frameintegerVideos, for a flag with positions: the index of the sampled frame.
-
trackintegerWith
tracking: the object this finding belongs to. The same object keeps the same number across frames. From 1. -
trackedbooleanWith
tracking:truewhen a model missed the object in this frame and tracking carried it over. Its confidence is the object's best. -
startnumberText: start of the span, a Unicode code point index (inclusive). Audio: seconds.
-
endnumberText: end of the span, a Unicode code point index (exclusive). Audio: seconds.
-
textstringAudio: the words.
media (Media)
-
kindstring requiredOne of:
video. Alwaysvideo. -
fpsnumber requiredFrames checked per second.
-
framesinteger requiredFrames checked.
-
widthinteger requiredVideo width in pixels.
-
heightinteger requiredVideo height in pixels.
-
durationSnumberVideo length in seconds, when known.
-
truncatedboolean requiredtruewhen checking stopped before the end (at most 300 frames or 80 seconds of processing).
usage
-
chargedinteger requiredCredits taken by the request.
401#
Missing, unknown, revoked or expired API key, or the account is not active.
{
"error": "unauthorized",
"message": "The API key is not valid."
}404#
No such request for this account.
{
"error": "not_found",
"message": "No such request."
}429#
Too many requests in a minute. Wait Retry-After seconds. See Rate limits.
Header Retry-After: Seconds to wait.
{
"error": "too_many_requests",
"message": "Too many requests. Try again in a minute."
}Request
curl -X GET https://api.detectivision.ai/api/v1/moderation/{id} \
-H "Api-Key: $DETECTIVISION_API_KEY"import os, requests
r = requests.get(
"https://api.detectivision.ai/api/v1/moderation/{id}",
headers={"Api-Key": os.environ["DETECTIVISION_API_KEY"]},
)
print(r.status_code, r.json())const res = await fetch("https://api.detectivision.ai/api/v1/moderation/{id}", {
method: "GET",
headers: {
"Api-Key": process.env.DETECTIVISION_API_KEY,
},
});
console.log(res.status, await res.json());