Create License Key
Added in v1.0
POST
https://api.example.com/api/keys
Requires authentication:
x-api-key: YOUR_API_KEY
Creates a license key with the desired information.
Body parameters
-
uidstring requiredThe user ID to attach the license key to. -
pidinteger requiredThe product ID to register the license key for. -
statusboolean optionalThe active state of the license key. -
ipstring optionalThe authorised IP address for the license key to pass authentication. -
disabledboolean optionalDetermines if the license key is force disabled. Defaults to false.
Responses
- 200OK
- 201OK
- 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 response = 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 data = await response.json();
console.log(data);
import requests
response = requests.post(
"https://api.example.com/api/keys",
headers={
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
},
json={
"uid": "123",
"pid": 456,
"ip": "192.168.1.2",
"status": True,
"disabled": False
},
)
print(response.json())
<?php
$ch = curl_init('https://api.example.com/api/keys');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'x-api-key: YOUR_API_KEY',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => '{
"uid": "123",
"pid": 456,
"ip": "192.168.1.2",
"status": true,
"disabled": false
}',
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($response);
Response
OK
{
"id": 1,
"uuid": "123",
"product": 1,
"key": "0190a5f3-7c1e-7b2a-9d4e-3f8a6c1b2d90",
"ip": "1.1.1.1",
"status": true,
"disabled": false,
"locked": true,
"lastSeen": 1790000000000
}
OK
{
"msg": "Data created but could not be read back immediately. Please fetch manually."
}
Bad Request
{
"msg": "Missing body content. uid and pid are required."
}