Creates an api key:
Role: SUPER_USER
Claim: CREATE_API_KEY
Claim: LIST
This endpoint creates an api key
This endpoint will create an api key in the system
API Keys are used to authenticate with the system from external applications
How are they different from a user?
A user normally has a password and is used to authenticate with the system An api key is used to authenticate with the system from an external application
Headers
Parameters
{
"created_at": "string",
"key": "string",
"name": "string",
"revoked": "bool",
"revoked_at": "string",
"secret": "string",
"updated_at": "string"
}
curl --location 'http://localhost/api/v1/auth/api_keys'
--header 'Authorization ••••••'
--header 'Content-Type: application/json'
--data '{
"key": "Some Key",
"secret": "SomeLongSecret"
}
'
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "http://localhost/api/v1/auth/api_keys");
request.Headers.Add("Authorization", "••••••");
request.Headers.Add("Content-Type", "application/json");
request.Content = new StringContent("{
"created_at": "string",
"key": "string",
"name": "string",
"revoked": "bool",
"revoked_at": "string",
"secret": "string",
"updated_at": "string"
}");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
var responseString = await response.Content.ReadAsStringAsync();
package main
import (
"fmt"
"net/http"
"strings"
"io"
)
func main() {
url := "http://localhost/api/v1/auth/api_keys"
method := "post"
payload := strings.NewReader(`{
"created_at": "string",
"key": "string",
"name": "string",
"revoked": "bool",
"revoked_at": "string",
"secret": "string",
"updated_at": "string"
}`)
client := &http.Client{}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "••••••")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
{
"encoded": "string",
"id": "string",
"key": "string",
"name": "string",
"revoked": "bool"
}
{
"code": "int",
"message": "string",
"stack": [
{
"code": "int",
"description": "string",
"error": "string",
"path": "string"
}
]
}
{
"error": "OAuthErrorType",
"error_description": "string",
"error_uri": "string"
}