> ## Documentation Index
> Fetch the complete documentation index at: https://docs.whetdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Classify

> Classify text against custom criteria. It analyzes your text and provides scores (0-100) for each specified criterion, indicating how well the text matches each criteria.

## Overview

Classify text against custom criteria. It analyzes your text and provides scores (0-100) for each specified criterion, indicating how well the text matches each criteria.

## Use This Action To

* Evaluate text against custom criteria
* Score content based on specific attributes
* Classify documents by custom metrics
* Measure how well text matches defined criteria

## Parameters

<ParamField body="text" type="string" required>
  Text to classify (max 5,000 characters)
</ParamField>

<ParamField body="criteria" type="array" required>
  Array of criteria names to evaluate the text against
</ParamField>

## Example

```bash cURL theme={null}
curl -X POST https://whetdata.com/api/classify \
  -H "x-api-key: whet_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "This is a great product with awesome features",
    "criteria": ["is_positive"]
  }'
```

```javascript JavaScript theme={null}
const url = "https://whetdata.com/api/classify";
const options = {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "x-api-key": "whet_your_api_key_here",
  },
  body: JSON.stringify({
    text: "This is a great product with awesome features",
    criteria: ["is_positive"],
  }),
};

fetch(url, options)
  .then((response) => response.json())
  .then((data) => console.log(data))
  .catch((error) => console.error("Error:", error));
```

## Response

```json theme={null}
{
  "success": true,
  "scores": {
    "is_positive": 100,
    "would_order_again": 100,
    "mentions_taste": 100,
    "is_actionable": 1
  }
}
```

## Tips

<Warning>
  The maximum text length is 5,000 characters. For longer texts, split them into
  chunks.
</Warning>


## OpenAPI

````yaml POST /api/classify
openapi: 3.0.0
info:
  title: Whetdata API
  version: 1.0.0
servers:
  - url: https://whetdata.com
security: []
paths:
  /api/classify:
    post:
      summary: Classify
      description: >-
        Classify text against custom criteria. It analyzes your text and
        provides scores (0-100) for each specified criterion, indicating how
        well the text matches each criteria.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - text
                - criteria
              properties:
                text:
                  type: string
                  maxLength: 5000
                  description: Text to classify (max 5,000 characters)
                criteria:
                  type: array
                  items:
                    type: string
                  description: Array of criteria names to evaluate the text against
            example:
              text: This is a great product with awesome features
              criteria:
                - is_positive
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  scores:
                    type: object
                    additionalProperties:
                      type: number
                    description: Scores for each criterion (0-100)
              example:
                success: true
                scores:
                  is_positive: 80

````