Create API key
curl --request POST \
--url https://api.trycomp.ai/v1/organization/api-keys \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "CI evidence export",
"scopes": [
"policy:read",
"evidence:read"
]
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'CI evidence export', scopes: ['policy:read', 'evidence:read']})
};
fetch('https://api.trycomp.ai/v1/organization/api-keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.trycomp.ai/v1/organization/api-keys"
payload = {
"name": "CI evidence export",
"scopes": ["policy:read", "evidence:read"]
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)Organization
Create API key | Comp AI API
Create a scoped API key for server-side compliance automation such as evidence sync, policy workflows, or security questionnaire tooling.
POST
/
v1
/
organization
/
api-keys
Create API key
curl --request POST \
--url https://api.trycomp.ai/v1/organization/api-keys \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "CI evidence export",
"scopes": [
"policy:read",
"evidence:read"
]
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'CI evidence export', scopes: ['policy:read', 'evidence:read']})
};
fetch('https://api.trycomp.ai/v1/organization/api-keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.trycomp.ai/v1/organization/api-keys"
payload = {
"name": "CI evidence export",
"scopes": ["policy:read", "evidence:read"]
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)Authorizations
API key for authentication
Body
application/json
API key to create. The secret is returned once, on creation.
Human-readable label for the key.
Example:
"CI evidence export"
Permission scopes to grant, as resource:action strings. At least one is required, and every entry is checked against the allowlist.
Minimum array length:
1Example:
["policy:read", "evidence:read"]
Lifetime of the key. Defaults to never expiring.
Available options:
never, 30days, 90days, 1year Example:
"90days"
Response
201 - undefined
Was this page helpful?

