Authentication
API keys
Create, list and revoke API keys, and check which account, organization or user a key acts for. A new key is shown once.
/meRetrieve the calling key
Returns the account, organization, user and scopes the API key acts for. Use it to check a key before you make other calls.
Responses
Request
curl 'https://api.agnt.ai/me' \
-H "Authorization: Bearer ak_live_..."Response
{
"ok": true,
"accountId": "6660c4a1f2e3b7d8a9c01234",
"email": "[email protected]",
"orgId": "6660c4a1f2e3b7d8a9c01234"
}/api-keysList API keys
Returns API keys on your account, newest first, with only the prefix of each key. With `X-User-Email`, returns only that user's keys. `resource=organization` requires an organization admin.
Query parameters
Responses
Request
curl 'https://api.agnt.ai/api-keys' \
-H "Authorization: Bearer ak_live_..."Response
{
"ok": true,
"apiKeys": [
{
"id": "6660c4a1f2e3b7d8a9c01234",
"account": "account",
"label": "label",
"prefix": "prefix",
"scopes": [
"scope"
],
"status": "status"
}
],
"page": 1,
"perPage": 20
}/api-keysCreate an API key
Creates an API key and returns its full value once, in `apiKey.key`. Without `userId`, an account key creates an account-wide key; with `userId`, the new key acts as that user. Creating a key for another user requires an organization admin.
Request body
Responses
activerevokedRequest
curl 'https://api.agnt.ai/api-keys' \
-X POST \
-H "Authorization: Bearer ak_live_..." \
-H "Content-Type: application/json" \
-d '{
"label": "label"
}'Response
{
"ok": true,
"apiKey": {
"id": "6660c4a1f2e3b7d8a9c01234",
"key": "ak_live_…",
"prefix": "prefix"
}
}/api-keys/{keyId}/revokeRevoke an API key
Disables an API key immediately. A user can revoke their own keys; revoking another user's key requires an admin of the key's organization or an account key.
Path parameters
Responses
Request
curl 'https://api.agnt.ai/api-keys/<keyId>/revoke' \
-X POST \
-H "Authorization: Bearer ak_live_..."Response
{
"ok": true,
"apiKey": {
"id": "6660c4a1f2e3b7d8a9c01234",
"account": "account",
"label": "label",
"prefix": "prefix",
"scopes": [
"scope"
],
"status": "status"
}
}/api-keys/{keyId}Delete an API key
Permanently deletes a revoked API key. Revoke the key first. Requires the same permission as revoking it.
Path parameters
Responses
Request
curl 'https://api.agnt.ai/api-keys/<keyId>' \
-X DELETE \
-H "Authorization: Bearer ak_live_..."Response
{
"ok": true
}