---
title: "Label Existing Ner"
method: POST
path: "/generate/ner/label-existing"
tags: ["generate"]
---

# Label Existing Ner

`POST /generate/ner/label-existing`

Label existing texts for NER entity extraction.

Applies the provided label set to a corpus of raw texts using Felix.

Args:
    request: NER labeling request with texts and label definitions.
    auth: Authenticated user context.

Returns:
    GenerateResponse with labeled samples and optional dataset info.

Raises:
    HTTPException: 400 if no valid inputs or dataset validation fails.
    HTTPException: 500 on labeling failure.

## Request body

- LabelExistingNERRequest — Label existing texts for NER
  - `user_id` string, nullable — User ID (optional, uses authenticated user if not provided)
  - `labels` string[], required — List of entity labels (e.g., ['PERSON', 'ORG', 'LOC'])
  - `inputs` string[], required — List of texts to label
  - `domain_description` string, nullable — Domain description for generation context
  - `seed` integer, nullable — Random seed for reproducibility
  - `session_id` string, nullable — Session ID for log streaming
  - `config_num_examples` integer — Number of examples to generate for config
  - `temperature` number — Generation temperature
  - `constraints` ConstraintRequest[], nullable — Custom constraints
    - `description` string, required — Constraint description
    - `choices` string[], nullable — Optional list of choices for this constraint
    - `weights` number[], nullable — Optional weights for choices (must align with choices length)
    - `probability` number, nullable — Optional probability (0.0-1.0) for this constraint
  - `save_dataset` boolean — Save generated dataset to S3 and database
  - `dataset_name` string, nullable — Name for the saved dataset (required if save_dataset=True)
  - `project_id` string, uuid, nullable — Project ID to assign the dataset to

## Response `200`

Successful Response

- GenerateResponse — Generation response
  - `success` boolean, required
  - `data` object[], required
  - `count` integer, required
  - `task_type` string, required
  - `token_usage` integer, nullable — Estimated tokens used for generation
  - `dataset` object, nullable — Dataset info if saved to S3/database

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/pioneer/apis/brain-api.md) · [All operations](https://skmtc.net/pioneer/apis/brain-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/pioneer/brain-api/revisions/b92f75fd3b61/schema)
