Create an API Key
Create a workspace API key and verify a read request
You need a Pro or Elite workspace and an owner or admin role. The key uses the workspace selected when you create it.
Select the workspace
Choose the workspace in the workspace switcher. Open Developers → API Keys.
Name the key and select scopes
Use a name such as report-exporter-prod.
Select only the scopes your integration needs.
For the verification request below, select reports:read.
Set an optional IP restriction
Add the service's public IP addresses if they are stable. Use individual IPv4 or IPv6 addresses. CIDR ranges are not supported. Leave the list empty to permit requests from any IP address.
Save the key
Copy the key from the creation result. Store it in a secret manager or protected environment variable named Y2_API_KEY.
Y2 displays the complete key only once.
Verify access
Run this command in an environment with Y2_API_KEY set:
curl --fail-with-body -sS -D - "https://api.y2.dev/api/v1/reports?limit=1" \
-H "Authorization: Bearer $Y2_API_KEY"Expect HTTP 200 and a JSON collection. The collection can be empty.
For a different status, see authentication errors.
Protect the key
Keep the key out of browser bundles, prompts, tool arguments, query strings, and logs. API Workbench uses the key you enter for requests but excludes it from copied examples.