---
title: "Test a classifier on a sample"
method: POST
path: "/classifiers/test"
tags: ["Gateway"]
---

# Test a classifier on a sample

`POST /classifiers/test`

## Request

- Base URL: `https://api.phaseo.app/v1`
- URL: `https://api.phaseo.app/v1/classifiers/test`
- Auth: HTTP bearer

Runs a draft or saved classifier once on a sample prompt and response, with the same request the gateway sends for it. The request is a real, billed model request made with your own credential and labelled phaseo.classifier_test. Owners and admins; the credential needs classifiers:write and gateway:access. Management keys cannot make model requests and are refused.

## Request body

- ClassifierTestRequest
  - `classifier` object: A draft to test. Fields not sent come from classifier_id when it is given.
    - `model` string
    - `instructions` string
    - `dimensions` ClassifierDimension[]
      - `key` string, required
      - `name` string
      - `description` string, nullable
      - `multiple` boolean: Allow more than one value per request.
      - `allow_other` boolean: Let the model answer "other" when no listed value fits.
      - `values` ClassifierValue[], required: Between 2 and 50 values. A single value is allowed only when allow_other is true.
        - `value` string, required
        - `description` string, nullable: Tells the model when to pick this value.
  - `classifier_id` string, uuid: A saved classifier in this workspace to test, or to label the test with.
  - `sample` object, required
    - `prompt` string, required
    - `response` string

## Response `200`

The labels the model chose

- ClassifierTestResponse
  - `data` object, required
    - `labels` object[]
      - `key` string
      - `value` string
      - `confidence` number, nullable
    - `answered` boolean: False when the model's answer could not be read.
    - `cost_usd` number
    - `model` string
    - `format` 'json_schema' | 'decisions' | 'json'
    - `request_id` string, nullable

## Other responses

- `400`: Invalid classifier or sample
- `401`: Unauthorized
- `403`: Not an owner or admin, missing classifiers:write, or the credential has no gateway:access
- `404`: Saved classifier not found in this workspace
- `502`: The model request failed (for example, insufficient credits)

## Changes

- **2026-10-28** `2eefd5c94c26`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/phaseo/apis/phaseo-gateway-api/changes/classifiers/test/post.md)

---

[API](https://skmtc.dev/phaseo/apis/phaseo-gateway-api.md) - [All operations](https://skmtc.dev/phaseo/apis/phaseo-gateway-api/llms.txt) - [OpenAPI document](https://skmtc.dev/phaseo/apis/phaseo-gateway-api/revisions/5ca9bb220d25?raw)
