Skip to content
Tracking and technical

What is an API key?

3 min read · Updated · By the Reveata team

Short answerAn API key is a long secret string that a program sends with each request to an API, usually in the Authorization header, so the service knows which account is calling and what that caller is allowed to do.

A pair of scissors hanging on a wooden wall
Photo by Eric Prouzet on Unsplash

Websites know who you are because you sign in. Programs cannot fill in a sign-in form, so they carry a credential instead. An API key is the simplest kind: create it once in a dashboard, store it where your code runs, and send it with every request.

bash
curl https://api.example.com/v1/reports -H "Authorization: Bearer YOUR_KEY"

Keys, tokens and OAuth

Credential Typical use Who creates it
API key One service or project, server to server You, in the dashboard
Personal access token Scripts and tools acting as you across projects You, with chosen permissions
OAuth access token Third-party apps you approve The app, after you approve it on a consent screen

The line between "key" and "token" is blurry; what matters is the scope (what it can do), the owner (whose access it borrows) and how it can be revoked.

How Reveata's credentials work

Reveata's REST API accepts three kinds (API introduction):

  • Website API keys start with dt_site_, are created under a website's Settings → Developer and work for that one website only, server side: stats, goals, payments and identify calls.
  • Account access tokens start with dt_pat_, are created under Account → API / MCP and carry the permissions you choose, such as analytics:read or goals:write. They are meant for scripts, the CLI and tools that work across several websites.
  • OAuth access tokens are issued to apps you connect, such as MCP clients, after you approve them on a consent page.

Keys are shown once when you create them; Reveata stores only a hash. A token can only do what you chose for it and what your role on each website allows, so lowering someone's role lowers their tokens too. GET /api/v1/whoami tells you which credential you sent and what it can reach. Requests are rate limited to 600 per minute per credential, with a 429 answer and a Retry-After header above that.

Other secrets follow the same pattern: proxy secrets start with dt_proxy_, crawler forwarding tokens with dt_bot_, and webhook signing secrets with whsec_.

Keeping keys safe

  1. Never put a secret key in front-end code. Anything shipped to a browser or app can be read. Reveata's tracking id (ws_…) is public on purpose; API keys are not.
  2. Use environment variables, not source files, and keep .env files out of version control.
  3. Give the least access needed. A read-only token for a dashboard script, a website key for one backend.
  4. Rotate on leaks. Roll or revoke the key at once and update the server that used it.
  5. One key per use. Separate keys make it possible to revoke one integration without breaking others.

Frequently asked questions

Is my Reveata tracking id an API key?

No. The ws_… tracking id in your snippet only lets browsers send events for your website, and it is meant to be public. Reading data or sending payments requires a secret API key or token.

What happens if an API key leaks?

Whoever has it can do everything the key allows until you revoke it. Revoke or roll it straight away, check recent activity, and create a new one with no more access than needed.

Should I use an API key or OAuth for an AI assistant?

Use OAuth where the client supports it. Reveata's MCP server lets clients connect through a consent page where you pick websites and permissions, with no key to copy. Some actions, such as changing settings, need an account access token instead.

See it with your own numbersReveata ties every visit and sale to the source that brought it. Add your website in a minute.
Get started
Was this page useful?
GlossaryWhat is a webhook?A webhook is an automatic HTTP request, usually a POST with a JSON body, that one service sends to an address you choose as soon as an event happens, such as a new payment, so your system learns about it without having to keep asking.GlossaryWhat is the Model Context Protocol (MCP)?The Model Context Protocol (MCP) is an open standard for connecting AI applications such as Claude, ChatGPT or Cursor to outside data and tools through MCP servers, so an assistant can read information and take actions in other systems in a consistent way.GlossaryWhat are Core Web Vitals?Core Web Vitals are three measurements Google uses to describe a page's real-world user experience, namely Largest Contentful Paint (loading), Interaction to Next Paint (responsiveness) and Cumulative Layout Shift (visual stability).GlossaryWhat are event properties?Event properties are key–value details attached to an analytics event, such as the plan chosen or the button clicked on a signup event, so you can break one event down by those details instead of creating a separate event for every variation.GlossaryWhat is a canonical URL?A canonical URL is the one preferred address you want search engines to index and show for a page whose content is reachable at several URLs, usually declared with a rel="canonical" link in the page's head.GlossaryWhat is a Content Security Policy (CSP)?A Content Security Policy (CSP) is a set of rules a website sends to the browser, usually in a Content-Security-Policy header, listing which sources of scripts, styles, images and network connections the page is allowed to use, so injected or unexpected code is blocked.