Test a template
POST/v1/templates/{slug}/testKey scope moderate
Runs a sample submission through the template's full pipeline and returns the moderation it would produce, with no side effects. Nothing is stored, no check is consumed, no review queue item is created, no webhook event is sent and no author is created or updated. Use it to try a template, or its unpublished draft, before sending live traffic.
Needs a key with the moderate scope. Authentication
Path parameters
slugstringRequiredSlug of the template to test. It replaces any
templatesent in the body.
Request body
A single object
templatestringAccepted and ignored. The template is the one named in the path.
content_idstringYour id for the object, up to 200 characters. It is returned with the result and read by duplicate detection as in a live request.
author_idstringYour id for the end user, up to 200 characters. An existing author's status and trust level are applied to the content rules. An unknown id is treated as a new, enabled author and no author is created.
context_idstringYour id for what the content belongs to, up to 200 characters. It is returned with the result.
metadatamapUp to 50 key and value pairs, returned with the result. Same limits as on
POST /v1/moderations.modeenumDefaultautoAccepted and ignored. A test always runs in the request and answers 200.
One of
autosyncasyncdry_runbooleanReturned as
dry_runin the result. It changes nothing else, because a test has no side effects.storebooleanAccepted and ignored. A test stores nothing.
client_actionobjectYour own decision about the sample, applied after the content rules and severity triage as in a live request.
actionenumRequiredescalatereplaces the recommendation only when yours is stricter.overridealways replaces it.One of
escalateoverriderecommendationenumRequiredThe recommendation to apply:
allow,revieworreject.One of
allowreviewreject
typeenumDefaulttextThe kind of content in
input:text(default) orimage.audioandvideoare in development and answer 400not_supported_yet.One of
textimageaudiovideoinputstring or URL or array of URLsRequiredThe sample content of a single object: a string of up to 20,000 characters for
text, or one or more image URLs forimage. Same limits as onPOST /v1/moderations.fieldstringKey of the template field the sample is. Without it, every field-level trigger of the template is applied to the sample.
draftbooleanSet to true to run the template's unpublished draft version. When the template has no draft, the published version runs. Default false.
A whole form
templatestringAccepted and ignored. The template is the one named in the path.
content_idstringYour id for the object, up to 200 characters. It is returned with the result and read by duplicate detection as in a live request.
author_idstringYour id for the end user, up to 200 characters. An existing author's status and trust level are applied to the content rules. An unknown id is treated as a new, enabled author and no author is created.
context_idstringYour id for what the content belongs to, up to 200 characters. It is returned with the result.
metadatamapUp to 50 key and value pairs, returned with the result. Same limits as on
POST /v1/moderations.modeenumDefaultautoAccepted and ignored. A test always runs in the request and answers 200.
One of
autosyncasyncdry_runbooleanReturned as
dry_runin the result. It changes nothing else, because a test has no side effects.storebooleanAccepted and ignored. A test stores nothing.
client_actionobjectYour own decision about the sample, applied after the content rules and severity triage as in a live request.
actionenumRequiredescalatereplaces the recommendation only when yours is stricter.overridealways replaces it.One of
escalateoverriderecommendationenumRequiredThe recommendation to apply:
allow,revieworreject.One of
allowreviewreject
fieldsmapRequiredA sample of a whole form: an object of 1 to 40 entries that maps each template field key to its value. Not accepted together with
input,typeorfield.draftbooleanSet to true to run the template's unpublished draft version. When the template has no draft, the published version runs. Default false.
Returns
A moderation whose id is null and whose test is true, always with status 200. usage.checks is 0 and usage.estimated is the number of checks the same submission would consume in a live request. For a form, the moderations under fields have a null id as well.
- 200 OKA moderation object
Errors
- 400
not_supported_yetThe sample carries audio or video.
- 403
plan_limitThe organisation's plan does not include templates and the slug is not
basic.- 404
template_not_foundThe project has no template with this slug, or the template is archived.
- 409
template_not_publishedThe template has no published version and
draftis not true.- 422
validation_errorThe body matches neither moderation shape: it has an unknown key, both
inputandfields, or neither of them.
Every endpoint can also answer the errors any request can meet: a missing key, a rate limit, a malformed body. Errors
Something missing or unclear on this page? Write to support@useinfrared.com.