Quality Control
Check images, text, audio and video against the rules of each market before you publish. Set up regions, start a check, poll it, then read the decision.
Quality Control checks content before it goes out: an NSFW screen, then a check against the rules of each market you name. Every check follows the same four steps.
Set up your regions
A region is a market, such as a country, with a pass mark and a set of rules. List regions returns yours; the first call creates a default set if your organization has none. Add your own with Create a region and Add a rule, or let Suggest rules with AI propose some for you to review. Keep the id of each region you want to check against.
Start a check
Send the content with the region IDs in regionIds:
- an image by URL with Check an image from a URL, or as a file with Check an uploaded image;
- text with Check text;
- an audio file with Check audio, or a video with Check video;
- a file already in your organization's assets with Check a file from your assets.
Instead of sending an image, audio file or video in a multipart form, you can put it in storage first: Get an upload URL with its kind, PUT the file to the URL, then send the uploadKey you got, with the other fields, in a JSON body. Large files upload faster this way, and the API's form size limits don't apply.
You get a jobId back straight away. Credits are charged at this point. To see the words a text check is charged on before you start it, use Count billable words.
Track it
Poll Get a check until status is succeeded or failed. Images and text take a few seconds: poll every 2 to 5 seconds. For audio and video, every 10 to 30 seconds is enough.
Read the decision
When the check has succeeded, result holds the overall verdict, the NSFW result and a score for each region and rule. Its decisionId opens the full record with Get a decision. Flagged decisions also appear in the review queue.
Verdicts
verdict | Meaning |
|---|---|
APPROVED | The content passed every region it was checked against. |
REVIEW | A region flagged the content, or nothing could be scored. A person should look at it. |
BLOCKED | The NSFW screen blocked the content, or a region scored it as not acceptable. |
The overall verdict is the worst region verdict. If the NSFW screen blocks an image, its regions are not checked.
Scores
Each rule is scored from 0 to 100, where 100 means the content fully meets the rule, with a rationale that says why. The region score combines its rule scores, weighted by severity: low counts once, med twice and high four times. additional_findings lists problems the model found that no rule covers, each with a suggested_rule_description you can turn into a rule.
When part of a check could not run, for example because a model was unavailable, degraded is true and degradedReasons says why. Treat a degraded verdict with care.
Checks
status | Meaning |
|---|---|
queued | Accepted and waiting to start. |
running | In progress. For audio and video, stage shows the step: decoding, transcribing or scoring. |
succeeded | Finished. The outcome is in result. |
failed | Stopped with an error. error says why, and the credits are refunded. |
For video, scope chooses what is checked: video checks sampled frames, audio checks the transcribed speech, and both (the default) checks both. Turn off the NSFW screen with runNsfw: false or the region check with runRegional: false; at least one must stay on.
Your organization limits how many checks of each kind it can start per minute. Read the limits with Get settings; change them in the Universe app. Over a limit, a start call returns 429 with the wait in retry_after_sec.
Review
A person can overrule the model. List the review queue returns the REVIEW and BLOCKED decisions nobody has ruled on yet, and Rule on a decision records an approve or a reject. The model's verdict is kept; the ruling is shown next to it in adjudication.
Image fixes
For a flagged image, Fix an image makes an edited version that addresses one region's concerns. Poll Get an image fix for the new image; it usually takes 15 to 60 seconds. List image fixes returns the fixes already made for a decision.
Permissions
Each endpoint page lists the permission it needs. The API key needs them on the role of the person who created it.
| Resource | Covers | Actions used |
|---|---|---|
quality_control.classification | Start checks and image fixes, and read checks, decisions and their media. | create, delete, read |
quality_control.region | Regions and their rules, including AI rule suggestions. | create, delete, read, update |
quality_control.review | The review queue and rulings. | read, update |
quality_control.settings | Organization settings for checks. | read, update |
Credits
Checks are charged when they start: per image, per word of text, or per minute of audio and video. The price is corrected to what actually ran when the check finishes, and refunded in full if it fails on our side. Image fixes and AI rule suggestions are charged too. Without enough credits, a start call returns 402 and nothing is created. Current prices, from the same rate table that charges you, are on each endpoint page, such as Check an uploaded image and Check video. See Credits.