✿ Free guide

The API Gateway

One locked place for every key your brain uses. Google Ads, BigQuery, ClickUp, Slack, your email tool: the keys live on the gateway, never on anyone's laptop. Each person gets a token instead, and you decide what each token can do.

Paste it into your brain, then say "set up the API Gateway". Everything on this page comes with an Ads2AI brain.

How it fits together
Each person holds a token

You, Sarah, Dee and the nightly task. Never a real key.

The API Gateway

Holds every real key, checks what each token may do, and keeps a record of requests.

The services

Google Ads, BigQuery, ClickUp, Slack, Brevo, and any other service with a key.

The basics

What it is

Without the gateway, your keys live in files on laptops, and a key in a file is a password with no second factor.

The gateway is a small program on your own free Cloudflare account. It holds the real keys. Each person and each scheduled task holds only a token. The gateway checks what that token may do, adds the real key, keeps a record and passes the request on. A token can never be turned back into its key.

It's worth it solo too. Your keys come off your laptop, and cloud sessions and scheduled tasks reach your tools without the key ever entering the session.

Services

What you can put behind it

Google Ads and BigQuery are built in. Your brain helps you add any other service that takes a key.

Built in

Google Ads

Reports, keyword ideas and account changes. Changes wait for a yes by default.

You can put one client account, or a whole manager account, off limits for everyone.

Built in

BigQuery

Your brain loads your Google Ads data into four daily tables (campaigns, keywords, ads and assets) and queries them.

You can cap how much data one query may read.

You add it

Any service with a key

ClickUp, Slack, Asana, HubSpot, Brevo, fal.ai and others. Your brain shows you which key to use and where it goes, then tests it.

Use a bot or service-user key, never a person's own login.

Doesn't fit

Services with no key

Some services, like Google Drive, only allow a browser sign-in. Each person connects those with the service's own connector.

You don't need Google Ads to use it. A gateway can start with just ClickUp or just Slack.

Access

Who can do what

Each person has a role: Owner, Scout, Team or No role. You set a role once and everyone with it follows it. One person can differ on any row, and the settings page shows which.

Google Ads and any service you add have four levels:

Off

The gateway refuses the request. The service never sees it.

Read

Reports and lookups. Any change is refused.

Ask first

Changes, one yes at a time. Before each change, the person's own Claude shows them exactly what will change and waits for their yes.

Change

Changes go through with no question asked. Give it only to someone you'd trust to change a client's account with nobody checking.

Google Ads can be set for everything, a manager account or one account. BigQuery uses Off, Read and Write, on a project, a dataset or one table. A person can also get an end date for their token.

With no settings saved, a token reaches every account and service on the gateway. No role covers anyone not yet on the settings page, so set it to Read or Off before you hand out tokens.

Ask first stops accidents. It isn't a lock.

The gateway trusts the yes the person gives their own Claude, so only give change access to people you trust with the accounts.

Setup

Setting it up

You don't run any commands. Open your brain and say:

Say to your brain
Set up the API Gateway

Your brain:

  1. Checks you have a free Cloudflare account and a token that can put the gateway live, or opens the right Cloudflare page and helps you make one.

  2. Puts the gateway live and gives you its address.

  3. Stores your keys on the gateway as encrypted secrets: Google Ads if you use it, other services one at a time.

  4. Tests it end to end.

  5. Gives you the owner key and helps you make a token for each person.

The free Cloudflare plan covers it, record of requests included.

One shared key, or a token per person

The owner key can do everything. The settings can't limit it, and the record can't tell its users apart. That's fine when it's just you. On a team, give each person their own token, or one person leaving means a new key for everyone.

Your team

For a team member: connecting

Your owner or scout sends you a token privately. Keep it like a password, then connect in one of three ways:

  • Agency Brain's Command Centre (the easiest). The team's gateway address is already set. Paste your token and click connect.

  • A small file. Your brain makes a two-line gads-proxy.yaml in your brain's main folder: the gateway's address (url:) and your token (secret:). The token goes in the file, never in the chat.

  • Two environment settings, for scripts and scheduled tasks: GADS_PROXY_URL and GADS_PROXY_SECRET.

If the gateway says no ("switched off for you", or "you can read this but not change it"), your admin chose that. Your brain shows the message and stops.

From claude.ai/code or a cloud scheduled task

A cloud session has no .env or gads-proxy.yaml, and the token should never go into the session or the repo. Put it on the cloud environment as a network secret: Edit cloud environment, Network secrets, Add secret. Set the allowed website to the gateway's address, the custom header to x-proxy-secret with the prefix cleared, and the value to your token.

Then set GADS_PROXY_URL to the gateway's address and GADS_PROXY_SECRET=network. Anthropic adds the token after the request leaves the session.

Keys and tokens

When someone leaves, or a key leaks

The real keys only live on the gateway, so usually you switch off one token and nothing else changes. Tell your brain what happened.

A person with their own token leaves, or loses a laptop

Their token is switched off. Nobody else changes anything.

A person's token leaks

They get a new token, and the old one stops working.

The owner key leaks, or someone who used it leaves

You get a new owner key. Only the people who used the owner key need the new one.

A service's own key leaks

A new key from that service goes onto the gateway. Nobody's token changes.

After a leak, your brain first reads the record to show what the leaked token did, then tests each new key through the gateway before the old one is cancelled.

Say to your brain
Someone left the team
Records

The record of requests

The gateway keeps one line per request: when, who, what kind, which account or service, whether it went through (and why not), and the country and internet address. A leaked token shows up as requests from somewhere odd.

It never keeps a token, a key, report results, or what a change changed. Lines are kept for 90 days.

Owners and scouts can read it at first, and you choose who else can. Your brain builds a page with a summary for each person:

Say to your brain
Who used the gateway this week?
Rules

Three rules to know

  • Keep tokens inside your team.

    The gateway checks that a token is valid, not who has it.

  • Google's terms say no outside access.

    A client or another agency can't get indirect access to your Google Ads API access. They need their own Google Cloud project and gateway.

  • One person manages per-person tokens.

    The list lives on their computer and can't be read back from the gateway, so a second person adding tokens elsewhere would knock everyone else offline. The tool stops that happening by accident.

Prompts

What to say to your brain

Plain words work, like these:

  • "Set up the API Gateway": Puts it live and stores your keys.
  • "Add ClickUp to the API Gateway": Adds any service that takes a key.
  • "Open the API Gateway settings": Roles, people and levels on one page.
  • "Give Sam read-only on Google Ads": Changes one person's level.
  • "Put the Acme account off limits": Blocks an account or manager account for everyone.
  • "Who used the gateway this week?": Builds the record of requests page.
  • "Someone left the team": Switches off their token and checks the record.
  • "Load Google Ads into BigQuery": Sets up the four daily tables.
What's underneath

The skill is gads-proxy (once called the proxy and the vault), and it ships in every member brain and Agency Brain. The gateway is a Cloudflare Worker.

When a brain update brings a newer gateway, say "redeploy the API Gateway". Your keys and everyone's tokens stay as they are.

The API Gateway skill comes with an Ads2AI brain.

Already a member? The same page is in your portal at m.ads2ai.com/api-gateway.