---
title: "Classify"
method: POST
path: "/v1/classify"
tags: ["Zero/Few-shot Classification"]
---

# Classify

`POST /v1/classify`

Classify text or images into categories.

Zero-shot and few-shot classification. Zero-shot uses embedding similarity,
few-shot uses a trained classifier.

## Request body

- union
  - union
    - EmbeddingsV2ZeroShotClassificationRequest — Zero-shot classification using Embeddings v2.
      - `labels` union, required — Candidate labels: a list of up to 512 labels, or a dict of up to 8 groups with max 64 labels each.
        - string[]
        - object
      - `model` 'jina-embeddings-v2-base-en' | 'jina-embeddings-v2-base-zh' | 'jina-embeddings-v2-base-de' | 'jina-embeddings-v2-base-es' | 'jina-embeddings-v2-base-code', required — The embedding model to use.
      - `input` union, required — Text to classify: a string, `TextDoc`, or list of up to 512 items.
        - string
        - TextDoc
          - `text` string, required — Text content to process.
        - union[]
          - union
            - string
            - TextDoc
              - …
    - EmbeddingsV3ZeroShotClassificationRequest — Zero-shot classification using Embeddings v3.
      - `labels` union, required — Candidate labels: a list of up to 512 labels, or a dict of up to 8 groups with max 64 labels each.
        - string[]
        - object
      - `model` 'jina-embeddings-v3', required — The embedding model to use.
      - `input` union, required — Text to classify: a string, `TextDoc`, or list of up to 512 items.
        - string
        - TextDoc
          - `text` string, required — Text content to process.
        - union[]
          - union
            - string
            - TextDoc
              - …
    - EmbeddingsV4ZeroShotClassificationRequest — Zero-shot classification using Embeddings v4.
      - `labels` union, required — Candidate labels: a list of up to 512 labels, or a dict of up to 8 groups with max 64 labels each.
        - string[]
        - object
      - `model` 'jina-embeddings-v4', required — The embedding model to use.
      - `input` union, required — Text to classify: a string, `TextDoc`, or list of up to 512 items.
        - string
        - TextDoc
          - `text` string, required — Text content to process.
        - union[]
          - union
            - string
            - TextDoc
              - …
    - EmbeddingsV5ZeroShotClassificationRequest — Zero-shot classification using Embeddings v5 text models.
      - `labels` union, required — Candidate labels: a list of up to 512 labels, or a dict of up to 8 groups with max 64 labels each.
        - string[]
        - object
      - `model` 'jina-embeddings-v5-text-nano' | 'jina-embeddings-v5-text-small', required — The embedding model to use.
      - `input` union, required — Text to classify: a string, `TextDoc`, or list of up to 512 items.
        - string
        - TextDoc
          - `text` string, required — Text content to process.
        - union[]
          - union
            - string
            - TextDoc
              - …
    - ClipZeroShotClassificationRequest — Zero-shot classification using CLIP for text and images.
      - `labels` union, required — Candidate labels: a list of up to 512 labels, or a dict of up to 8 groups with max 64 labels each.
        - string[]
        - object
      - `model` 'jina-clip-v1' | 'jina-clip-v2', required — The CLIP model to use.
      - `input` union, required — Content to classify: a string, `TextDoc`, `ImageDoc`, or list of up to 512 items. Images up to 8MB.
        - string
        - TextDoc
          - `text` string, required — Text content to process.
        - ImageDoc
          - `image` string, required — Image as a URL or base64-encoded string.
        - union[]
          - union
            - string
            - TextDoc
              - …
            - ImageDoc
              - …
    - CodeEmbeddingsZeroShotClassificationRequest — Zero-shot classification using code embedding models.
      - `labels` union, required — Candidate labels: a list of up to 512 labels, or a dict of up to 8 groups with max 64 labels each.
        - string[]
        - object
      - `model` 'jina-code-embeddings-0.5b' | 'jina-code-embeddings-1.5b', required — The code embedding model to use.
      - `input` union, required — Code to classify: a string, `TextDoc`, or list of up to 512 items.
        - string
        - TextDoc
          - `text` string, required — Text content to process.
        - union[]
          - union
            - string
            - TextDoc
              - …
  - FewShotClassificationRequest — Few-shot classification using a trained classifier.
    - `classifier_id` string, required — ID of the trained classifier to use.
    - `input` union, required — Text to classify: a string, `TextDoc`, or list of up to 512 items.
      - string
      - TextDoc
        - `text` string, required — Text content to process.
      - union[]
        - union
          - string
          - TextDoc
            - `text` string, required — Text content to process.

