API Reference
Applications
Read the applications in the workspace and the durations they price.
An application is one product you sell keys for. You create and configure them in the panel; this API reads them so your own code can pick the right application_id and duration when it issues a key.
Worth knowing
The application id
Every application has one id, the
pub_ string shown as Application id on the application in the panel. This API takes and returns only that string, for example pub_your_application_id.
Durations are strings
A duration is written
<number><unit>, where the unit is hour or day, plus the special value lifetime. 7day, 12hour and lifetime are all valid. Only durations this endpoint lists can be sold.
#List applications
GET
https://api.ctyauth.com/manage/v1/applications
Every application in the workspace with its priced durations. A locked token sees only its own.
Can answer
GET
/applications
GET /manage/v1/applications HTTP/1.1
Host: api.ctyauth.com
X-Api-Key: ck_your_key
X-Api-Secret: sk_your_secret
Accept: application/json
curl https://api.ctyauth.com/manage/v1/applications \
-H "X-Api-Key: ck_your_key" \
-H "X-Api-Secret: sk_your_secret"
const response = await fetch('https://api.ctyauth.com/manage/v1/applications', {
method: 'GET',
headers: {
'X-Api-Key': process.env.API_KEY,
'X-Api-Secret': process.env.API_SECRET,
'Accept': 'application/json',
},
});
const data = await response.json();
if (!response.ok) throw new Error(data.error);
$handle = curl_init('https://api.ctyauth.com/manage/v1/applications');
curl_setopt_array($handle, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => [
'X-Api-Key: ' . getenv('API_KEY'),
'X-Api-Secret: ' . getenv('API_SECRET'),
'Accept: application/json',
],
]);
$data = json_decode(curl_exec($handle), true);
import os, requests
response = requests.get(
"https://api.ctyauth.com/manage/v1/applications",
headers={
"X-Api-Key": os.environ["API_KEY"],
"X-Api-Secret": os.environ["API_SECRET"],
},
)
response.raise_for_status()
data = response.json()
{
"applications": [
{
"id": "pub_your_application_id",
"name": "My App",
"description": null,
"status": "active",
"is_active": true,
"current_version": "1.4.2",
"key_prefix": null,
"key_version": 2,
"signing_public_key": "your_public_key_base64",
"durations": [
{
"duration": "7day",
"label": "7 Days",
"key_prefix": null,
"price_cents": 500
},
{
"duration": "30day",
"label": "30 Days",
"key_prefix": null,
"price_cents": 1500
}
]
}
],
"max_duration_days": 3650
}
{
"error": "missing_credentials",
"message": "Send your API key and secret."
}
{
"error": "bad_credentials",
"message": "These API credentials are not valid."
}
{
"error": "seller_inactive",
"message": "This account is suspended or its plan has lapsed."
}