Create License Key
Added in v1.0
POST
https://api.example.com/api/keysRequires authentication: x-api-key: YOUR_API_KEY
Creates a license key with the desired information. New keys are created with locked: true.
Headers
x-api-keystringrequiredYour API key.Content-TypestringrequiredMust beapplication/json.
Body parameters
pidstringrequiredThe product ID to register the license key for.uidstringrequiredThe user ID to attach the license key to.ipstringoptionalThe authorised IP address for the license key to pass authentication.disabledbooleanoptionalDetermines if the license key is force disabled. Defaults to false.statusbooleanoptionalThe active state of the license key. Defaults to true.
Responses
- 200OK
- 201Created
- 400Bad Request
Request
curl -X POST 'https://api.example.com/api/keys' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"uid": "123",
"pid": 456,
"ip": "192.168.1.2",
"status": true,
"disabled": false
}'
const res = await fetch('https://api.example.com/api/keys', {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
uid: '123',
pid: 456,
ip: '192.168.1.2',
status: true,
disabled: false
})
});
const key = await res.json();
import requests
res = requests.post(
'https://api.example.com/api/keys',
headers={'x-api-key': 'YOUR_API_KEY'},
json={
'uid': '123',
'pid': 456,
'ip': '192.168.1.2',
'status': True,
'disabled': False
}
)
key = res.json()
$ch = curl_init('https://api.example.com/api/keys');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'x-api-key: YOUR_API_KEY',
'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'uid' => '123',
'pid' => 456,
'ip' => '192.168.1.2',
'status' => true,
'disabled' => false
]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$key = json_decode(curl_exec($ch), true);
200 OK
{
"id": 1,
"uuid": "123",
"product": 456,
"key": "0190a5f3-7c1e-7b2a-9d4e-3f8a6c1b2d90",
"ip": "192.168.1.2",
"status": true,
"disabled": false,
"locked": true,
"lastSeen": null
}
201 Created
{
"msg": "Data created but could not be read back immediately. Please fetch manually."
}
400 Bad Request
{
"msg": "The uid and pid fields are required."
}
Discussion 0
Reading is open to everyone. Posting, replying, reacting and reporting require a Discord account — we only receive your public username and avatar.
No comments yet. Sign in with Discord to start the conversation.
Sign in required
Reading is open to everyone. Posting, replying, reacting and reporting require a Discord account — we only receive your public username and avatar.