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

# API

> API reference for Winston AI: every `winstonai.api.*` operation with input and output types.

Every `winstonai.api.*` operation is listed below with parameter shapes and return types from the plugin Zod schemas.

<Info>
  **New to Corsair?** See [API access](/concepts/api), [authentication](/concepts/auth), and [error handling](/concepts/error-handling).
</Info>

## Detect

### aiImage

`detect.aiImage`

Score whether a public image URL was created by a human or generated by AI

**Risk:** `read`

```ts theme={null}
await corsair.winstonai.api.detect.aiImage({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `url` | `string` | Yes | — |
| `version` | `string` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `score` | `number` | Yes | — |
| `human_probability` | `number` | No | — |
| `ai_probability` | `number` | No | — |
| `version` | `string` | No | — |
| `mime_type` | `string` | No | — |
| `credits_used` | `number` | No | — |
| `credits_remaining` | `number` | No | — |

***

### aiText

`detect.aiText`

Score whether text, a public file, or a website was written by a human or generated by AI

**Risk:** `read`

```ts theme={null}
await corsair.winstonai.api.detect.aiText({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `text` | `string` | No | — |
| `file` | `string` | No | — |
| `website` | `string` | No | — |
| `version` | `string` | No | — |
| `sentences` | `boolean` | No | — |
| `language` | `string` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `status` | `number` | No | — |
| `score` | `number` | Yes | — |
| `sentences` | `object[]` | No | — |
| `input` | `string` | No | — |
| `attack_detected` | `object` | No | — |
| `readability_score` | `number` | No | — |
| `credits_used` | `number` | No | — |
| `credits_remaining` | `number` | No | — |
| `version` | `string` | No | — |
| `language` | `string` | No | — |

<AccordionGroup>
  <Accordion title="sentences full type">
    ```ts theme={null}
    {
      text: string,
      score: number
    }[]
    ```
  </Accordion>

  <Accordion title="attack_detected full type">
    ```ts theme={null}
    {
      zero_width_space?: boolean,
      homoglyph_attack?: boolean
    }
    ```
  </Accordion>
</AccordionGroup>

***

### plagiarism

`detect.plagiarism`

Scan text, a public file, or a website for matching sources on the web

**Risk:** `read`

```ts theme={null}
await corsair.winstonai.api.detect.plagiarism({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `text` | `string` | No | — |
| `file` | `string` | No | — |
| `website` | `string` | No | — |
| `excluded_sources` | `string[]` | No | — |
| `language` | `string` | No | — |
| `country` | `string` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `status` | `number` | No | — |
| `scanInformation` | `object` | No | — |
| `result` | `object` | No | — |
| `sources` | `object[]` | No | — |
| `attackDetected` | `object` | No | — |
| `text` | `string` | No | — |
| `credits_used` | `number` | No | — |
| `credits_remaining` | `number` | No | — |

<AccordionGroup>
  <Accordion title="scanInformation full type">
    ```ts theme={null}
    {
      service?: string,
      scanTime?: string,
      inputType?: string,
      language?: string
    }
    ```
  </Accordion>

  <Accordion title="result full type">
    ```ts theme={null}
    {
      score?: number,
      sourceCounts?: number,
      textWordCounts?: number,
      totalPlagiarismWords?: number,
      identicalWordCounts?: number,
      similarWordCounts?: number
    }
    ```
  </Accordion>

  <Accordion title="sources full type">
    ```ts theme={null}
    {
      score?: number,
      canAccess?: boolean,
      url?: string,
      title?: string,
      plagiarismWords?: number,
      identicalWordCounts?: number,
      similarWordCounts?: number,
      totalNumberOfWords?: number,
      author?: string | null,
      description?: string | null,
      publishedDate?: number | null,
      source?: string | null,
      citation?: boolean,
      plagiarismFound?: {
        startIndex?: number,
        endIndex?: number,
        sequence?: string | null
      }[],
      is_excluded?: boolean
    }[]
    ```
  </Accordion>

  <Accordion title="attackDetected full type">
    ```ts theme={null}
    {
      zero_width_space?: boolean,
      homoglyph_attack?: boolean
    }
    ```
  </Accordion>
</AccordionGroup>

***

## Text

### compare

`text.compare`

Compare two texts and return similarity scores

**Risk:** `read`

```ts theme={null}
await corsair.winstonai.api.text.compare({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `first_text` | `string` | Yes | — |
| `second_text` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `status` | `number` | No | — |
| `similarity_score` | `number` | Yes | — |
| `first_text` | `object` | No | — |
| `second_text` | `object` | No | — |
| `credits_used` | `number` | No | — |
| `credits_remaining` | `number` | No | — |

<AccordionGroup>
  <Accordion title="first_text full type">
    ```ts theme={null}
    {
      total_word_count?: number,
      matching_word_count?: number,
      similarity_percentage?: number,
      items?: {
        type?: string,
        word_count?: number,
        index_start?: number,
        length?: number
      }[]
    }
    ```
  </Accordion>

  <Accordion title="second_text full type">
    ```ts theme={null}
    {
      total_word_count?: number,
      matching_word_count?: number,
      similarity_percentage?: number,
      items?: {
        type?: string,
        word_count?: number,
        index_start?: number,
        length?: number
      }[]
    }
    ```
  </Accordion>
</AccordionGroup>

***


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.