> ## 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 Wit.ai: every `witai.api.*` operation with input and output types.

Every `witai.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>

## Apps

### createApp

`apps.createApp`

Create a new Wit.ai app

**Risk:** `write`

```ts theme={null}
await corsair.witai.api.apps.createApp({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string` | Yes | Name of the app |
| `lang` | `string` | Yes | Language code, e.g. "en" |
| `private` | `boolean \| string` | No | Whether the app is private |
| `timezone` | `string` | No | Timezone, e.g. "America/Los\_Angeles" |
| `desc` | `string` | No | Description of the app |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `app_id` | `string` | Yes | — |
| `access_token` | `string` | No | — |

***

### deleteApp

`apps.deleteApp`

Delete a specific Wit.ai app

**Risk:** `destructive`

```ts theme={null}
await corsair.witai.api.apps.deleteApp({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `app_id` | `string` | Yes | The Wit.ai app ID to delete |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `app_id` | `string` | No | — |
| `success` | `boolean` | No | — |

***

### exportApp

`apps.exportApp`

Export Wit.ai app data as a ZIP backup

**Risk:** `read`

```ts theme={null}
await corsair.witai.api.apps.exportApp({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `app_id` | `string` | Yes | The Wit.ai app ID to export |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `uri` | `string` | No | — |

***

### getApp

`apps.getApp`

Retrieve metadata and settings of a Wit.ai app

**Risk:** `read`

```ts theme={null}
await corsair.witai.api.apps.getApp({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `app_id` | `string` | Yes | The Wit.ai app ID |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `name` | `string` | Yes | — |
| `lang` | `string` | No | — |
| `private` | `boolean \| string` | No | — |
| `timezone` | `string` | No | — |
| `desc` | `string` | No | — |
| `will_train_at` | `string` | No | — |
| `last_trained_at` | `string` | No | — |
| `last_training_duration_secs` | `number` | No | — |
| `training_status` | `string` | No | — |
| `created_at` | `string` | No | — |
| `updated_at` | `string` | No | — |

***

### listApps

`apps.listApps`

List all Wit.ai apps for the authenticated user

**Risk:** `read`

```ts theme={null}
await corsair.witai.api.apps.listApps({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `limit` | `number` | No | Max apps to return (default 100) |
| `offset` | `number` | No | Pagination offset |

**Output:** `object[]`

<AccordionGroup>
  <Accordion title="Output full type">
    ```ts theme={null}
    {
      id: string,
      name: string,
      lang?: string,
      private?: boolean | string,
      timezone?: string,
      desc?: string,
      will_train_at?: string | null,
      last_trained_at?: string | null,
      last_training_duration_secs?: number,
      training_status?: string,
      created_at?: string,
      updated_at?: string
    }[]
    ```
  </Accordion>
</AccordionGroup>

***

### listTags

`apps.listTags`

List all tag groups (versions) for a Wit.ai app

**Risk:** `read`

```ts theme={null}
await corsair.witai.api.apps.listTags({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `app_id` | `string` | Yes | The Wit.ai app ID |

**Output:** `object[]`

<AccordionGroup>
  <Accordion title="Output full type">
    ```ts theme={null}
    {
      id: string,
      name: string,
      desc?: string | null,
      created_at?: string,
      updated_at?: string
    }[]
    ```
  </Accordion>
</AccordionGroup>

***

### updateApp

`apps.updateApp`

Update an existing Wit.ai app

**Risk:** `write`

```ts theme={null}
await corsair.witai.api.apps.updateApp({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `app_id` | `string` | Yes | The Wit.ai app ID to update |
| `name` | `string` | No | New name |
| `lang` | `string` | No | Language code |
| `private` | `boolean \| string` | No | Whether the app is private |
| `timezone` | `string` | No | Timezone |
| `desc` | `string` | No | Description |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `sent` | `boolean` | No | — |
| `n` | `number` | No | — |
| `deleted` | `string \| number` | No | — |
| `success` | `boolean` | No | — |

***

## Entities

### addKeyword

`entities.addKeyword`

Add a keyword with optional synonyms to an entity

**Risk:** `write`

```ts theme={null}
await corsair.witai.api.entities.addKeyword({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `entity` | `string` | Yes | Entity name |
| `keyword` | `string` | Yes | Keyword to add |
| `synonyms` | `string[]` | No | Optional synonyms for the keyword |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `name` | `string` | Yes | — |
| `roles` | `object[]` | No | — |
| `lookups` | `string[]` | No | — |
| `keywords` | `object[]` | No | — |

<AccordionGroup>
  <Accordion title="roles full type">
    ```ts theme={null}
    {
      id?: string,
      name: string
    }[]
    ```
  </Accordion>

  <Accordion title="keywords full type">
    ```ts theme={null}
    {
      keyword: string,
      synonyms?: string[]
    }[]
    ```
  </Accordion>
</AccordionGroup>

***

### addSynonym

`entities.addSynonym`

Add a synonym to a keyword in an entity

**Risk:** `write`

```ts theme={null}
await corsair.witai.api.entities.addSynonym({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `entity` | `string` | Yes | Entity name |
| `keyword` | `string` | Yes | Keyword to add synonym to |
| `synonym` | `string` | Yes | Synonym to add |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `name` | `string` | Yes | — |
| `roles` | `object[]` | No | — |
| `lookups` | `string[]` | No | — |
| `keywords` | `object[]` | No | — |

<AccordionGroup>
  <Accordion title="roles full type">
    ```ts theme={null}
    {
      id?: string,
      name: string
    }[]
    ```
  </Accordion>

  <Accordion title="keywords full type">
    ```ts theme={null}
    {
      keyword: string,
      synonyms?: string[]
    }[]
    ```
  </Accordion>
</AccordionGroup>

***

### createEntity

`entities.createEntity`

Create a new entity in Wit.ai

**Risk:** `write`

```ts theme={null}
await corsair.witai.api.entities.createEntity({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string` | Yes | Name of the new entity |
| `roles` | `string[]` | No | Optional role names for the entity |
| `lookups` | `string[]` | No | Optional lookup strategies (e.g. keywords, free-text) |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `name` | `string` | Yes | — |
| `roles` | `object[]` | No | — |
| `lookups` | `string[]` | No | — |
| `keywords` | `object[]` | No | — |

<AccordionGroup>
  <Accordion title="roles full type">
    ```ts theme={null}
    {
      id?: string,
      name: string
    }[]
    ```
  </Accordion>

  <Accordion title="keywords full type">
    ```ts theme={null}
    {
      keyword: string,
      synonyms?: string[]
    }[]
    ```
  </Accordion>
</AccordionGroup>

***

### deleteEntity

`entities.deleteEntity`

Permanently delete an entity by name

**Risk:** `destructive`

```ts theme={null}
await corsair.witai.api.entities.deleteEntity({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `entity` | `string` | Yes | Entity name to delete |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `sent` | `boolean` | No | — |
| `n` | `number` | No | — |
| `deleted` | `string \| number` | No | — |
| `success` | `boolean` | No | — |

***

### deleteKeyword

`entities.deleteKeyword`

Delete a keyword from an entity

**Risk:** `destructive`

```ts theme={null}
await corsair.witai.api.entities.deleteKeyword({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `entity` | `string` | Yes | Entity name |
| `keyword` | `string` | Yes | Keyword to delete |

**Output:** `object`

<AccordionGroup>
  <Accordion title="Output full type">
    ```ts theme={null}
    {
      sent?: boolean,
      n?: number,
      deleted?: string | number,
      success?: boolean
    } | {
      id: string,
      name: string,
      roles?: {
        id?: string,
        name: string
      }[],
      lookups?: string[],
      keywords?: {
        keyword: string,
        synonyms?: string[]
      }[]
    }
    ```
  </Accordion>
</AccordionGroup>

***

### deleteRole

`entities.deleteRole`

Delete a specific role from an entity

**Risk:** `destructive`

```ts theme={null}
await corsair.witai.api.entities.deleteRole({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `entity` | `string` | Yes | Entity name |
| `role` | `string` | Yes | Role name to delete |

**Output:** `object`

<AccordionGroup>
  <Accordion title="Output full type">
    ```ts theme={null}
    {
      sent?: boolean,
      n?: number,
      deleted?: string | number,
      success?: boolean
    } | {
      id: string,
      name: string,
      roles?: {
        id?: string,
        name: string
      }[],
      lookups?: string[],
      keywords?: {
        keyword: string,
        synonyms?: string[]
      }[]
    }
    ```
  </Accordion>
</AccordionGroup>

***

### deleteSynonym

`entities.deleteSynonym`

Delete a synonym from a keyword in an entity

**Risk:** `destructive`

```ts theme={null}
await corsair.witai.api.entities.deleteSynonym({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `entity` | `string` | Yes | Entity name |
| `keyword` | `string` | Yes | Keyword name |
| `synonym` | `string` | Yes | Synonym to delete |

**Output:** `object`

<AccordionGroup>
  <Accordion title="Output full type">
    ```ts theme={null}
    {
      sent?: boolean,
      n?: number,
      deleted?: string | number,
      success?: boolean
    } | {
      id: string,
      name: string,
      roles?: {
        id?: string,
        name: string
      }[],
      lookups?: string[],
      keywords?: {
        keyword: string,
        synonyms?: string[]
      }[]
    }
    ```
  </Accordion>
</AccordionGroup>

***

### getEntity

`entities.getEntity`

Retrieve details of a specific entity

**Risk:** `read`

```ts theme={null}
await corsair.witai.api.entities.getEntity({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `entity` | `string` | Yes | Entity name or ID |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `name` | `string` | Yes | — |
| `roles` | `object[]` | No | — |
| `lookups` | `string[]` | No | — |
| `keywords` | `object[]` | No | — |

<AccordionGroup>
  <Accordion title="roles full type">
    ```ts theme={null}
    {
      id?: string,
      name: string
    }[]
    ```
  </Accordion>

  <Accordion title="keywords full type">
    ```ts theme={null}
    {
      keyword: string,
      synonyms?: string[]
    }[]
    ```
  </Accordion>
</AccordionGroup>

***

### listEntities

`entities.listEntities`

List all entities in the Wit.ai app

**Risk:** `read`

```ts theme={null}
await corsair.witai.api.entities.listEntities({});
```

**Input:** *empty object*

**Output:** `object[]`

<AccordionGroup>
  <Accordion title="Output full type">
    ```ts theme={null}
    {
      id: string,
      name: string,
      roles?: {
        id?: string,
        name: string
      }[],
      lookups?: string[],
      keywords?: {
        keyword: string,
        synonyms?: string[]
      }[]
    }[]
    ```
  </Accordion>
</AccordionGroup>

***

## Intents

### createIntent

`intents.createIntent`

Create a new intent in Wit.ai

**Risk:** `write`

```ts theme={null}
await corsair.witai.api.intents.createIntent({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string` | Yes | Name of the new intent |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `name` | `string` | Yes | — |
| `entities` | `object[]` | No | — |

<AccordionGroup>
  <Accordion title="entities full type">
    ```ts theme={null}
    {
      id?: string,
      name?: string,
      role?: string,
      start?: number,
      end?: number,
      body?: string,
      confidence?: number,
      entities?: any[],
      value?: any,
      type?: string
    }[]
    ```
  </Accordion>
</AccordionGroup>

***

### deleteIntent

`intents.deleteIntent`

Permanently delete an intent by name

**Risk:** `destructive`

```ts theme={null}
await corsair.witai.api.intents.deleteIntent({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `intent` | `string` | Yes | Intent name to delete |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `sent` | `boolean` | No | — |
| `n` | `number` | No | — |
| `deleted` | `string \| number` | No | — |
| `success` | `boolean` | No | — |

***

### getIntent

`intents.getIntent`

Retrieve details of a specific intent

**Risk:** `read`

```ts theme={null}
await corsair.witai.api.intents.getIntent({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `intent` | `string` | Yes | Intent name or ID |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `name` | `string` | Yes | — |
| `entities` | `object[]` | No | — |

<AccordionGroup>
  <Accordion title="entities full type">
    ```ts theme={null}
    {
      id?: string,
      name?: string,
      role?: string,
      start?: number,
      end?: number,
      body?: string,
      confidence?: number,
      entities?: any[],
      value?: any,
      type?: string
    }[]
    ```
  </Accordion>
</AccordionGroup>

***

### listIntents

`intents.listIntents`

List all intents in the Wit.ai app

**Risk:** `read`

```ts theme={null}
await corsair.witai.api.intents.listIntents({});
```

**Input:** *empty object*

**Output:** `object[]`

<AccordionGroup>
  <Accordion title="Output full type">
    ```ts theme={null}
    {
      id: string,
      name: string,
      entities?: {
        id?: string,
        name?: string,
        role?: string,
        start?: number,
        end?: number,
        body?: string,
        confidence?: number,
        entities?: any[],
        value?: any,
        type?: string
      }[]
    }[]
    ```
  </Accordion>
</AccordionGroup>

***

## Message

### detectLanguage

`message.detectLanguage`

Detect the language of a given text input

**Risk:** `read`

```ts theme={null}
await corsair.witai.api.message.detectLanguage({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `q` | `string` | Yes | Text whose language should be detected |
| `n` | `number` | No | Number of locales to return |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `detected_locales` | `object[]` | Yes | — |

<AccordionGroup>
  <Accordion title="detected_locales full type">
    ```ts theme={null}
    {
      locale: string,
      confidence?: number
    }[]
    ```
  </Accordion>
</AccordionGroup>

***

### getMessage

`message.getMessage`

Analyze text to extract intents, entities, and traits

**Risk:** `read`

```ts theme={null}
await corsair.witai.api.message.getMessage({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `q` | `string` | Yes | Text to analyze for intents, entities, and traits |
| `n` | `number` | No | Max number of n-best intents/traits to return |
| `tag` | `string` | No | App version tag to use |
| `context` | `string` | No | JSON context object (location, reference\_time, etc.) |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `text` | `string` | Yes | — |
| `intents` | `object[]` | No | — |
| `entities` | `object` | No | — |
| `traits` | `object` | No | — |

<AccordionGroup>
  <Accordion title="intents full type">
    ```ts theme={null}
    {
      id?: string,
      name: string,
      confidence?: number
    }[]
    ```
  </Accordion>

  <Accordion title="entities full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>

  <Accordion title="traits full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

***

## Traits

### addValue

`traits.addValue`

Add a new value to an existing trait

**Risk:** `write`

```ts theme={null}
await corsair.witai.api.traits.addValue({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `trait` | `string` | Yes | Trait name |
| `value` | `string` | Yes | Value to add |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `name` | `string` | Yes | — |
| `values` | `object[]` | No | — |

<AccordionGroup>
  <Accordion title="values full type">
    ```ts theme={null}
    {
      id?: string,
      value: string
    }[]
    ```
  </Accordion>
</AccordionGroup>

***

### createTrait

`traits.createTrait`

Create a new trait in Wit.ai

**Risk:** `write`

```ts theme={null}
await corsair.witai.api.traits.createTrait({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string` | Yes | Name of the new trait |
| `values` | `string[]` | No | Initial values for the trait |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `name` | `string` | Yes | — |
| `values` | `object[]` | No | — |

<AccordionGroup>
  <Accordion title="values full type">
    ```ts theme={null}
    {
      id?: string,
      value: string
    }[]
    ```
  </Accordion>
</AccordionGroup>

***

### deleteTrait

`traits.deleteTrait`

Delete a trait by name

**Risk:** `destructive`

```ts theme={null}
await corsair.witai.api.traits.deleteTrait({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `trait` | `string` | Yes | Trait name to delete |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `sent` | `boolean` | No | — |
| `n` | `number` | No | — |
| `deleted` | `string \| number` | No | — |
| `success` | `boolean` | No | — |

***

### getTrait

`traits.getTrait`

Retrieve details of a specific trait

**Risk:** `read`

```ts theme={null}
await corsair.witai.api.traits.getTrait({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `trait` | `string` | Yes | Trait name or ID |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `name` | `string` | Yes | — |
| `values` | `object[]` | No | — |

<AccordionGroup>
  <Accordion title="values full type">
    ```ts theme={null}
    {
      id?: string,
      value: string
    }[]
    ```
  </Accordion>
</AccordionGroup>

***

### listTraits

`traits.listTraits`

List all traits in the Wit.ai app

**Risk:** `read`

```ts theme={null}
await corsair.witai.api.traits.listTraits({});
```

**Input:** *empty object*

**Output:** `object[]`

<AccordionGroup>
  <Accordion title="Output full type">
    ```ts theme={null}
    {
      id: string,
      name: string,
      values?: {
        id?: string,
        value: string
      }[]
    }[]
    ```
  </Accordion>
</AccordionGroup>

***

## Utterances

### createUtterances

`utterances.createUtterances`

Add training utterances to the Wit.ai app (rate limit: 200/min)

**Risk:** `write`

```ts theme={null}
await corsair.witai.api.utterances.createUtterances({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `utterances` | `object[]` | Yes | Utterances to add (rate limit: 200 samples/min) |

<AccordionGroup>
  <Accordion title="utterances full type">
    ```ts theme={null}
    {
      text: string,
      intent?: string,
      entities?: {
        entity: string,
        start: number,
        end: number,
        body: string,
        entities?: any[]
      }[],
      traits?: {
        trait: string,
        value: string
      }[]
    }[]
    ```
  </Accordion>
</AccordionGroup>

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `sent` | `boolean` | No | — |
| `n` | `number` | No | — |
| `deleted` | `string \| number` | No | — |
| `success` | `boolean` | No | — |

***

### deleteUtterances

`utterances.deleteUtterances`

Delete validated utterances from the Wit.ai app

**Risk:** `destructive`

```ts theme={null}
await corsair.witai.api.utterances.deleteUtterances({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `texts` | `string[]` | Yes | Utterance texts to delete |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `sent` | `boolean` | No | — |
| `n` | `number` | No | — |
| `deleted` | `string \| number` | No | — |
| `success` | `boolean` | No | — |

***

### listUtterances

`utterances.listUtterances`

List training utterances from the Wit.ai app

**Risk:** `read`

```ts theme={null}
await corsair.witai.api.utterances.listUtterances({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `limit` | `number` | No | Max utterances to return |
| `offset` | `number` | No | Pagination offset |
| `intent_id` | `string` | No | Filter by intent ID |

**Output:** `object[]`

<AccordionGroup>
  <Accordion title="Output full type">
    ```ts theme={null}
    {
      id?: string,
      text: string,
      intent?: {
        id?: string,
        name: string
      } | null,
      entities?: {
        id?: string,
        name?: string,
        role?: string,
        start?: number,
        end?: number,
        body?: string,
        confidence?: number,
        entities?: any[],
        value?: any,
        type?: string
      }[],
      traits?: {
        id?: string,
        value: string,
        confidence?: number
      }[]
    }[]
    ```
  </Accordion>
</AccordionGroup>

***

## Voices

### getVoice

`voices.getVoice`

Retrieve details for a specific text-to-speech voice

**Risk:** `read`

```ts theme={null}
await corsair.witai.api.voices.getVoice({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `voice` | `string` | Yes | Voice name to retrieve details for |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string` | Yes | — |
| `locale` | `string` | No | — |
| `gender` | `string` | No | — |
| `styles` | `object[]` | No | — |
| `supported_features` | `string[]` | No | — |

<AccordionGroup>
  <Accordion title="styles full type">
    ```ts theme={null}
    {
      name: string,
      speed?: string[],
      pitch?: string[]
    }[]
    ```
  </Accordion>
</AccordionGroup>

***

### listVoices

`voices.listVoices`

List all available text-to-speech voices grouped by locale

**Risk:** `read`

```ts theme={null}
await corsair.witai.api.voices.listVoices({});
```

**Input:** *empty object*

**Output:** `object`

<AccordionGroup>
  <Accordion title="Output full type">
    ```ts theme={null}
    {
    }
    ```
  </Accordion>
</AccordionGroup>

***


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