Project Phil Documentation
Sign in

Create License Key

Added in v1.0

POSThttps://api.example.com/api/keys

Requires 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-keystringrequired
    Your API key.
  • Content-Typestringrequired
    Must be application/json.

Body parameters

  • pidstringrequired
    The product ID to register the license key for.
  • uidstringrequired
    The user ID to attach the license key to.
  • ipstringoptional
    The authorised IP address for the license key to pass authentication.
  • disabledbooleanoptional
    Determines if the license key is force disabled. Defaults to false.
  • statusbooleanoptional
    The 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."
}
Written by !RAB Last updated 1 Dec 2026

Discussion 0

No comments yet. Sign in with Discord to start the conversation.