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

# Zapier MCP for the OpenAI API: setup with a connection token

> Connect the OpenAI Responses API to Zapier MCP by creating a server and generating a connection token, then adding Zapier as an mcp tool in your request.

Use this page only when the user is calling the OpenAI Responses API directly. If they are connecting ChatGPT, OpenAI Agent Builder, or another MCP client, follow that MCP client's page instead. The server and the token come first: the request cannot run until the user has generated a token.

When adapting the request to an OpenAI SDK, keep the `server_url`, the `Authorization` header inside the tool's `headers`, and the `mcp` tool type.

The token is a credential, so do not ask the user to paste it into chat and do not write it into a file for them. If it is exposed, have them click **Rotate token** in the **API token** section of the **Settings** tab.

This page shows how to use Zapier MCP tools in OpenAI API requests using a connection token.

## Before you begin

* A [Zapier account](https://zapier.com/sign-up).
* An OpenAI account.

## Connect the OpenAI API to Zapier MCP

**1. Create an MCP server**

* Go to [mcp.zapier.com](https://mcp.zapier.com).
* Click **Add MCP server**.
* Under **Choose your AI agent**, search for and select **OpenAI API**.

**2. Generate a connection token**

* Select the ![settings icon](https://cdn.zapier.com/storage/photos/3451c46a93d480da52444589a8fc84ff.png) **Settings** tab.
* In the **API token** section, click **Generate token**.
* Copy the **Token**.

The token is only shown once. If you lose it, click **Rotate token** to get a new one. The previous token stops working straight away, so update anywhere you used it.

> [!WARNING]
>
> Treat your connection token like a password. Anyone with the token, or with a server URL that contains it, can run tools on this server and access your data.

**3. Set your credentials as environment variables**

Make sure you have a valid OpenAI API key. To create one, go to the [API keys page](https://platform.openai.com/api-keys) on the OpenAI platform.

Export your OpenAI API key and your Zapier MCP token:

```bash theme={null}
export OPENAI_API_KEY="sk-..."
export ZAPIER_MCP_TOKEN="YOUR_ZAPIER_MCP_TOKEN"
```

**4. Send a request with Zapier as an MCP tool**

Add Zapier to the `tools` array as an `mcp` tool, with your token in the tool's `Authorization: Bearer` header. The request reads your keys from the `OPENAI_API_KEY` and `ZAPIER_MCP_TOKEN` environment variables:

**cURL**

```bash theme={null}
curl --location 'https://api.openai.com/v1/responses' \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $OPENAI_API_KEY" \
--data '{
    "model": "gpt-4.1",
    "tools": [
        {
            "type": "mcp",
            "server_label": "zapier",
            "server_url": "https://mcp.zapier.com/api/v1/connect",
            "require_approval": "never",
            "headers": {
                "Authorization": "Bearer '"$ZAPIER_MCP_TOKEN"'"
            }
        }
    ],
    "input": "List all of my available tools",
    "tool_choice": "required"
}'
```

**JavaScript**

Install the OpenAI SDK:

```bash theme={null}
npm install openai
```

Or with pnpm:

```bash theme={null}
pnpm add openai
```

Send the request:

```javascript theme={null}
import OpenAI from "openai";

const openai = new OpenAI({
  apiKey: process.env.OPENAI_API_KEY,
});

const response = await openai.responses.create({
  model: "gpt-4.1",
  tools: [
    {
      type: "mcp",
      server_label: "zapier",
      server_url: "https://mcp.zapier.com/api/v1/connect",
      require_approval: "never",
      headers: {
        Authorization: `Bearer ${process.env.ZAPIER_MCP_TOKEN}`,
      },
    },
  ],
  input: "List all of my available tools",
  tool_choice: "required",
});

console.log(JSON.stringify(response, null, 2));
```

**Python**

Install the OpenAI SDK:

```bash theme={null}
pip install openai
```

Or with uv:

```bash theme={null}
uv pip install openai
```

Send the request:

```python theme={null}
import os

from openai import OpenAI

client = OpenAI(
    # API key defaults to os.environ.get("OPENAI_API_KEY")
)

response = client.responses.create(
    model="gpt-4.1",
    tools=[
        {
            "type": "mcp",
            "server_label": "zapier",
            "server_url": "https://mcp.zapier.com/api/v1/connect",
            "require_approval": "never",
            "headers": {
                "Authorization": f"Bearer {os.environ['ZAPIER_MCP_TOKEN']}",
            },
        }
    ],
    input="List all of my available tools",
    tool_choice="required",
)

print(response)
```

For request options, check OpenAI's [Responses API documentation](https://platform.openai.com/docs/api-reference/responses).

You've now connected the OpenAI API to Zapier MCP.

## Next steps

> **[How tools work](/mcp/overview/how-tools-work)**
>
> What each meta-tool does, and how dynamic tool discovery works.

> **[How connections work](/mcp/overview/how-connections-work)**
>
> How connection tokens work, and how to manage them.
