curl --request POST \
--url https://api.tryardent.com/v1/orgs/{org_id}/api-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"role_id": "<string>",
"expires_days": 123,
"scopes": []
}
'import requests
url = "https://api.tryardent.com/v1/orgs/{org_id}/api-keys"
payload = {
"name": "<string>",
"role_id": "<string>",
"expires_days": 123,
"scopes": []
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', role_id: '<string>', expires_days: 123, scopes: []})
};
fetch('https://api.tryardent.com/v1/orgs/{org_id}/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.tryardent.com/v1/orgs/{org_id}/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' => '<string>',
'role_id' => '<string>',
'expires_days' => 123,
'scopes' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.tryardent.com/v1/orgs/{org_id}/api-keys"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"role_id\": \"<string>\",\n \"expires_days\": 123,\n \"scopes\": []\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.tryardent.com/v1/orgs/{org_id}/api-keys")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"role_id\": \"<string>\",\n \"expires_days\": 123,\n \"scopes\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tryardent.com/v1/orgs/{org_id}/api-keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"role_id\": \"<string>\",\n \"expires_days\": 123,\n \"scopes\": []\n}"
response = http.request(request)
puts response.read_body{
"api_key": "<string>",
"api_key_id": "<string>",
"created_at": "<string>",
"key_prefix": "<string>",
"name": "<string>",
"role_id": "<string>",
"role_key": "<string>",
"scopes": [
"<string>"
],
"warning": "<string>",
"expires_at": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"ctx": {},
"input": "<unknown>"
}
]
}Create an API key
Create an API key with a role and optional scopes
curl --request POST \
--url https://api.tryardent.com/v1/orgs/{org_id}/api-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"role_id": "<string>",
"expires_days": 123,
"scopes": []
}
'import requests
url = "https://api.tryardent.com/v1/orgs/{org_id}/api-keys"
payload = {
"name": "<string>",
"role_id": "<string>",
"expires_days": 123,
"scopes": []
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', role_id: '<string>', expires_days: 123, scopes: []})
};
fetch('https://api.tryardent.com/v1/orgs/{org_id}/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.tryardent.com/v1/orgs/{org_id}/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' => '<string>',
'role_id' => '<string>',
'expires_days' => 123,
'scopes' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.tryardent.com/v1/orgs/{org_id}/api-keys"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"role_id\": \"<string>\",\n \"expires_days\": 123,\n \"scopes\": []\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.tryardent.com/v1/orgs/{org_id}/api-keys")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"role_id\": \"<string>\",\n \"expires_days\": 123,\n \"scopes\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tryardent.com/v1/orgs/{org_id}/api-keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"role_id\": \"<string>\",\n \"expires_days\": 123,\n \"scopes\": []\n}"
response = http.request(request)
puts response.read_body{
"api_key": "<string>",
"api_key_id": "<string>",
"created_at": "<string>",
"key_prefix": "<string>",
"name": "<string>",
"role_id": "<string>",
"role_key": "<string>",
"scopes": [
"<string>"
],
"warning": "<string>",
"expires_at": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"ctx": {},
"input": "<unknown>"
}
]
}scopes optionally restricts it to a subset of the role’s permissions. Scopes are permission keys like connectors.read — each role’s permissions array from GET /v1/orgs/{org_id}/roles lists the valid values.Authorizations
Ardent API key (sk-ard_live_… / sk-ard_test_…) or a dashboard session token.
Path Parameters
Body
Descriptive name for the key
1 - 100Role ID to grant to this API key (e.g., role_org_member)
Days until expiration (null = never expires)
Permission keys like connectors.read, a subset of the role's; empty uses all.
Response
The created key, including the secret — shown only this once.
The full secret key; shown only this once — store it now.
ID of the created key.
When the key was created.
First characters of the key, for identifying it in lists.
Human-readable key name.
ID of the role granted to the key.
The role's stable key, for example role_org_member.
Permission scopes granted to the key.
Reminder that the secret cannot be retrieved again.
When the key expires. Null when it does not expire.