## Response `200`

Successful Response

- ClassificationResponse — Response containing classification results.
  - `data` ClassificationPrediction[], required — Classification results, one per input item.
    - `object` string — Object type, always `classification`.
    - `index` integer, required — Position of this result in the input list.
    - `prediction` union, required — Predicted label, or a dict of labels per group.
      - string
      - object
    - `score` union, required — Confidence score, or a dict of scores per group.
      - number
      - object
    - `predictions` union, required — All candidate labels with scores, or a dict per group.
      - ClassificationPredictionLabel[]
        - `label` string, required — The candidate label.
        - `score` number, required — Confidence score for this label.
      - object
  - `usage` BaseUsage, required
    - `total_tokens` integer, required — Total number of tokens processed.

## Other responses

- `400` — - **INPUT_MODEL_NOT_FOUND**: Model 'model_name' not found. Available models: .... - **INPUT_INVALID_LABELS**: Invalid training labels. At least {min_labels} unique labels are required for training. - **INPUT_LABEL_LIMIT_EXCEEDED**: Label limit exceeded: {current} labels provided, maximum N allowed for your plan. Reduce the number of labels or upgrade your plan at https://jina.ai/api-dashboard/key-manager. - **INPUT_TOKEN_LIMIT_EXCEEDED**: Input text exceeds the model's maximum of {max_tokens} tokens. Use 'truncate: true' to automatically truncate, or split into smaller chunks.
- `401` — - **AUTH_MISSING_API_KEY**: Authentication required. Provide your API key via the Authorization header: 'Authorization: Bearer <api-key>'. Get your API key at https://jina.ai/api-dashboard/key-manager. - **AUTH_INVALID_API_KEY**: Invalid API key. Verify your API key at https://jina.ai/api-dashboard/key-manager or generate a new one. - **AUTH_INVALID_FORMAT**: Invalid authorization format. Use 'Authorization: Bearer <api-key>' with a valid Jina API key (65 characters, starts with 'jina_').
- `403` — - **AUTHZ_INSUFFICIENT_BALANCE**: Insufficient account balance. Top up your account at https://jina.ai/api-dashboard/key-manager. - **AUTHZ_RESOURCE_LIMIT_EXCEEDED**: Resource limit exceeded for your plan. Current: {current}, limit: N. Delete existing resources or upgrade your plan at https://jina.ai/api-dashboard/key-manager.
- `404` — - **RESOURCE_NOT_FOUND**: {resource_type} '{resource_id}' not found or access denied. Verify the ID and your permissions.
- `409` — - **CONFLICT_RESOURCE_BUSY**: {resource_type} '{resource_id}' is currently being modified. Please retry after a few moments.
- `422` — Validation Error
- `429` — - **RATE_REQUEST_LIMIT_EXCEEDED**: Request rate limit exceeded: {current}/N requests per minute. Reduce request frequency or upgrade your plan at https://jina.ai/api-dashboard/key-manager. - **RATE_TOKEN_LIMIT_EXCEEDED**: Token rate limit exceeded: {current:,}/{limit:,} tokens per minute. Reduce batch sizes or upgrade your plan at https://jina.ai/api-dashboard/key-manager. - **RATE_CONCURRENCY_LIMIT_EXCEEDED**: Concurrency limit exceeded: {current}/N concurrent requests. Wait for pending requests to complete before sending new ones. - **RATE_IP_LIMIT_EXCEEDED**: IP rate limit exceeded. Too many requests from this IP address. Reduce request frequency.
- `500` — - **INTERNAL_ERROR**: An unexpected error occurred. If this persists, contact support with the request_id from this response.
- `503` — - **SERVICE_UNAVAILABLE**: Service temporarily unavailable. Please retry with exponential backoff.
- `504` — - **SERVICE_TIMEOUT**: Service request timed out. Try with smaller inputs or retry later.

---

[API](https://skmtc.net/jina/apis/jina-search-foundation-api.md) · [All operations](https://skmtc.net/jina/apis/jina-search-foundation-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/jina/jina-search-foundation-api/versions/0ae64d1cd6e1/schema)
