LogoLogo
Why Unitary?
  • Get started
    • 馃憢Step-by-step instructions
  • API References
    • 鈩癸笍Features and requirements
    • 鈻讹笍API Authentication
    • 鈽戯笍Standard & Premium: Policy Classification endpoints
      • 馃攦Add-on: synchronous endpoints
    • 馃泜Virtual Moderator endpoint
    • #锔忊儯Items and Characteristics endpoints
      • *锔忊儯List of Item and Characteristics
    • 鈴猴笍Detoxify endpoints
    • 鈫旓笍How to select thresholds
    • 鈫笍Integrating Webhooks
Powered by GitBook
On this page

Was this helpful?

  1. API References

Detoxify endpoints

PreviousList of Item and CharacteristicsNextHow to select thresholds

Last updated 1 year ago

Was this helpful?

Detoxify is an easy-to-use Python library that detects hateful or offensive language.

Detoxify is an to help researchers and practitioners identify potential toxic comments.

Detoxify models are trained to predict toxic comments on 3 Jigsaw challenges: Toxic comment classification, Unintended Bias in Toxic comments, and Multilingual toxic comment classification.

Detoxify endpoints

Detoxify is offered as a set of two standalone text-only API endpoints so that you can avoid the hassle of hosting open-source models.

Any requests you send should meet the requirements listed on Features and requirements.

Please follow the API Authentication instructions first. This will generate a token that is valid for 24 hours and must be used in subsequent API requests.

POST endpoint reference

GET endpoint reference

鈴猴笍
open-source tool

Retrieve the results of a queued Detoxify classification

get

This endpoint returns the results of a previously queued classify job

Authorizations
Path parameters
job_idstring 路 uuid4Required
Responses
200
Successful Response
application/json
404
Not found
422
Validation Error
application/json
get
GET /detoxify/text/{job_id} HTTP/1.1
Host: 
Authorization: Bearer JWT
Accept: */*
{
  "status": "done",
  "results": {
    "toxicity": 1,
    "severe_toxicity": 1,
    "obscene": 1,
    "threat": 1,
    "insult": 1,
    "identity_attack": 1,
    "sexual_explicit": 1
  },
  "msg": "text"
}
  • Detoxify endpoints
  • POST endpoint reference
  • POSTQueue text for Detoxify classification
  • GET endpoint reference
  • GETRetrieve the results of a queued Detoxify classification

Queue text for Detoxify classification

post

This endpoint predicts the Detoxify categories of text.

Authorizations
Body
callback_urlstring 路 uri 路 min: 1 路 max: 2083Optional
textstring 路 max: 262144Required
modelall ofOptionalDefault: multilingual
string 路 enumOptional

An enumeration.

Possible values:
correlation_idstring 路 max: 128Optional
Responses
200
Successful Response
application/json
404
Not found
422
Validation Error
application/json
post
POST /detoxify/text/ HTTP/1.1
Host: 
Authorization: Bearer JWT
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 99

"callback_url='https://example.com'&text='text'&model='multilingual'&correlation_id='text'"
{
  "job_id": "text"
}