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

# OpenAI Codex

> Connect SendKit to OpenAI Codex CLI for AI-powered email management

[OpenAI Codex](https://github.com/openai/codex) is OpenAI's CLI agent for software development. You can connect it to SendKit's MCP server to manage your email infrastructure with natural language.

## Prerequisites

* Codex CLI installed (`npm install -g @openai/codex`)
* A SendKit API key with **Full** permission

## Setup

<Steps>
  <Step title="Set your API key as an environment variable">
    Add your SendKit API key to your shell profile (`~/.zshrc`, `~/.bashrc`, etc.):

    ```bash theme={null}
    export SENDKIT_API_KEY="sk_your_api_key_here"
    ```

    <Note>
      Replace `sk_your_api_key_here` with your actual API key from the [SendKit dashboard](https://app.sendkit.dev).
    </Note>
  </Step>

  <Step title="Open the configuration file">
    Edit `~/.codex/config.toml` and add the SendKit server:

    ```toml theme={null}
    [mcp_servers.sendkit]
    url = "https://mcp.sendkit.dev/sendkit"
    bearer_token_env_var = "SENDKIT_API_KEY"
    ```
  </Step>

  <Step title="Restart Codex">
    Close and reopen Codex to load the new configuration.
  </Step>

  <Step title="Verify the connection">
    Ask Codex to interact with your SendKit account:

    ```
    List all my SendKit domains
    ```
  </Step>
</Steps>

<Tip>
  Codex uses TOML for configuration (not JSON). It provides `bearer_token_env_var` to securely reference API keys from environment variables instead of hardcoding them in the config file.
</Tip>

## Example prompts

```
Send a test email from support@mydomain.com to test@example.com
```

```
Create a segment called "Active Users" filtering emails containing @company.com
```

```
Show me all contacts on the "Newsletter" list
```
