> ## 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** on the **Connect** 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

<Steps>
  <Step title="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**.
  </Step>

  <Step title="Generate a connection token">
    * Select the <img src="https://cdn.zapier.com/storage/photos/baa5b3a64988a15f0dc8497c52ec257b.png" alt="link icon" noZoom style={{ display: "inline-block", width: "14px", margin: "0 0.15em", verticalAlign: "baseline" }} /> **Connect** tab.
    * Under **MCP server information**, 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.
    </Warning>
  </Step>

  <Step title="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"
    ```
  </Step>

  <Step title="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:

    <Tabs>
      <Tab title="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"
        }'
        ```
      </Tab>

      <Tab title="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));
        ```
      </Tab>

      <Tab title="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)
        ```
      </Tab>
    </Tabs>

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

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

## Next steps

<CardGroup cols={2}>
  <Card title="How tools work" href="/mcp/overview/how-tools-work">
    What each meta-tool does, and how dynamic tool discovery works.
  </Card>

  <Card title="How connections work" href="/mcp/overview/how-connections-work">
    How connection tokens work, and how to manage them.
  </Card>
</CardGroup>
