Create an API key for an application
OpenAPI JSONPOST
/v1/apps/{app}/api-keys
const url = 'https://api.eu.apigami.com/v1/apps/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/api-keys';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.eu.apigami.com/v1/apps/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/api-keys \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "example" }'The secret is returned once, never again. A dashboard session or personal access token only: an agent token and an OAuth token are refused with 403, so an AI assistant asks the person to create the key in the dashboard.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”app
required
string format: uuid
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
name
required
string
Examplegenerated
{ "name": "example"}Responses
Section titled “Responses”The key, shown once.
Media typeapplication/json
object
id
required
string format: uuid
secret
required
apg_ followed by the key.
string
Examplegenerated
{ "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "secret": "example"}An agent token or an OAuth token.
Media typeapplication/json
object
error
required
string
consentPending
Present and true when the approval window is open and the user has not answered within 45 s.
boolean
Example
{ "error": "an agent token cannot administer the account; ask the user to do it in the dashboard"}Not an application of your team.
Media typeapplication/json
object
error
required
string
consentPending
Present and true when the approval window is open and the user has not answered within 45 s.
boolean
Example
{ "error": "not found"}