detection

Content safety check

Score a text for unsafe content across seven categories — toxicity, profanity, harassment, hate_speech, self_harm, sexual, violence — each as a 0-1 probability. Returns scores (all seven), flagged (whether any category reached the threshold, default 0.5) and flagged_categories. With spans=true, also returns spans: the specific offending passages, each with its text, start/end offsets into the submitted text, per-category scores and flagged_categories — use it to highlight, quote, or redact just the violating passage instead of rejecting the whole text.

post/api/v1/safety

Request

  • Base URL: https://api.sapling.ai
  • URL: https://api.sapling.ai/api/v1/safety
  • Auth: one of:
    • HTTP bearer
    • OAuth 2 (authorization code, authorization URL https://api.sapling.ai/oauth/authorize, token URL https://api.sapling.ai/oauth/token, scopes: sapling:api)
    • none

Request body

OR

Response

Successful response. Field-level schemas and examples: https://sapling.ai/docs/api/safety/ A batch (texts) request answers {"results": [...]} instead: one single-text response per input text, in input order.

resultsobject[]

Present only for a batch (texts) request: one entry per input text, in input order, each shaped exactly like the single-text response.

Changes

No recorded changes to this operation across all 1 revision of this API.