Key check: is my API key valid?
GET /v1/me is the key check. There is no separate endpoint: this one validates the key, does
nothing billable and tells you what the key can do.
curl -s -o /dev/null -w "%{http_code}\n" "$DX_BASE_URL/v1/me" -H "Authorization: Bearer $DX_API_KEY"
# 200 valid key 401 wrong, revoked, expired or missing key
| Answer | Meaning |
|---|---|
200 |
The key is valid. The body has type, id, organization_id, project_id, role, scopes, permissions and expires_at. |
401 problem+json |
Wrong, revoked, expired or missing key. |
429 rate-limited |
Too many requests of the read class, or too many failed keys from your address (see Rate limits). |
- No cost. It creates no run, reads no page and consumes no quota (
max_runs_per_day,max_pages_per_month): a test pins it. - Any valid key works, including a read-only one (
readscope,viewerrole). A200says the key is alive, not that it may do something: look atscopesandpermissionsfor that. - It counts against the
readrate class (600 per minute by default). A wrong key counts against the failed-authentication limit of your address (10 per minute), so do not check a key in a tight loop.
The command line uses it already: extractit login validates the key before saving it, and
extractit whoami prints the answer. Do not paste the key in a URL: send it in the
Authorization header only.