# Test Label Prediction Beta

> Run the reply categorizer on pasted text.

> Documentation index: https://www.foxreach.io/docs/llms.txt lists every page of these docs. Each page is also served as Markdown: add `.md` to its URL.

`POST` https://api.foxreach.io/api/v1/lead-labels/test

> **Note:** **Beta.** This endpoint is new and may change.

Requires an API key with the `write` scope.

Runs the same reply categorizer that sorts incoming replies and returns what it would say about the text you send. Nothing is stored and no lead is touched.

The `category` is one of the built-in reply categories (`interested`, `not_interested`, `out_of_office`, `bounce`, `unsubscribe`, `uncategorized`). It is not one of your workspace's [lead labels](https://www.foxreach.io/docs/api-reference/lead-labels/list-lead-labels).

**Costs 1 AI credit** once the categorizer has answered. A call that fails upstream charges nothing. A workspace out of AI credits gets `403` with code `ai_credits_exhausted`. Only the first 4,000 characters of `body` are judged.

## Request Body

- `body` string body required: The reply text. 1 to 20,000 characters.
- `subject` string body: The reply subject. Up to 500 characters.
- `fromEmail` string body: The sender address. Up to 320 characters.

**Request example**

```bash cURL
curl -X POST "https://api.foxreach.io/api/v1/lead-labels/test" \
  -H "X-API-Key: otr_your_key" \
  -H "Content-Type: application/json" \
  -d '{"subject": "Re: Quick question", "body": "Sounds good, can you send pricing?"}'
```

```python Python SDK (beta)
from foxreach import FoxReach

client = FoxReach(api_key="otr_your_key")
result = client.lead_labels.test("Sounds good, can you send pricing?", subject="Re: Quick question")
```

```typescript TypeScript SDK (beta)
import { FoxReach } from "foxreach";

const client = new FoxReach({ apiKey: "otr_your_key" });
const result = await client.leadLabels.test({
  subject: "Re: Quick question",
  body: "Sounds good, can you send pricing?",
});
```

**Response example**

```json
{
  "data": {
    "category": "interested",
    "intent": "interested",
    "confidence": 0.93,
    "probabilities": {"interested": 0.93, "not_interested": 0.02},
    "unsubscribeIntent": 0.01,
    "intents": {"pricing": 0.88},
    "urgency": 0.2,
    "creditsCharged": 1
  }
}
```

## Errors

| Status | Description |
|--------|-------------|
| `401` | Missing, invalid, revoked or expired API key |
| `403` | API key does not have the required scope `write`, or the plan has no AI credits left (`ai_credits_exhausted`) |
| `422` | Missing or oversized `body`, `subject` or `fromEmail` |
| `502` / `503` | The categorizer failed or is unavailable. Nothing was charged |

## Rate Limit

- **100 requests per minute, shared by every `expensive` call in your workspace.** Fixed 60-second window.
- Every response includes `X-RateLimit-Limit`, `X-RateLimit-Remaining`, `X-RateLimit-Reset` (unix epoch seconds) and `X-RateLimit-Bucket` (`expensive`).
- A `429` response includes a `Retry-After` header (seconds until the bucket resets).

For client-side patterns, see [Rate Limiting](https://www.foxreach.io/docs/rate-limiting).
