Get the key's owner
const url = 'https://api.cedr.dev/v1/me';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://api.cedr.dev/v1/me \ --header 'Authorization: Bearer <token>'Returns the person who owns the API key, the key’s name and every organization they belong to with their role in it. Use it to check that a key works before you rely on it.
Authorizations
Section titled “Authorizations”Responses
Section titled “Responses”The key is valid.
object
object
The person’s ID.
Their display name.
The address they sign in with.
object
The name given to the key when it was created.
Every organization the person belongs to.
object
Example
{ "user": { "id": "q7Rz2Lw9Xk4mT1cB", "name": "Sam Rivera", "email": "sam@northwind.example" }, "key": { "name": "ci-deploy" }, "organizations": [ { "id": "Hn5bV8yP3dJ6sA0e", "name": "Northwind Labs", "role": "owner" } ]}The key is missing (missing_api_key) or invalid, expired or revoked (invalid_api_key). The WWW-Authenticate header names the Bearer scheme.
object
A stable code to branch on.
A readable explanation. Its wording may change.
Example
{ "error": "invalid_api_key", "message": "The key is invalid, expired or revoked."}Headers
Section titled “Headers”Example
Bearer realm="cedr.dev"The key works but may not make this request: it was used from an address outside its IP allowlist (ip_not_allowed), or it is read-only and the request is not a GET or HEAD (insufficient_scope).
object
A stable code to branch on.
A readable explanation. Its wording may change.
Example
{ "error": "ip_not_allowed", "message": "This key can't be used from this IP address."}The key sent more requests in a minute than its owner’s plan allows (rate_limited): 30 on Free, 120 on Pro, 300 on Team and 600 on Business.
object
A stable code to branch on.
A readable explanation. Its wording may change.
Example
{ "error": "rate_limited", "message": "This key is over its plan's requests-a-minute limit."}Headers
Section titled “Headers”Seconds to wait before retrying.
Example
60Something failed on our side (internal_error). Retry with backoff.
object
A stable code to branch on.
A readable explanation. Its wording may change.
Example
{ "error": "internal_error", "message": "Something went wrong on our side. Try again."}