---
title: "gliner2-pii — API Reference"
canonical: "https://build.nvidia.com/fastino/gliner2-pii/apireference"
updated: "2026-11-20T00:00:30.763Z"
---

# gliner2-pii — API Reference

[Model overview](/fastino/gliner2-pii.md)

OpenAPI: 3.1.0. API version: 0.1.0.

## Endpoints and schemas

- [POST /chat/completions](#api-post-chat-completions)
- [Schemas](#api-schemas)
- [Message](#api-message)
- [TextPart](#api-textpart)
- [ExtractionRequest](#api-extractionrequest)
- [Entity](#api-entity)
- [ExtractionResult](#api-extractionresult)
- [ChatCompletion](#api-chatcompletion)
- [Error](#api-error)
- [Reusable components](#api-reusable-components)
- [components.securitySchemes](#api-components-securityschemes)

<a id="api-post-chat-completions"></a>

## POST /chat/completions

Extract PII spans from text

Runs the pinned GLiNER2 PII span extractor. Does not redact input or stream results. flat_ner=false uses the reference longest-span policy; flat_ner=true selects non-overlapping boundaries. Returns the reference score and deterministic ordering by start, end and label. Request byte limit is 262144.

Operation ID: `extract_pii`

- POST `https://integrate.api.nvidia.com/v1/chat/completions`

Server definitions:

```json
[
  {
    "url": "https://integrate.api.nvidia.com/v1"
  }
]
```

### Authentication

Each entry is an alternative. All schemes within an entry are required; an empty entry permits anonymous access.

```json
[
  {
    "BearerAuth": []
  }
]
```

#### BearerAuth

```json
{
  "type": "http",
  "scheme": "bearer"
}
```

### Request body

Required: yes.

#### application/json

```json
{
  "schema": {
    "$ref": "#/components/schemas/ExtractionRequest"
  }
}
```

Example:

```json
{
  "text": "Email jane@example.com.",
  "pii_labels": "email",
  "threshold": 0.3
}
```

### Responses

#### 200

Extraction result

#### application/json

```json
{
  "schema": {
    "$ref": "#/components/schemas/ChatCompletion"
  }
}
```

#### 404

Unknown model

#### application/json

```json
{
  "schema": {
    "$ref": "#/components/schemas/Error"
  }
}
```

#### 408

Request body upload exceeded the gateway's 10-second budget

#### 413

Request byte limit exceeded

#### application/json

```json
{
  "schema": {
    "$ref": "#/components/schemas/Error"
  }
}
```

#### 422

Invalid extraction request

#### application/json

```json
{
  "schema": {
    "$ref": "#/components/schemas/Error"
  }
}
```

#### 429

Queue full

#### application/json

```json
{
  "schema": {
    "$ref": "#/components/schemas/Error"
  }
}
```

#### 503

Model unavailable or timed out

#### application/json

```json
{
  "schema": {
    "$ref": "#/components/schemas/Error"
  }
}
```

<a id="api-schemas"></a>

## Schemas

<a id="api-message"></a>

### Message

```json
{
  "additionalProperties": false,
  "properties": {
    "role": {
      "enum": [
        "user",
        "assistant",
        "system"
      ],
      "title": "Role",
      "type": "string"
    },
    "content": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "items": {
            "$ref": "#/components/schemas/TextPart"
          },
          "type": "array"
        }
      ],
      "title": "Content"
    }
  },
  "required": [
    "role",
    "content"
  ],
  "title": "Message",
  "type": "object"
}
```

<a id="api-textpart"></a>

### TextPart

```json
{
  "additionalProperties": false,
  "properties": {
    "type": {
      "const": "text",
      "title": "Type",
      "type": "string"
    },
    "text": {
      "maxLength": 16384,
      "title": "Text",
      "type": "string"
    }
  },
  "required": [
    "type",
    "text"
  ],
  "title": "TextPart",
  "type": "object"
}
```

<a id="api-extractionrequest"></a>

### ExtractionRequest

```json
{
  "additionalProperties": false,
  "properties": {
    "model": {
      "maxLength": 200,
      "minLength": 1,
      "title": "Model",
      "type": "string",
      "default": "fastino/gliner2-pii"
    },
    "messages": {
      "items": {
        "$ref": "#/components/schemas/Message"
      },
      "maxItems": 32,
      "minItems": 1,
      "title": "Messages",
      "type": "array",
      "description": "Only the last message is analyzed. Text parts are concatenated without a separator. Maximum analyzed text is 16384 characters and 128 chunks."
    },
    "labels": {
      "items": {
        "type": "string",
        "enum": [
          "access_token",
          "account_id",
          "account_number",
          "address",
          "api_key",
          "bank_account",
          "card_cvv",
          "card_expiry",
          "card_number",
          "city",
          "country",
          "date_of_birth",
          "document_date",
          "drivers_license_number",
          "email",
          "expiration_date",
          "first_name",
          "full_name",
          "government_id",
          "iban",
          "ip_address",
          "last_name",
          "license_number",
          "middle_name",
          "national_id_number",
          "passport_number",
          "password",
          "payment_card",
          "person",
          "phone_number",
          "postal_code",
          "recovery_code",
          "routing_number",
          "secret",
          "sensitive_account_id",
          "sensitive_date",
          "state_or_region",
          "street_address",
          "tax_id",
          "tax_number",
          "transaction_date",
          "username"
        ]
      },
      "maxItems": 42,
      "minItems": 1,
      "title": "Labels",
      "type": "array",
      "description": "Required nonempty subset of the 42 supported PII labels; duplicates are rejected."
    },
    "threshold": {
      "default": 0.3,
      "maximum": 1,
      "minimum": 0.01,
      "title": "Threshold",
      "type": "number",
      "description": "Global confidence cutoff. This is an extraction score, not a guarantee of PII detection."
    },
    "chunk_length": {
      "default": 384,
      "maximum": 2048,
      "minimum": 64,
      "title": "Chunk Length",
      "type": "integer",
      "description": "Chunk length in Unicode characters; must exceed overlap."
    },
    "overlap": {
      "default": 128,
      "maximum": 512,
      "minimum": 0,
      "title": "Overlap",
      "type": "integer",
      "description": "Overlap in Unicode characters, not tokens or words."
    },
    "flat_ner": {
      "default": false,
      "title": "Flat Ner",
      "type": "boolean"
    },
    "batch_size": {
      "default": 8,
      "maximum": 16,
      "minimum": 1,
      "title": "Batch Size",
      "type": "integer"
    },
    "stream": {
      "const": false,
      "default": false,
      "title": "Stream",
      "type": "boolean"
    }
  },
  "required": [
    "model",
    "messages",
    "labels"
  ],
  "title": "ExtractionRequest",
  "type": "object"
}
```

<a id="api-entity"></a>

### Entity

```json
{
  "type": "object",
  "required": [
    "text",
    "label",
    "start",
    "end",
    "score"
  ],
  "properties": {
    "text": {
      "type": "string"
    },
    "label": {
      "type": "string",
      "enum": [
        "access_token",
        "account_id",
        "account_number",
        "address",
        "api_key",
        "bank_account",
        "card_cvv",
        "card_expiry",
        "card_number",
        "city",
        "country",
        "date_of_birth",
        "document_date",
        "drivers_license_number",
        "email",
        "expiration_date",
        "first_name",
        "full_name",
        "government_id",
        "iban",
        "ip_address",
        "last_name",
        "license_number",
        "middle_name",
        "national_id_number",
        "passport_number",
        "password",
        "payment_card",
        "person",
        "phone_number",
        "postal_code",
        "recovery_code",
        "routing_number",
        "secret",
        "sensitive_account_id",
        "sensitive_date",
        "state_or_region",
        "street_address",
        "tax_id",
        "tax_number",
        "transaction_date",
        "username"
      ]
    },
    "start": {
      "type": "integer",
      "minimum": 0
    },
    "end": {
      "type": "integer",
      "minimum": 0
    },
    "score": {
      "type": "number",
      "minimum": 0,
      "maximum": 1
    }
  },
  "description": "Offsets are zero-based Unicode character indices into the original analyzed text, with exclusive end."
}
```

<a id="api-extractionresult"></a>

### ExtractionResult

```json
{
  "type": "object",
  "required": [
    "entities"
  ],
  "properties": {
    "entities": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/Entity"
      }
    }
  }
}
```

<a id="api-chatcompletion"></a>

### ChatCompletion

```json
{
  "type": "object",
  "required": [
    "id",
    "object",
    "created",
    "model",
    "choices",
    "usage"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "object": {
      "const": "chat.completion"
    },
    "created": {
      "type": "integer"
    },
    "model": {
      "type": "string"
    },
    "choices": {
      "type": "array",
      "minItems": 1,
      "maxItems": 1,
      "items": {
        "type": "object",
        "required": [
          "index",
          "message",
          "finish_reason"
        ],
        "properties": {
          "index": {
            "const": 0
          },
          "finish_reason": {
            "const": "stop"
          },
          "message": {
            "type": "object",
            "required": [
              "role",
              "content"
            ],
            "properties": {
              "role": {
                "const": "assistant"
              },
              "content": {
                "type": "string",
                "description": "JSON-encoded ExtractionResult; parse this string to obtain entities."
              }
            }
          }
        }
      }
    },
    "usage": {
      "type": "object",
      "description": "Compatibility fields are zero; no generative tokens are produced.",
      "properties": {
        "prompt_tokens": {
          "const": 0
        },
        "completion_tokens": {
          "const": 0
        },
        "total_tokens": {
          "const": 0
        }
      }
    }
  }
}
```

<a id="api-error"></a>

### Error

```json
{
  "type": "object",
  "required": [
    "error"
  ],
  "properties": {
    "error": {
      "type": "object",
      "required": [
        "message"
      ],
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}
```

<a id="api-reusable-components"></a>

## Reusable components

<a id="api-components-securityschemes"></a>

### components.securitySchemes

```json
{
  "BearerAuth": {
    "type": "http",
    "scheme": "bearer"
  }
}
```