More in Getting started
- Install TapCub on your website
- Migrate from Google Analytics 4 or Baidu Tongji
- Add a website, app or mini-program
- How do I add TapCub to WordPress?
- How do I add TapCub to Shopify?
- Where do I paste the TapCub tracking code?
- Can I install TapCub with Google Tag Manager?
- How do I track a React, Vue or Next.js app?
- How do I check that TapCub is collecting data?
- Why does TapCub show no data after I installed it?
- What is a site, and how many can I add?
- Which time zone should I pick for a site?
- Which domains do I need to register?
- How do I keep my own visits out of the reports?
- Why does my visitor count differ from Google Analytics 4?
- Can I run TapCub alongside Google Analytics 4?
- How do I move my goals and events from GA4?
- Can I import my historical data from GA4?
- How do I add TapCub to Squarespace?
- How do I add TapCub to Wix?
- Which Content Security Policy rules does TapCub need?
- Do ad blockers block TapCub?
- How do I send events from my server?
- How do I install TapCub on React?
- How do I install TapCub on Nuxt?
- How do I install TapCub on Vue?
- How do I install TapCub on Next.js?
- How do I capture a HAR file for TapCub support?
- How do I send events with the HTTP API?
- All guides in this category
Still have a question?
Could not find it? A person reads every message, usually within a few hours on business days.
Chat with usShort answer
Owners and admins open Configuration › Settings › API keys, click Create, give the key a name, choose its scopes and an expiry, and create it. The key starts with wck_ and its full value is shown only once, so copy it into your secret manager right away. Send it in the Authorization: Bearer header from your server.
You only need a key for server-side events and log import. The website script does not use one: it carries the public site key, which is safe to expose.
Create a key
- Go to Configuration › Settings and open the API keys tab. Creating and revoking keys needs the owner or admin role.
- Click Create and enter a name that says where the key is used, for example
order-serviceornginx-importer. - Choose the scopes (see below). Pick only what this integration needs.
- Choose an expiry: never, 30, 90 or 365 days.
- Click Create and copy the key from the dialog. After you close it, only the prefix is shown.
Each key is bound to the project it was created in. Events sent with it land in that project, so requests do not carry a project ID.
Choose scopes
| Scope (label in the console) | Code | Allows |
|---|---|---|
| Server track | track:write | Send behavior events, profile updates and identity binding to /api/v1/track, and use the server SDKs |
| Write server events | events:write | Push bot access records from a gateway to /api/v1/server/events |
| Import logs | logs:write | Import access log lines to /api/v1/server/logs/import |
The list also offers Read stats, Manage definitions and Issue embed, which specific integrations use. Grant them only when a guide asks for them. A request without the required scope returns 403.
Use one key per service and purpose. An order service needs only Server track; a log shipper needs only Import logs. If one key leaks, you revoke one integration, not all of them.
Use the key
Send the key in either header:
Authorization: Bearer wck_xxxxxxxxxxxxxxxx
X-Api-Key: wck_xxxxxxxxxxxxxxxx
With a server SDK, pass it as apiKey from an environment variable, for example TAPCUB_API_KEY. See Send events from your server and Send events with the HTTP API.
Never put a key in a query string, in front-end code, in a mobile app bundle or in a repository. Anyone with the key can write data into your project.
Rotate and revoke keys
The key list shows each key's name, prefix, scopes, expiry and when it was last used.
- Rotate regularly: create a new key with the same scopes, deploy it, check that Last used has moved to the new key, then revoke the old one.
- Revoke at once if a key may have leaked. Requests with a revoked or expired key return
401. - Clean up keys that have not been used for months.
When asking support for help, share only the prefix, never the full key.
FAQ
I lost the key. Can I see it again? No. The full value is shown once. Create a new key and revoke the old one.
Which errors mean a key problem? 401 NO_API_KEY (no key in the header), 401 BAD_API_KEY (wrong, revoked or expired key) and 403 (key lacks the scope).
Can one key write to several projects? No. Create a key in each project.
Related
Did this answer your question?
We use your answers to fix and expand this page.
Couldn’t send. Please try again in a minute.
Thanks for the feedback. We’ll use it to improve this page.You’ve already sent feedback on this page. Thanks.