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

# Train

`POST /v1/train`

Train or update a few-shot classifier.

Create a new classifier with labeled examples, or update an existing one
with additional training data.

## Request body

- union
  - union
    - EmbeddingsV2CreateTrainingRequest
      - `access` string — Access level for the training data. Can be 'public' or 'private'.
      - `num_iters` integer — Number of iterations for the training process.
      - `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 — Text embedding model for zero-shot classification.
      - `input` TextTrainingItem[], required — Must be a list of text-label training items with at least two unique labels. For batch training, provide a list with up to 512 items.
        - `text` string, required — Input text for training.
        - `label` string, required — Label for the input text.
    - EmbeddingsV3CreateTrainingRequest
      - `access` string — Access level for the training data. Can be 'public' or 'private'.
      - `num_iters` integer — Number of iterations for the training process.
      - `model` 'jina-embeddings-v3', required — Text embedding model for zero-shot classification.
      - `input` TextTrainingItem[], required — Must be a list of text-label training items with at least two unique labels. For batch training, provide a list with up to 512 items.
        - `text` string, required — Input text for training.
        - `label` string, required — Label for the input text.
    - EmbeddingsV4CreateTrainingRequest
      - `access` string — Access level for the training data. Can be 'public' or 'private'.
      - `num_iters` integer — Number of iterations for the training process.
      - `model` 'jina-embeddings-v4', required — Multimodal embedding model for zero-shot classification.
      - `input` union[], required — Must be a list of text-label or image-label training items with at least two unique labels. For batch training, provide a list with up to 512 items.
        - union
          - TextTrainingItem
            - `text` string, required — Input text for training.
            - `label` string, required — Label for the input text.
          - ImageTrainingItem
            - `image` string, required — Input image URL or base64 for training.
            - `label` string, required — Label for the input image.
    - EmbeddingsV5CreateTrainingRequest
      - `access` string — Access level for the training data. Can be 'public' or 'private'.
      - `num_iters` integer — Number of iterations for the training process.
      - `model` 'jina-embeddings-v5-text-nano' | 'jina-embeddings-v5-text-small', required — Text embedding model for zero-shot classification.
      - `input` TextTrainingItem[], required — Must be a list of text-label training items with at least two unique labels. For batch training, provide a list with up to 512 items.
        - `text` string, required — Input text for training.
        - `label` string, required — Label for the input text.
    - ClipCreateTrainingRequest
      - `access` string — Access level for the training data. Can be 'public' or 'private'.
      - `num_iters` integer — Number of iterations for the training process.
      - `model` 'jina-clip-v1' | 'jina-clip-v2', required — CLIP model for zero-shot classification of images and text.
      - `input` union[], required — Must be a list of text-label or image-label training items with at least two unique labels. For batch training, provide a list with up to 512 items. Each image can be up to 8MB.
        - union
          - TextTrainingItem
            - `text` string, required — Input text for training.
            - `label` string, required — Label for the input text.
          - ImageTrainingItem
            - `image` string, required — Input image URL or base64 for training.
            - `label` string, required — Label for the input image.
  - UpdateTrainingRequest
    - `classifier_id` string, required — ID of the classifier to use for few-shot classification.
    - `input` union, required — Input(s) for updating training. Accepts a `TextTrainingItem`, `ImageTrainingItem`, or a list of them. For batch update, provide a list with up to 512 items.
      - TextTrainingItem
        - `text` string, required — Input text for training.
        - `label` string, required — Label for the input text.
      - ImageTrainingItem
        - `image` string, required — Input image URL or base64 for training.
        - `label` string, required — Label for the input image.
      - union[]
        - union
          - TextTrainingItem
            - `text` string, required — Input text for training.
            - `label` string, required — Label for the input text.
          - ImageTrainingItem
            - `image` string, required — Input image URL or base64 for training.
            - `label` string, required — Label for the input image.
    - `num_iters` integer — Number of iterations for the training process.

## Response `200`

Successful Response

- TrainingResponse
  - `classifier_id` string, required — ID of the classifier that was trained or updated.
  - `num_samples` integer, required — Number of training samples processed in this request.
  - `usage` BaseUsage
    - `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)
