AskAds

Developers

Sign-in and scopes

Three ways in, one set of rules. A key always acts as one person in one team, with that person's role and limits, read fresh on every request.

Which one to use

You are buildingUseLooks like
A script, a server, your own agentAn API key from the dashboardask_key_ and 64 hex characters
Something on your own computer with the CLICLI login (askads login)ask_cli_ and 64 hex characters
An app other people connect to their team (like Zapier)OAuth 2.1 with PKCEads_at_... access token with a refresh token

All three go in the same header:

Authorization: Bearer ask_key_...

The API never accepts the website's sign-in cookie, and the website's own pages never accept a key. Keys go in the header only, never in a URL.

API keys

Make them in the dashboard under Developers, then API keys.

  • A key belongs to you, in one team. It can do at most what you can do there. If your role changes, or someone limits you to some businesses, the key follows on its very next request.
  • Pick a name, the scopes, an optional business limit (only the businesses you can see) and an expiry: never, 30, 90 or 365 days.
  • The key is shown once. AskAds keeps only a hash of it. The dashboard shows a hint (the start and the last 4 characters) so you can tell keys apart.
  • At most 20 live keys per person per team.
  • You see and revoke your own keys. Owners and admins see and revoke everyone's in the team.
  • When someone leaves the team, their keys stop working at once and the webhook endpoints they made are switched off.

A Viewer's key can only read, whatever is ticked.

CLI login (browser, device code)

askads login uses the OAuth device flow (RFC 8628):

  1. The CLI asks POST https://askads.app/oauth/device/code for a code and prints a short code like WDJB-MJHT.
  2. Your browser opens https://askads.app/app/device. Sign in and type the code your terminal shows (the page never fills it in from a link). The page always calls the tool "the AskAds command line tool"; a name the tool gave itself is only shown as a small line, because whoever starts a login can type anything there. Pick the team and the scopes, tick "I just ran askads login on my own computer", and press Allow. It can never approve spending.
  3. The CLI polls POST https://askads.app/oauth/token with grant_type=urn:ietf:params:oauth:grant-type:device_code and receives an ask_cli_ key. The usual answers apply while it waits: authorization_pending, slow_down, access_denied, expired_token.

A code lasts 10 minutes. A CLI login expires after 90 days and shows in the dashboard next to your other keys, where you can revoke it.

If someone sends you a code and asks you to approve it, do not. A real CLI login only happens on your own computer, right after you typed the command.

OAuth for apps

For an app that many teams connect (Zapier is one), use the authorization code flow with PKCE (S256) on AskAds's OAuth server:

WhatAddress or value
Metadatahttps://askads.app/.well-known/oauth-authorization-server
Authorizehttps://askads.app/oauth/authorize
Token and refreshhttps://askads.app/oauth/token
Resourcehttps://askads.app/api/v1 (send it as resource)
Resource metadatahttps://askads.app/.well-known/oauth-protected-resource/api/v1
Scopesread drafts pause requests webhooks, space separated. Default read.

A token is issued for one resource. A token for https://askads.app/api/v1 does not work on the MCP server at https://askads.app/mcp, and a token for the MCP server does not work on the API. The consent page lists the scopes in plain words and says the app can never approve spending. The person sees the connection in the dashboard and can disconnect it there.

Register a client with dynamic client registration (RFC 7591) at https://askads.app/oauth/register, the same way MCP clients do. For a listed app that needs a fixed client id and secret, write to [email protected] with the app's name and its redirect address.

Scopes

What a key may do is always: the person's role, AND the key's scopes, AND the person's business limits, AND the key's own business limit.

ScopeName in the dashboardLets the key
readReadSee what its member can see: ad accounts, reports, campaigns, drafts, approvals, activity, brand kits, competitor ads.
draftsBuild paused draftsBuild paused draft campaigns, add paused ads, make and edit images, edit things that are not live, keywords, brand kit, saved competitors.
pausePause and lower budgetsPause, lower a budget, switch on "stop all changes". Only ever reduces spend.
requestsAsk for approvalAsk for a launch, a budget raise or a change to something live, and cancel a request. A person approves.
webhooksManage webhooksCreate, change and remove webhook endpoints.

There is no approve scope. There never will be one. Why.

GET /me and GET /event-types work with any scope. Editing something that is live, or changing a keyword on a live ad group, needs requests as well as drafts, because it becomes an approval request.

Business limits

An agency team often has many businesses (clients). A key can be limited to some of them. Then:

  • Lists only show ad accounts, drafts, approvals and activity of those businesses.
  • Anything of another business answers 404, as if it did not exist.
  • The key cannot create a new business or touch another business's brand kit.
  • Team-wide events (for example someone joining the team) are not sent to its webhooks.

When a key stops working

AnswerCodeWhat to do
401missing_keySend the Authorization: Bearer header.
401invalid_keyCheck you copied the whole key.
401key_expiredMake a new key.
401key_revokedIt was revoked, or its person left the team. Make a new one.
403missing_scopeMake a key with the scope the message names.

A 401 carries WWW-Authenticate: Bearer resource_metadata="https://askads.app/.well-known/oauth-protected-resource/api/v1", so OAuth clients can find the sign-in by themselves.

This page as Markdown, for AI agents: /developers/authentication.md