> ## Documentation Index
> Fetch the complete documentation index at: https://help.verbosec.com/llms.txt
> Use this file to discover all available pages before exploring further.

# POST /text/generate — AI Text Generation API

> Generate AI text content via the Verbosec API. Pass a prompt and optional parameters to receive generated text, suitable for articles, summaries, and more.

The Nexus Text Generation endpoint lets you produce high-quality written content programmatically. You send a prompt along with optional parameters to control the output length, language, tone, and generation mode. Nexus AI returns the generated text alongside token usage information so you can monitor consumption against your plan.

**Endpoint**

```
POST https://api.verbosec.com/v1/text/generate
```

## Request parameters

<ParamField body="prompt" type="string" required>
  The input prompt that guides text generation. Be as specific as possible — a detailed prompt produces more accurate and useful output.
</ParamField>

<ParamField body="max_tokens" type="integer">
  The maximum number of tokens to include in the generated response. Defaults to `1000`. Setting a lower value reduces cost and latency; setting a higher value allows for longer outputs.
</ParamField>

<ParamField body="language" type="string">
  The BCP-47 language code for the output language — for example, `"en"`, `"fr"`, or `"es"`. Defaults to `"en"`.
</ParamField>

<ParamField body="tone" type="string">
  The writing tone applied to the output. Accepted values are `"formal"`, `"casual"`, and `"academic"`. Defaults to `"formal"`.
</ParamField>

<ParamField body="mode" type="string">
  The generation mode that controls how Nexus AI processes the prompt. Accepted values are `"write"` (generate new content), `"rewrite"` (rewrite provided content), and `"paraphrase"` (rephrase in different words). Defaults to `"write"`.
</ParamField>

## Example request

```bash generate-text.sh theme={null}
curl -X POST https://api.verbosec.com/v1/text/generate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Write a 500-word blog post about sustainable travel",
    "max_tokens": 700,
    "language": "en",
    "tone": "casual"
  }'
```

## Example response

```json response.json theme={null}
{
  "id": "gen_abc123",
  "text": "Sustainable travel is more than a trend...",
  "tokens_used": 682,
  "language": "en",
  "created_at": "2025-01-15T10:30:00Z"
}
```

## Response fields

<ResponseField name="id" type="string">
  A unique identifier for this generation request. Use this ID to reference the result in support requests or logs.
</ResponseField>

<ResponseField name="text" type="string">
  The generated text content produced by Nexus AI in response to your prompt.
</ResponseField>

<ResponseField name="tokens_used" type="integer">
  The number of tokens consumed by this request, counting both the input prompt and the generated output.
</ResponseField>

<ResponseField name="language" type="string">
  The language code of the generated output, reflecting the `language` parameter you passed in the request.
</ResponseField>

<ResponseField name="created_at" type="string">
  An ISO 8601 timestamp indicating when the generation was completed.
</ResponseField>

***

## Plagiarism check

Run a plagiarism check on any text to detect potential matches against publicly available web content. This endpoint is useful for verifying generated content or reviewing submitted material before publication.

**Endpoint**

```
POST https://api.verbosec.com/v1/plagiarism/check
```

### Request parameters

<ParamField body="text" type="string" required>
  The text content you want to check for plagiarism. Submit the full content as a plain string.
</ParamField>

### Example request

```bash check-plagiarism.sh theme={null}
curl -X POST https://api.verbosec.com/v1/plagiarism/check \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Artificial intelligence is transforming how businesses operate, enabling automation of complex tasks that previously required human judgment."
  }'
```

### Example response

```json plagiarism-response.json theme={null}
{
  "id": "plag_rst567",
  "score": 0.12,
  "verdict": "mostly_original",
  "matches": [
    {
      "url": "https://example.com/article-about-ai",
      "similarity": 0.12,
      "excerpt": "enabling automation of complex tasks that previously required human judgment"
    }
  ],
  "created_at": "2025-01-15T10:35:00Z"
}
```

### Response fields

<ResponseField name="id" type="string">
  A unique identifier for this plagiarism check request.
</ResponseField>

<ResponseField name="score" type="float">
  An overall similarity score between `0.0` (fully original) and `1.0` (identical match). Values below `0.2` are generally considered acceptable for most publishing contexts.
</ResponseField>

<ResponseField name="verdict" type="string">
  A human-readable summary of the result. Possible values are `"original"`, `"mostly_original"`, `"mixed"`, and `"plagiarised"`.
</ResponseField>

<ResponseField name="matches" type="array">
  An array of match objects describing the specific passages that were flagged.

  <Expandable title="Match object fields">
    <ResponseField name="matches[].url" type="string">
      The URL of the source where a matching passage was found.
    </ResponseField>

    <ResponseField name="matches[].similarity" type="float">
      The similarity score for this specific match, between `0.0` and `1.0`.
    </ResponseField>

    <ResponseField name="matches[].excerpt" type="string">
      The excerpt from your submitted text that matched the source.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="created_at" type="string">
  An ISO 8601 timestamp indicating when the check was completed.
</ResponseField>

***

## Error responses

<Accordion title="400 Bad Request — Missing prompt">
  Returned when the `prompt` field is absent from the request body.

  ```json 400-response.json theme={null}
  {
    "error": {
      "code": "missing_required_field",
      "message": "The 'prompt' field is required."
    }
  }
  ```
</Accordion>

<Accordion title="401 Unauthorized">
  Returned when your API key is missing or invalid. See the [Authentication guide](/api-reference/authentication) for help.

  ```json 401-response.json theme={null}
  {
    "error": {
      "code": "unauthorized",
      "message": "Invalid or missing API key."
    }
  }
  ```
</Accordion>

<Accordion title="429 Too Many Requests — Rate limited">
  Returned when you have exceeded your plan's request quota. Wait the number of seconds indicated in the `Retry-After` response header before retrying.

  ```json 429-response.json theme={null}
  {
    "error": {
      "code": "rate_limit_exceeded",
      "message": "You have exceeded your plan's rate limit. Please wait before retrying."
    }
  }
  ```
</Accordion>
