Create a new API key
curl --request POST \
--url https://statusstack.com/api/api-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>'})
};
fetch('https://statusstack.com/api/api-keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://statusstack.com/api/api-keys"
payload = { "name": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"apiToken": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"permissions": [
"<string>"
],
"version": "<string>"
}API keys
Create a new API key
Generate a new API key with specified permissions and settings
POST
/
api-keys
Create a new API key
curl --request POST \
--url https://statusstack.com/api/api-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>'})
};
fetch('https://statusstack.com/api/api-keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://statusstack.com/api/api-keys"
payload = { "name": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"apiToken": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"permissions": [
"<string>"
],
"version": "<string>"
}Authorizations
StatusStack authenticates requests with API keys, created via the dashboard with granular permissions (read, write, delete, admin, *).
API keys support version compatibility:
- v1 keys: Can only access v1 endpoints
- v2 keys: Can access both v1 and v2 endpoints
Available permissions:
read: View resources (GET requests)write: Create and update resources (POST, PUT requests)delete: Delete resources (DELETE requests)admin: Administrative access to all resources*: Wildcard permission (all actions allowed)
Body
application/json
Descriptive name for the API key
Available options:
v1, v2 Available options:
read, write, delete, admin, * Number of days until the key expires (optional)
Required range:
x >= 1Restrict key to specific team
Restrict key to specific organization
Was this page helpful?

