Auth
Create Api Key
Create a new API key for the current user. Requires JWT Bearer authentication with the token received from the login endpoint.
Authorization
AuthorizationRequiredBearer <token>🚀 OAuth2 authentication via secure identity provider
In: header
Scope: openid, email, profile
AuthorizationRequiredBearer <token>🎫 JWT Bearer token from OAuth2 login or direct token
In: header
Authorization<token>🗝️ API key in format: 'Bearer sk-xxxxxx'
In: header
Request Body
application/jsonRequirednamestring | null | nullResponse Body
Schema for API key response.
TypeScript Definitions
Use the response body type in TypeScript.
keyRequiredKeykey_prefixRequiredKey Prefixnamestring | null | nullValidation Error
TypeScript Definitions
Use the response body type in TypeScript.
detailDetailcurl -X POST "https://example.com/api/v1/auth/keys" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"name": "string"
}'const body = JSON.stringify({
"name": "string"
})
fetch("https://example.com/api/v1/auth/keys", {
headers: {
"Authorization": "Bearer <token>"
},
body
})package main
import (
"fmt"
"net/http"
"io/ioutil"
"strings"
)
func main() {
url := "https://example.com/api/v1/auth/keys"
body := strings.NewReader(`{
"name": "string"
}`)
req, _ := http.NewRequest("POST", url, body)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}import requests
url = "https://example.com/api/v1/auth/keys"
body = {
"name": "string"
}
response = requests.request("POST", url, json = body, headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
})
print(response.text){
"key": "string",
"key_prefix": "string",
"name": "string"
}{
"detail": [
{
"loc": [
"string"
],
"msg": "string",
"type": "string"
}
]
}How is this guide?