# Text API reference

Text extraction, entity recognition, sentiment, and question answering in one API.

Get an API key with metered billing at the
[TextAPI storefront](https://store.apidirectory.com/~textapi/), or browse the
listing on [APIDirectory](https://apidirectory.com/api/textapi).

Base URL: `https://api.textapi.com/`. Send your key in the `X-API-Key` header; the remaining allowance comes back on every response in `X-Gw-Remaining`.

MCP server: `https://developers.textapi.com/mcp` (bearer token = the same key).

## Errors every operation can return

- `422` Validation Error

```json
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}
```

# Extract Text

# Text

## GET /text

**Get Text**

### Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `url` | query | string | yes | Example: string |

### Responses

- `200` Successful Response

### Example

```bash
curl "https://api.textapi.com/text?url=string" \
  -H "X-API-Key: YOUR_KEY"
```

## POST /text

**Get Text Post**

### Request body (application/json)

```json
{
  "url": "string"
}
```

### Responses

- `200` Successful Response

### Example

```bash
curl -X POST "https://api.textapi.com/text" \
  -H "X-API-Key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "url": "string"
}'
```

# Extract Entities

# Ner

## GET /ner

**Analyze Ner**

### Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `text` | query | string | yes | Example: string |
| `model` | query | string | no | Example: string |

### Responses

- `200` Successful Response

### Example

```bash
curl "https://api.textapi.com/ner?text=string" \
  -H "X-API-Key: YOUR_KEY"
```

## POST /ner

**Analyze Ner Post**

### Request body (application/json)

```json
{
  "text": "string",
  "model": "string"
}
```

### Responses

- `200` Successful Response

### Example

```bash
curl -X POST "https://api.textapi.com/ner" \
  -H "X-API-Key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "text": "string",
  "model": "string"
}'
```

# Display Entities

# Ner

## GET /ner/display

**Display Ner**

### Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `text` | query | string | no | Example: string |
| `spans` | query | string | no | Example: string |
| `model` | query | string | no | Example: string |
| `format` | query | string | no | Example: string |

### Responses

- `200` Successful Response

```json
string
```

### Example

```bash
curl "https://api.textapi.com/ner/display" \
  -H "X-API-Key: YOUR_KEY"
```

## POST /ner/display

**Display Ner Post**

### Request body (application/json)

```json
{
  "text": "string",
  "spans": "string",
  "model": "string",
  "format": "string"
}
```

### Responses

- `200` Successful Response

```json
string
```

### Example

```bash
curl -X POST "https://api.textapi.com/ner/display" \
  -H "X-API-Key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "text": "string",
  "spans": "string",
  "model": "string",
  "format": "string"
}'
```

# Sentiment

# Sentiment

## GET /sentiment

**Analyze Sentiment**

### Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `text` | query | string | yes | Example: string |

### Responses

- `200` Successful Response

### Example

```bash
curl "https://api.textapi.com/sentiment?text=string" \
  -H "X-API-Key: YOUR_KEY"
```

## POST /sentiment

**Analyze Sentiment Post**

### Request body (application/json)

```json
{
  "text": "string"
}
```

### Responses

- `200` Successful Response

### Example

```bash
curl -X POST "https://api.textapi.com/sentiment" \
  -H "X-API-Key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "text": "string"
}'
```

# Question Answer

# Qa

## GET /qa

**Qa**

### Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `question` | query | string | yes | Example: string |
| `context` | query | string | yes | Example: string |

### Responses

- `200` Successful Response

### Example

```bash
curl "https://api.textapi.com/qa?question=string&context=string" \
  -H "X-API-Key: YOUR_KEY"
```

## POST /qa

**Qa Post**

### Request body (application/json)

```json
{
  "question": "string",
  "url": "string",
  "context": "string"
}
```

### Responses

- `200` Successful Response

### Example

```bash
curl -X POST "https://api.textapi.com/qa" \
  -H "X-API-Key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "question": "string",
  "url": "string",
  "context": "string"
}'
```
