Authentication
Create, scope, send, rotate, and troubleshoot workspace-bound Y2 API keys
Y2 authenticates most API requests with a workspace-bound bearer key. Endpoints that explicitly support x402 also offer a separate paid request path when no bearer key is sent.
Authentication flow
Plan requirements
| Plan | New keys | Default limit per key | Notes |
|---|---|---|---|
| Free | 0 | No key access | Use in-app features or supported x402 endpoints |
| Lite | 0 | Existing keys: 10/minute and 500/day | Grandfathered keys only; historical active-key capacity is 2 |
| Pro | 10 | 30/minute and 5,000/day | New API-key access |
| Elite | 100 | 300/minute and 50,000/day | New API-key access plus team governance |
Existing keys that were already eligible under the Lite grace policy remain visible, usable, rotatable, and revocable. A later downgrade from Pro or Elite marks keys plan-ineligible; it does not create new Lite grace access.
Rate limits apply per key and again to the account aggregate: the workspace for workspace-bound keys, or the user for a legacy unscoped key. Creating more keys does not multiply the tenant quota.
Create a key
Select the correct workspace
Use the workspace switcher first. Y2 binds the new key to the active workspace, and later API requests resolve their tenant from that stored binding.
Open API Keys
Go to Developers → API Keys. Creating a key requires an owner or admin role in the workspace and a Pro or Elite plan.
Name and scope the key
Use a unique operational name such as report-exporter-prod. Select only the scopes required
by that integration. At least one scope is required.
Add exact IPs when useful
Optionally add the stable public egress IP addresses that are allowed to use the key. Confirm the deployed service's actual egress address before enabling this restriction.
Copy the secret once
Y2 displays the full key only in the creation result. Store it in a secret manager or protected environment variable before closing the dialog.
Key format and storage
Y2 generates 32 random bytes and encodes them as 64 hexadecimal characters after the y2_
prefix:
y2_{64 lowercase hexadecimal characters}Only the SHA-256 hash and a short display prefix are stored. The dashboard cannot retrieve the plaintext later. Regeneration creates new secret material and immediately invalidates the prior value.
Send the key
curl -sS -D - "https://api.y2.dev/api/v1/reports?limit=1" \
-H "Authorization: Bearer $Y2_API_KEY"The authentication scheme is the case-sensitive Bearer prefix followed by the key. Keep the
credential server-side; never place it in a browser bundle, query string, prompt, tool argument, or
log message.
The API Workbench does not copy your pasted key into snippets
API Workbench keeps the pasted value in React component state and
sends it only when you run a request. Generated curl, TypeScript, and Python snippets continue to
reference Y2_API_KEY. Treat the browser session and screen as sensitive while the key is
present.
Workspace scope
| Boundary | Current behavior |
|---|---|
| Resource access | Profiles, subscriptions, reports, Projects, Automations, webhooks, threads, public IDs, and usage are resolved in the key's stored workspace where the operation is tenant-scoped |
| Key management | Workspace owners and admins can list and manage workspace keys; other roles receive no key list |
| Aggregate limits | All keys in a workspace contribute to the same plan-level minute and daily pool |
| Workspace switching | Switching the application workspace does not move an existing key; it changes where a newly created key is bound |
Do not accept a user-provided workspaceId as authorization. If an operation accepts a resource ID,
the backend still verifies that the resource belongs to the tenant resolved from the key.
Scopes
| Scope | Grants access to |
|---|---|
reports:read | Report lists, individual reports, text, signals, and report graphs where specified |
reports:audio | Report audio and audio-text operations |
profiles:read | Listing profile subscription records in the key workspace |
profiles:write | Creating and changing owned profiles, including destructive profile deletion |
projects:read | Listing and inspecting owned Projects in the key workspace |
projects:write | Creating, changing, archiving, restoring, and pinning owned Projects |
automations:read | Listing owned Automation definitions and run history |
automations:write | Creating, changing, archiving, and manually running owned Automations |
news:read | News items, recaps, and feed discovery |
webhooks:manage | Webhook configuration and subscription-delivery webhook operations |
osint:read | v1 Situation Room endpoints and the v2 change feed |
intel:finint | v2 FININT, markets, shared incidents, and shared signals |
intel:cyber | v2 cyber graph, CVEs, threat actors, shared incidents, and shared signals |
intel:explorer | v2 entities, entity graphs, shared incidents, and shared signals |
intel:knowledge | Direct bounded retrieval across authorized Y2 Global Knowledge corpora |
agent:y2 | Native and OpenAI-compatible Agent Y2 streams with entitled account tools |
ledger:read | Workspace ontology ledger folds, record exports, seal verification, and STIX 2.1 exports |
ledger:write | Opening ledger subjects and appending designators, observations, and claims |
An array of required Intel scopes in the generated reference means any one of the listed scopes
can authorize that shared endpoint. Always check the exact operation's x-required-scopes value.
Plan entitlements are enforced again during key validation. Storing a scope on a key does not keep that capability active after the workspace loses the required plan feature.
intel:knowledge and agent:y2 are intentionally separate. Direct
POST /api/v2/intel/knowledge/retrieve calls require intel:knowledge. Agent Y2 routes continue to
require only agent:y2; an entitled agent can invoke Global Knowledge through the shared internal
tool. Existing keys are never expanded automatically—edit or rotate a key deliberately when an
integration needs intel:knowledge, projects:*, automations:*, or ledger:*.
Workspace research endpoints require a workspace-bound key: company financial history
(intel:finint), cyber-market fusion (intel:explorer), and the ontology ledger (ledger:*). A
personal key receives 403, and x402 payment is not accepted for them.
Write and agent scopes can change account state
profiles:write, projects:write, automations:write, ledger:write, webhooks:manage, and
agent:y2 are not
read-only. Isolate them from reporting keys and grant them only to integrations designed to
perform the related actions.
IP allowlisting
The dashboard's IP restriction currently performs an exact string comparison against the client IP
resolved from CF-Connecting-IP, the first X-Forwarded-For value, or X-Real-IP.
- Enter individual IPv4 or IPv6 addresses only.
- CIDR ranges are not parsed by the current middleware.
- For hosted jobs, allow the service's public egress IP, not a private container address.
- Removing every entry disables the key-specific IP restriction.
- A resolved address not present in the list returns
403withIP_NOT_ALLOWED.
Browser origins are not an authentication boundary
Core API responses use permissive CORS headers, and stored allowedOrigins metadata is not
currently enforced by request authentication. Use exact IP restrictions where appropriate and
keep keys out of client-side applications.
x402 selection
On an x402-enabled operation, the request path is selected by the header prefix:
| Request | Result |
|---|---|
Valid Authorization: Bearer ... | Validate key, scope, IP, and key/account limits |
| Invalid, expired, revoked, or unauthorized bearer key | Return the API-key 401 or 403; do not fall back to payment |
No header beginning with Bearer | Enter x402 on a supported endpoint, or return an authentication error when x402 is unavailable |
| Signed x402 retry | Verify replay protection, wallet and endpoint limits, and settlement before returning data |
Do not send a placeholder bearer header when you intend to use x402. See the x402 guide and the operation's generated reference for price, network, and payment headers.
Rate-limit headers
Y2 uses fixed UTC minute and day windows. Authenticated responses expose both pools:
| Header family | Meaning |
|---|---|
X-RateLimit-Limit-Minute, X-RateLimit-Remaining-Minute | Per-key minute pool |
X-RateLimit-Limit-Day, X-RateLimit-Remaining-Day | Per-key daily pool |
X-RateLimit-Limit-User-*, X-RateLimit-Remaining-User-* | Account aggregate; legacy header name, workspace-backed for workspace keys |
X-RateLimit-Reset-Minute, X-RateLimit-Reset-Day | Unix reset timestamps when included |
Retry-After | Seconds to wait after a 429 |
Agent Y2 adds a third, endpoint-specific header family. See Agent Y2 rate limits.
Rotate, revoke, or delete
Regenerate
Replaces the stored hash, resets key usage metadata, reactivates the record, and displays a new secret once. The old secret stops working immediately.
Revoke
Deactivates the key without deleting its record. Repeating the action is safe.
Delete
Permanently removes the key record. Use this only after dependent integrations have been migrated.
For routine rotation, deploy support for the replacement secret before invalidating the old key if your architecture allows parallel credentials. The dashboard's Regenerate action does not provide an overlap window for the same key record.
Errors and lockout
Y2 API errors use RFC 9457-style problem details with an actionable resolution hint:
{
"type": "https://api.y2.dev/problems/insufficient-scope",
"title": "Forbidden",
"status": 403,
"detail": "Insufficient permissions. Requires reports:read scope",
"instance": "urn:y2:request:req_...",
"code": "INSUFFICIENT_SCOPE",
"requestId": "req_...",
"resolution": "Verify that the API key belongs to the intended workspace and grants the required scope."
}| Status | Common authentication cause |
|---|---|
401 | Missing header, unknown key, revoked key, or expired key |
403 | Plan no longer eligible, missing operation scope, or IP not allowed |
429 | Per-key/account quota exceeded or source IP temporarily locked after repeated invalid credentials |
Five invalid or unknown key attempts from one resolved IP within 15 minutes trigger an authentication
lockout for that rolling window. Revoked, expired, and plan-ineligible known keys do not count as
brute-force failures. If a valid key suddenly receives a pre-validation 429, stop retrying and
wait for the lockout window to clear.