☑ī¸Standard & Premium: Policy Classification endpoints

The Policy Classification endpoints will serve you two products: Unitary Standard and Unitary Premium. The table below shows more details for each:

For both the Standard and Premium products, Unitary will return in the classification results a raw score that you can use to set thresholds and determine if data is safe, harmful or ambiguous.

Please read How to select thresholdsif you need help analysing the Standard scores. We'll give you custom thresholds for any premium category we fine-tune to your policy or data.

You can contact support@unitary.ai if you wish to explore Unitary's Premium offering.

1. Authenticate

Please follow the API Authentication instructions first in order to authenticate with Unitary's API. This will generate a token that is valid for 24 hours and must be used in subsequent API requests.

2. Sending your first request

Depending on your use case, pick an image or a video and then use one of the following POST endpoints to send your first request.

POST endpoint reference

Example code

curl --location --request POST "https://api.unitary.ai/v1/classify/policy/image" \
--header "Authorization: Bearer {API_TOKEN}" \
--form "caption={CAPTION}" \
--form "url={RESOURCE_URL}"

3. Get results back via the GET endpoint

Using the GET endpoint may be inadequate for large scale! The recommendation is using the "callback_url" parameter instead. Please check the Integrating Webhooks guide for more information.

GET endpoint reference

Example code

curl --location --request GET "https://api.unitary.ai/v1/classify/image/{JOB_ID}" \
--header "Authorization: Bearer {BEARER_TOKEN}"

Example responses

Depending on the processing status of the job at the time of request, you can get any of the following as the response from the GET endpoints:

{
  "status": "done",
  "results": {
    "policy_categories": [
      {
        "name": "{CATEGORY_NAME}",
        "description": "{CATEGORY_DESCRIPTION}",
        "score": 0.99
      }
    ],
    "url": "{RESOURCE_URL}"
  }
}

4. Webhooks

(optional but encouraged)

In order to have a scalable end-to-end integration, the last step is to set up the receiving of webhooks as described in the following guide: Integrating Webhooks

Last updated