# Sentiment & NLP API
> Analyse text in real time: sentiment scoring (positive / negative / neutral with the matched words), automatic language detection across 180+ languages, and a combined analysis endpoint with text statistics. No setup, no model hosting.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/nlp-api/..."
```

## Pricing
- **Free** (Free) — 5,000 calls/Mo, 2 req/s
- **Basic** ($14/Mo) — 120,000 calls/Mo, 8 req/s
- **Pro** ($42/Mo) — 600,000 calls/Mo, 25 req/s
- **Mega** ($119/Mo) — 2,500,000 calls/Mo, 60 req/s

## Endpoints

### NLP

#### `GET /v1/analyze` — Sentiment + language + statistics

**Parameters:**
- `text` (query, required, string) — Text to analyse Example: `Great service. Very happy!`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/nlp-api/v1/analyze?text=Great+service.+Very+happy%21"
```

**Response:**
```json
{
    "data": {
        "text": "Great service. Very happy!",
        "stats": {
            "char_count": 26,
            "word_count": 4,
            "sentence_count": 2,
            "avg_word_length": 5.75
        },
        "language": {
            "language": "deu",
            "reliable": true,
            "alternatives": [
                {
                    "score": 1,
                    "language": "deu",
                    "language_name": "German"
                },
                {
                    "score": 0.984,
                    "language": "eng",
                    "language_name": "English"
                },
                {
                    "score": 0.962,
                    "language": "nno",
                    "language_name": "nno"
                },
                {
                    "score": 0.933,
                    "language": "nds",
                    "language_name": "nds"
                },
                {
                    "score": 0.872,
                    "language": "dan",
                    "language_name": "Danish"
                }
            ],
            "language_name": "German"
        },
        "sentiment": {
            "label": "positive",
            "score": 6,
            "comparative": 1.5,
            "token_count": 4,
            "negative_words": [],
            "positive_words": [
                "happy",
                "great"
            ]
        }
    },
    "meta": {
        "timestamp": 
…(truncated, see openapi.json for full schema)
```

#### `GET /v1/language` — Language detection

**Parameters:**
- `text` (query, required, string) — Text to detect language of Example: `Das ist ein Test`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/nlp-api/v1/language?text=Das+ist+ein+Test"
```

**Response:**
```json
{
    "data": {
        "text": "Das ist ein Test",
        "language": "src",
        "reliable": true,
        "alternatives": [
            {
                "score": 1,
                "language": "src",
                "language_name": "src"
            },
            {
                "score": 0.99,
                "language": "deu",
                "language_name": "German"
            },
            {
                "score": 0.846,
                "language": "est",
                "language_name": "Estonian"
            },
            {
                "score": 0.791,
                "language": "glg",
                "language_name": "Galician"
            },
            {
                "score": 0.715,
                "language": "fin",
                "language_name": "Finnish"
            }
        ],
        "language_name": "src"
    },
    "meta": {
        "timestamp": "2026-05-29T23:19:52.243Z",
        "request_id": "ce1474a6-57fc-49c4-bc35-b4cfdffee7f5"
    },
    "status": "ok",
    "message": "Language detected successfully",
    "success": true
}
```

#### `GET /v1/sentiment` — Sentiment analysis

**Parameters:**
- `text` (query, required, string) — Text to analyse Example: `I love this product`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/nlp-api/v1/sentiment?text=I+love+this+product"
```

**Response:**
```json
{
    "data": {
        "text": "I love this product",
        "label": "positive",
        "score": 3,
        "comparative": 0.75,
        "token_count": 4,
        "negative_words": [],
        "positive_words": [
            "love"
        ]
    },
    "meta": {
        "timestamp": "2026-05-29T23:19:52.292Z",
        "request_id": "9d8d5e68-654e-4ff8-9bf8-7f5e4b803cae"
    },
    "status": "ok",
    "message": "Sentiment analyzed successfully",
    "success": true
}
```


---
Marketplace page: https://www.oanor.com/api/nlp-api
OpenAPI spec: https://www.oanor.com/api/nlp-api/openapi.json
