curl "https://server.smartlead.ai/api/v1/key?api_key=YOUR_KEY"
import requests
response = requests.get(
"https://server.smartlead.ai/api/v1/key",
params={"api_key": "YOUR_API_KEY"},
)
print(response.json())
{
"ok": true,
"key_type": "account",
"key_id": 42,
"key_name": "Agent key",
"user_id": 123,
"client_id": null,
"name": "Jane Doe",
"email": "jane@example.com",
"access": "full",
"can_spend": true
}
{
"ok": true,
"key_type": "client",
"key_id": null,
"key_name": null,
"user_id": 123,
"client_id": 77,
"name": "Example Client",
"email": "client@example.com",
"access": "client",
"can_spend": true
}
{
"message": "Invalid API Key"
}
{
"ok": false,
"error": "Failed to read the API key details"
}
Utilities
Get API Key Info
See which account or client the API key you are calling with belongs to
GET
/
api
/
v1
/
key
curl "https://server.smartlead.ai/api/v1/key?api_key=YOUR_KEY"
import requests
response = requests.get(
"https://server.smartlead.ai/api/v1/key",
params={"api_key": "YOUR_API_KEY"},
)
print(response.json())
{
"ok": true,
"key_type": "account",
"key_id": 42,
"key_name": "Agent key",
"user_id": 123,
"client_id": null,
"name": "Jane Doe",
"email": "jane@example.com",
"access": "full",
"can_spend": true
}
{
"ok": true,
"key_type": "client",
"key_id": null,
"key_name": null,
"user_id": 123,
"client_id": 77,
"name": "Example Client",
"email": "client@example.com",
"access": "client",
"can_spend": true
}
{
"message": "Invalid API Key"
}
{
"ok": false,
"error": "Failed to read the API key details"
}
Returns who the API key you send belongs to: an account key or a client key, the account’s user ID, the client ID for a client key, and the name and email on it. It changes nothing and spends nothing, so it is a safe first call to check a key before an agent acts. It never returns the key itself.
Unlike Get Account by API Key, it also answers for client API keys.
Query Parameters
curl "https://server.smartlead.ai/api/v1/key?api_key=YOUR_KEY"
import requests
response = requests.get(
"https://server.smartlead.ai/api/v1/key",
params={"api_key": "YOUR_API_KEY"},
)
print(response.json())
Response Fields
The key’s ID for an account key created on the API keys page;
null for a client key or an older account keyfull for an account key (the whole account), client for a client key (that client’s data only)Response Codes
{
"ok": true,
"key_type": "account",
"key_id": 42,
"key_name": "Agent key",
"user_id": 123,
"client_id": null,
"name": "Jane Doe",
"email": "jane@example.com",
"access": "full",
"can_spend": true
}
{
"ok": true,
"key_type": "client",
"key_id": null,
"key_name": null,
"user_id": 123,
"client_id": 77,
"name": "Example Client",
"email": "client@example.com",
"access": "client",
"can_spend": true
}
{
"message": "Invalid API Key"
}
{
"ok": false,
"error": "Failed to read the API key details"
}
