curl --request POST \
--url https://api.lilt.com/v2/api-keys \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "CI bot",
"expiresAt": "2027-01-01T00:00:00Z",
"userId": 42
}
'import requests
url = "https://api.lilt.com/v2/api-keys"
payload = {
"name": "CI bot",
"expiresAt": "2027-01-01T00:00:00Z",
"userId": 42
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'CI bot', expiresAt: '2027-01-01T00:00:00Z', userId: 42})
};
fetch('https://api.lilt.com/v2/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://api.lilt.com/v2/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 bot',
'expiresAt' => '2027-01-01T00:00:00Z',
'userId' => 42
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$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://api.lilt.com/v2/api-keys"
payload := strings.NewReader("{\n \"name\": \"CI bot\",\n \"expiresAt\": \"2027-01-01T00:00:00Z\",\n \"userId\": 42\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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://api.lilt.com/v2/api-keys")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"CI bot\",\n \"expiresAt\": \"2027-01-01T00:00:00Z\",\n \"userId\": 42\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lilt.com/v2/api-keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"CI bot\",\n \"expiresAt\": \"2027-01-01T00:00:00Z\",\n \"userId\": 42\n}"
response = http.request(request)
puts response.read_body{
"id": "uuid-1234",
"name": "CI bot",
"prefix": "aaaaaaaa",
"key": "lilt_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"createdAt": "2026-04-29T00:00:00Z",
"expiresAt": "2027-01-01T00:00:00Z",
"ownerEmail": "developer@lilt.com",
"ownerUserId": 42
}{
"error": "No active organization"
}{
"message": "Internal server error."
}Create an API key
Mint a new lilt_* API key under the caller’s current organization. Requires the apiKey.write permission.
The plaintext secret is returned in the key field of the response and is shown exactly once — store it securely, as it cannot be retrieved again. The optional userId lets an admin create a key on behalf of another user who already has a grant in the current organization.
curl --request POST \
--url https://api.lilt.com/v2/api-keys \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "CI bot",
"expiresAt": "2027-01-01T00:00:00Z",
"userId": 42
}
'import requests
url = "https://api.lilt.com/v2/api-keys"
payload = {
"name": "CI bot",
"expiresAt": "2027-01-01T00:00:00Z",
"userId": 42
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'CI bot', expiresAt: '2027-01-01T00:00:00Z', userId: 42})
};
fetch('https://api.lilt.com/v2/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://api.lilt.com/v2/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 bot',
'expiresAt' => '2027-01-01T00:00:00Z',
'userId' => 42
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$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://api.lilt.com/v2/api-keys"
payload := strings.NewReader("{\n \"name\": \"CI bot\",\n \"expiresAt\": \"2027-01-01T00:00:00Z\",\n \"userId\": 42\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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://api.lilt.com/v2/api-keys")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"CI bot\",\n \"expiresAt\": \"2027-01-01T00:00:00Z\",\n \"userId\": 42\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lilt.com/v2/api-keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"CI bot\",\n \"expiresAt\": \"2027-01-01T00:00:00Z\",\n \"userId\": 42\n}"
response = http.request(request)
puts response.read_body{
"id": "uuid-1234",
"name": "CI bot",
"prefix": "aaaaaaaa",
"key": "lilt_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"createdAt": "2026-04-29T00:00:00Z",
"expiresAt": "2027-01-01T00:00:00Z",
"ownerEmail": "developer@lilt.com",
"ownerUserId": 42
}{
"error": "No active organization"
}{
"message": "Internal server error."
}Authorizations
Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.
Body
API key creation parameters.
Request body for creating a new API key.
A human-readable label for the key (1–255 characters).
1 - 255"CI bot"
Optional ISO-8601 expiry timestamp. Must be in the future. Omit for a non-expiring key.
"2027-01-01T00:00:00Z"
Optional. When provided by an admin, mints the key on behalf of this user. The target user must already have a grant in the current organization. Defaults to the authenticated caller.
x >= 142
Response
The created API key, including the plaintext secret (shown once only).
A newly created or rotated API key, including the plaintext secret. The secret is shown exactly once and cannot be retrieved again. Note that lastUsedAt and revokedAt are not returned by the create and rotate operations.
The unique identifier for the API key.
"uuid-1234"
A human-readable label for the key.
"CI bot"
The first 8 characters of the key's random portion — the part that follows the lilt_ prefix. Safe to display.
"aaaaaaaa"
The full plaintext API key (lilt_ followed by 40 hex characters). Shown once only.
"lilt_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
ISO-8601 timestamp when the key was created.
"2026-04-29T00:00:00Z"
ISO-8601 timestamp when the key expires, or null if it does not expire.
"2027-01-01T00:00:00Z"
Email address of the user who owns the key. Returned when creating a key; omitted when rotating one.
"developer@lilt.com"
Numeric identifier of the user who owns the key. Returned when creating a key; omitted when rotating one.
42
Was this page helpful?

