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
Body
API key creation parameters.
Request body for creating a new API key.
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.
Was this page helpful?

