#️⃣Items and Characteristics endpoints
1. Authenticate
2. Sending your first request
POST endpoint reference
This endpoint queues a job that predicts the Items & Characteristics categories of a single image.
The request must contain either a file (a multi-part form encoded image file) or a url form field (a string containing a URL to download the image file from).
Example CURL:
curl --location --request POST https://api.unitary.ai/v1/classify/items-characteristics/image --header "Authorization: Bearer {API_TOKEN}" --header "Content-Type: multipart/form-data" --form "url={RESOURCE_URL}"
A job ID will be returned in the response.
If a callback_url form field is included in the request then the results webhook will be sent as a POST request to this URL once the image has been classified.
Alternatively results can be obtained by making a GET request to the results endpoint using the job ID.
Webhooks should be implemented for any use of this endpoint at scale to prevent unnecessary polling of the results endpoint.
Successful Response
Not found
Validation Error
This endpoint queues a job that predicts the Items & Characteristics categories of a single video.
The request must contain either a file (a multi-part form encoded video file) or a url form field (a string containing a URL to download the video file from).
Example CURL:
curl --location --request POST https://api.unitary.ai/v1/classify/items-characteristics/video --header "Authorization: Bearer {API_TOKEN}" --header "Content-Type: multipart/form-data" --form "url={RESOURCE_URL}"
A job ID will be returned in the response.
If a callback_url form field is included in the request then the results webhook will be sent as a POST request to this URL once the image has been classified.
Alternatively results can be obtained by making a GET request to the results endpoint using the job ID.
Webhooks should be implemented for any use of this endpoint at scale to prevent unnecessary polling of the results endpoint.
Successful Response
Not found
Validation Error
Example code
3. Get results back via the GET endpoint
GET endpoint reference
This endpoint returns the results of a previously queued classify job.
The response for each item is a prevalence score between 0 and 1 that represents how present it is in the content. 1 is highest prevalence and 0 is lowest prevalence.
You can use these scores in mappings or models to implement safety policies, for example setting a numerical threshold for automated flagging of content or in a linear regression model.
Note that the score meaning and distribution is different for each item: for example, a 0.7 for pepe won't translate to the same likelihood of harmful content as a 0.7 for confederate flag.
Therefore you should calculate an individual threshold for each item. For best performance, we suggest calculating a threshold using labelled data, optimising for the balance of precision and
recall best suited to your needs. The Unitary team is happy to provide guidance on this process.
Successful Response
Not found
Validation Error
This endpoint returns the results of a previously queued classify job.
The response for each item is a prevalence score between 0 and 1 that represents how present it is in the content. 1 is highest prevalence and 0 is lowest prevalence.
You can use these scores in mappings or models to implement safety policies, for example setting a numerical threshold for automated flagging of content or in a linear regression model.
Note that the score meaning and distribution is different for each item: for example, a 0.7 for pepe won't translate to the same likelihood of harmful content as a 0.7 for confederate flag.
Therefore you should calculate an individual threshold for each item. For best performance, we suggest calculating a threshold using labelled data, optimising for the balance of precision and
recall best suited to your needs. The Unitary team is happy to provide guidance on this process.
Successful Response
Not found
Validation Error
Example code
4. Thresholding
5. Webhooks
Last updated
Was this helpful?
