Skip to main content

Generate API Key

https://infrahub-api.nexgencloud.com/v1/api-key/generate

Generates a new API key for use in authenticating API requests. To learn how to authenticate your requests using your API key, click here.


Request body parameters


name string   Required

The name of the API key.
A string with a maximum length of 50 characters.


description string  optional

An optional description of the API key.


No parameters.


Attributes


status boolean

The status of the request to generate an API key, true indicates success, while false indicates error.


message string

A message describing the status of the request to generate an API key.


api_key string

Returns the api_key object, containing details of the new API key.

For descriptions of the fields within the api_key object returned in response to your request, please refer to the documentation here.


Example request
curl -X POST "https://infrahub-api.nexgencloud.com/v1/api-key/generate" \
-H "accept: application/json"\
-H "api_key: YOUR API KEY"
-d '{
"name": "example-api-key",
"description": "This is an example API key.",
}'
Response
{
"status": true,
"message": "API Key generated successfully",
"api_key": {
"created_at": "2024-06-14T15:18:00",
"key": "a36cca59-3c53-439c-a70-1df8135be52c",
"description": "This is an example API key.",
"id": 59,
"name": "example-api-key"
}
}

Returns


The response indicates the status of the request to generate a new API key, where true indicates success. Additionally, the api_key object contains the details of the newly generated API key, which can be used to authenticate Infrahub API requests.


Back to top