API Keys
Create an API key
Creates a new API key for the authenticated user in the current workspace.
The raw key value is returned only once at creation time; subsequent list
responses will only show the prefix.
POST
/
api-keys
Create an API key
curl --request POST \
--url https://slog.ai/api-keys \
--header 'Content-Type: application/json' \
--header 'slog-api-key: <api-key>' \
--data '
{
"name": "CI/CD key",
"expiresAt": "2027-01-01T00:00:00.000Z"
}
'import requests
url = "https://slog.ai/api-keys"
payload = {
"name": "CI/CD key",
"expiresAt": "2027-01-01T00:00:00.000Z"
}
headers = {
"slog-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'slog-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'CI/CD key', expiresAt: '2027-01-01T00:00:00.000Z'})
};
fetch('https://slog.ai/api-keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://slog.ai/api-keys",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'CI/CD key',
'expiresAt' => '2027-01-01T00:00:00.000Z'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"slog-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://slog.ai/api-keys"
payload := strings.NewReader("{\n \"name\": \"CI/CD key\",\n \"expiresAt\": \"2027-01-01T00:00:00.000Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("slog-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://slog.ai/api-keys")
.header("slog-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"CI/CD key\",\n \"expiresAt\": \"2027-01-01T00:00:00.000Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://slog.ai/api-keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["slog-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"CI/CD key\",\n \"expiresAt\": \"2027-01-01T00:00:00.000Z\"\n}"
response = http.request(request)
puts response.read_body{
"id": "apik_01jqapikey002",
"name": "CI/CD key",
"prefix": "sk_a1b2c3",
"userId": "user_01jquser0001",
"workspaceId": "ws_01jqws000001",
"createdAt": "2026-05-24T10:00:00.000Z",
"lastUsedAt": null,
"expiresAt": "2027-01-01T00:00:00.000Z",
"key": "sk_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6"
}{
"error": {
"code": "BAD_REQUEST",
"message": "teamId is required"
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "Authentication required"
}
}Authorizations
ApiKeyBearerToken
API key obtained from the Slog dashboard or returned by the signup/invite-redeem
flows. Pass as the slog-api-key header.
Body
application/json
Response
API key created. Store the key value — it will not be shown again.
Unique API key ID (UPID).
Example:
"apik_01jqapikey001"
Example:
"Default"
First 10 characters of the raw key, safe to display.
Example:
"sk_a1b2c3"
ID of the user this key belongs to.
Example:
"user_01jquser0001"
Example:
"ws_01jqws000001"
Example:
"2026-05-01T10:00:00.000Z"
Example:
"2026-05-20T08:00:00.000Z"
Example:
null
Full raw API key value — shown only at creation time.
Example:
"sk_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6"
Create an API key
curl --request POST \
--url https://slog.ai/api-keys \
--header 'Content-Type: application/json' \
--header 'slog-api-key: <api-key>' \
--data '
{
"name": "CI/CD key",
"expiresAt": "2027-01-01T00:00:00.000Z"
}
'import requests
url = "https://slog.ai/api-keys"
payload = {
"name": "CI/CD key",
"expiresAt": "2027-01-01T00:00:00.000Z"
}
headers = {
"slog-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'slog-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'CI/CD key', expiresAt: '2027-01-01T00:00:00.000Z'})
};
fetch('https://slog.ai/api-keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://slog.ai/api-keys",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'CI/CD key',
'expiresAt' => '2027-01-01T00:00:00.000Z'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"slog-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://slog.ai/api-keys"
payload := strings.NewReader("{\n \"name\": \"CI/CD key\",\n \"expiresAt\": \"2027-01-01T00:00:00.000Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("slog-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://slog.ai/api-keys")
.header("slog-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"CI/CD key\",\n \"expiresAt\": \"2027-01-01T00:00:00.000Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://slog.ai/api-keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["slog-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"CI/CD key\",\n \"expiresAt\": \"2027-01-01T00:00:00.000Z\"\n}"
response = http.request(request)
puts response.read_body{
"id": "apik_01jqapikey002",
"name": "CI/CD key",
"prefix": "sk_a1b2c3",
"userId": "user_01jquser0001",
"workspaceId": "ws_01jqws000001",
"createdAt": "2026-05-24T10:00:00.000Z",
"lastUsedAt": null,
"expiresAt": "2027-01-01T00:00:00.000Z",
"key": "sk_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6"
}{
"error": {
"code": "BAD_REQUEST",
"message": "teamId is required"
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "Authentication required"
}
}