> For the complete documentation index, see [llms.txt](https://docs.convai.com/api-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.convai.com/api-docs/plugins-and-integrations/convai-unity-sdk/getting-started/configure-api-key.md).

# Configure the API key

The Convai SDK for Unity authenticates every session using an API key tied to your Convai account. You enter this key once in the Unity Editor — it is stored in your project and used automatically at runtime.

{% stepper %}
{% step %}

#### Copy your API key

Log in to your Convai dashboard at [convai.com](https://convai.com), navigate to **Account Settings**, and copy your API key.
{% endstep %}

{% step %}

#### Open the Convai configuration window

In the Unity Editor menu bar, open **Convai > Account**.

The Convai Configuration window opens to the Account section.
{% endstep %}

{% step %}

#### Paste the API key

Paste your API key into the **API Key** field.

The key is saved immediately to `Assets/Resources/ConvaiSettings.asset`. No additional save step is required.
{% endstep %}

{% step %}

#### Verify the key is accepted

Run **GameObject > Convai > Validate Scene Setup**. A missing API key appears as a warning in the validator dialog. If no API key warning appears, your key is configured correctly.

<figure><img src="/files/tmR9lRU8eP5KPPzQZFQx" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

{% hint style="warning" %}
`Assets/Resources/ConvaiSettings.asset` stores the API key in plain text. If your project uses source control, decide whether to commit this file based on your team's security policy.
{% endhint %}

### How the key is used at runtime

The SDK reads the key from `ConvaiSettings` via the `ICredentialProvider` interface before initiating any connection to Convai. You do not need to pass the key manually in code — the SDK resolves it automatically on startup.

For production deployments where storing the key in source control is not acceptable, implement a custom `ICredentialProvider` that reads the key from a secure source.

{% content-ref url="/pages/31f40f584b5fb6b136f239a3d28d2ec74eb938e7" %}
[Custom credential provider](/api-docs/plugins-and-integrations/convai-unity-sdk/advanced-topics/custom-providers/custom-credential-provider.md)
{% endcontent-ref %}

### Next steps

With your API key in place, import a sample scene to verify the SDK is working before you build your own scene.

{% content-ref url="/pages/41c4fa4e32b4314bedf2eeac4548c536e758ce3f" %}
[Import and run sample scenes](/api-docs/plugins-and-integrations/convai-unity-sdk/getting-started/import-and-run-sample-scenes.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.convai.com/api-docs/plugins-and-integrations/convai-unity-sdk/getting-started/configure-api-key.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
