When to Use the Category Endpoint

Use the /v1/categorize/ endpoint when:

  • Resources need to be organized into categories.
  • JSON schemas and rules are required to define category structure.

How to Categorize a Resource

Send a POST request to the /v1/categorize/ endpoint with the required parameters in the body.

Required Parameters

ParameterTypeDescription
resourceStringDescription of the resource to be categorized.
typeStringType of resource (e.g., “file”, “Web”). see full list of accepted types here
json_schemaStringThe JSON schema for defining the category.
categoriesStringList of categories
promptStringAn overall command of your request

Request Example

  curl --request POST \
    --url https://api.wetrocloud.com/v1/categorize/ \
    --header 'Authorization: Token <api-key>' \
    --header 'Content-Type: application/json' \
    --data '{
      "resource": "match review: John Cena vs. The Rock are fighting",
      "type": "text",
      "json_schema": "{'label':'string'}",
      "categories": ["football", "coding", "entertainment", "basketball", "wrestling", "information"]
      "prompt": "Where does this fall under?",
    }'

Successful Response

{
    "response": {
        "label": "wrestling"
    },
    "tokens": 1746,
    "success": true
}
FieldDescription
responseJSON object structured as per the provided schema.
tokensThe number of tokens used for processing the request.
successIndicates whether the operation was successful.