# Text Filter API Complete API reference for the `content-filter-text-standard` text content detection model. ## Overview Content Filter Text checks a text input for supported content safety categories and returns a synchronous detection result. The current detection type is `nsfw`. ## Endpoint ```http POST /api/v1/content/filter ``` ## Authentication ```http Authorization: Bearer YOUR_API_KEY ``` ## Request Parameters ### Required | Parameter | Type | Description | | ------------ | ------ | ----------------------------------------------------- | | `model_name` | string | Must be `"content-filter-text-standard"` | | `type` | string | Detection type. Currently only `"nsfw"` is supported. | | `text` | string | Text content to check. | ### Not Supported | Parameter | Description | | --------- | -------------------------------------------------------- | | `images` | Use `content-filter-image-standard` for image detection. | ## Example Request ```javascript const response = await fetch('https://api.flaq.ai/api/v1/content/filter', { method: 'POST', headers: { Authorization: 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json', }, body: JSON.stringify({ model_name: 'content-filter-text-standard', type: 'nsfw', text: 'Sample text to check', }), }); const result = await response.json(); console.log(result.data); ``` ## Response Format ```json { "code": 0, "message": "success", "data": { "type": "nsfw", "flagged": false, "credits": 200, "detail": { "text": { "checked": true, "flagged": false, "score": 0, "level": "none" }, "images": [] } } } ``` ## Response Data | Field | Type | Description | | -------------------- | ------- | ---------------------------------------------------------------------- | | `data.type` | string | Detection type used for the request. | | `data.flagged` | boolean | Whether the checked text was flagged for the requested detection type. | | `data.credits` | number | Credits charged for the request. | | `data.detail.text` | object | Detection result for the submitted text. | | `data.detail.images` | array | Always empty for text detection. | ## Detection Result | Field | Type | Description | | --------- | ------- | -------------------------------------------------------------- | | `checked` | boolean | Whether the item was successfully checked. | | `flagged` | boolean | Whether the checked item matched the requested detection type. | | `level` | string | Risk level: `"none"`, `"low"`, `"medium"`, or `"high"`. | | `score` | number | Detection score. Use `level` for display. | ### Result Notes - If `checked` is `false`, the item was not successfully checked. In that case, `score` may be `0` and `level` may be `"none"`, but the item should be treated as a detection failure rather than a no-risk result. - `flagged` only describes the detection result after an item has been checked. - `level` is the display-friendly risk level derived from the detection score. ## Error Handling If the request fails, the API returns a non-zero `code` or a non-2xx HTTP status. Check the `message` field for details.