Api Keys endpoints
This document contains the endpoints for the Api Keys category.
Creates an api key
/api/v1/auth/api_keys
Authorized
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
Name
Type
In
Required
Description
apiKey
object
body
optional
Body
Schema
{
"created_at" : "string" ,
"key" : "string" ,
"name" : "string" ,
"revoked" : "bool" ,
"revoked_at" : "string" ,
"secret" : "string" ,
"updated_at" : "string"
}
Request examples
/v1/auth/api_keys
Authorized
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 ))
}
Responses
{
"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"
}
Gets all the api keys
/api/v1/auth/api_keys
Authorized
Claim: LIST_API_KEY
This endpoint returns all the api keys
Request examples
/v1/auth/api_keys
Authorized
curl --location 'http://localhost/api/v1/auth/api_keys'
--header 'Authorization ••••••'
var client = new HttpClient ();
var request = new HttpRequestMessage ( HttpMethod . Get , "http://localhost/api/v1/auth/api_keys" );
request . Headers . Add ( "Authorization" , "••••••" );
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 := "get"
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 ))
}
Responses
{
"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"
}
Deletes an api key
/api/v1/auth/api_keys/{id}
Authorized
Claim: DELETE_API_KEY
This endpoint deletes an api key
Parameters
Name
Type
In
Required
Description
id
string
path
required
Api Key ID
Request examples
/v1/auth/api_keys/{id}
Authorized
curl --location 'http://localhost/api/v1/auth/api_keys/{id}'
--header 'Authorization ••••••'
var client = new HttpClient ();
var request = new HttpRequestMessage ( HttpMethod . Delete , "http://localhost/api/v1/auth/api_keys/{id}" );
request . Headers . Add ( "Authorization" , "••••••" );
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/{id}"
method := "delete"
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 ))
}
Responses
{
"code" : "int" ,
"message" : "string" ,
"stack" : [
{
"code" : "int" ,
"description" : "string" ,
"error" : "string" ,
"path" : "string"
}
]
}
{
"error" : "OAuthErrorType" ,
"error_description" : "string" ,
"error_uri" : "string"
}
Gets an api key by id or name
/api/v1/auth/api_keys/{id}
Authorized
Claim: LIST_API_KEY
This endpoint returns an api key by id or name
Parameters
Name
Type
In
Required
Description
id
string
path
required
Api Key ID
Request examples
/v1/auth/api_keys/{id}
Authorized
curl --location 'http://localhost/api/v1/auth/api_keys/{id}'
--header 'Authorization ••••••'
var client = new HttpClient ();
var request = new HttpRequestMessage ( HttpMethod . Get , "http://localhost/api/v1/auth/api_keys/{id}" );
request . Headers . Add ( "Authorization" , "••••••" );
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/{id}"
method := "get"
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 ))
}
Responses
{
"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"
}
Revoke an api key
/api/v1/auth/api_keys/{id}/revoke
Authorized
Role: SUPER_USER
Claim: LIST_API_KEY
Claim: DELETE_API_KEY
This endpoint revokes an api key
Parameters
Name
Type
In
Required
Description
id
string
path
required
Api Key ID
Request examples
/v1/auth/api_keys/{id}/revoke
Authorized
curl --location 'http://localhost/api/v1/auth/api_keys/{id}/revoke'
--header 'Authorization ••••••'
var client = new HttpClient ();
var request = new HttpRequestMessage ( HttpMethod . Put , "http://localhost/api/v1/auth/api_keys/{id}/revoke" );
request . Headers . Add ( "Authorization" , "••••••" );
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/{id}/revoke"
method := "put"
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 ))
}
Responses
{
"code" : "int" ,
"message" : "string" ,
"stack" : [
{
"code" : "int" ,
"description" : "string" ,
"error" : "string" ,
"path" : "string"
}
]
}
{
"error" : "OAuthErrorType" ,
"error_description" : "string" ,
"error_uri" : "string"
}