New: Offline-first licensing with cryptographic validation. Learn more

Products API

Products represent the software applications you want to license. Each product has its own configuration for default features, validity periods, and signing keys.

Endpoints Overview

Method Endpoint Description
POST /api/v1/products Create a new product
GET /api/v1/products List all products
GET /api/v1/products/:id Get product details
PUT /api/v1/products/:id Update a product
DELETE /api/v1/products/:id Delete a product
GET /api/v1/products/:id/public-key Get product's public key

Create Product

Create a new product in your organization. Products must have a unique code within your organization.

Request

curl -X POST https://api.licenz.io/v1/products \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "My Application Pro",
  "code": "myapp-pro",
  "description": "Professional edition with advanced features",
  "default_features": ["pro", "analytics", "export"],
  "default_valid_days": 365,
  "key_pair_id": "123e4567-e89b-12d3-a456-426614174000"
}'

Request Body

Field Type Required Description
name string Yes Display name (1-255 characters)
code string Yes Unique identifier (1-100 chars, lowercase, hyphens allowed)
description string No Product description
default_features string[] No Default features for new licenses
default_valid_days integer No Default validity period (default: 365)
key_pair_id UUID No Signing key pair to use

Response

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "My Application Pro",
  "code": "myapp-pro",
  "description": "Professional edition with advanced features",
  "default_features": ["pro", "analytics", "export"],
  "default_valid_days": 365,
  "key_pair_id": "123e4567-e89b-12d3-a456-426614174000",
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-15T10:30:00Z"
}

Key Pair Required for Licensing

To generate licenses for a product, you must assign a key pair. Create a key pair first using the Key Pairs API, then assign it to the product.


List Products

Retrieve a paginated list of all products in your organization.

Request

curl https://api.licenz.io/v1/products \
  -H "Authorization: Bearer YOUR_API_KEY"

Query Parameters

Parameter Type Description
page integer Page number (1-based, default: 1)
per_page integer Items per page (default: 20, max: 100)

Response

{
  "products": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "name": "My Application Pro",
      "code": "myapp-pro",
      "description": "Professional edition with advanced features",
      "default_features": ["pro", "analytics", "export"],
      "default_valid_days": 365,
      "key_pair_id": "123e4567-e89b-12d3-a456-426614174000",
      "created_at": "2024-01-15T10:30:00Z",
      "updated_at": "2024-01-15T10:30:00Z"
    },
    {
      "id": "660e8400-e29b-41d4-a716-446655440001",
      "name": "My Application Basic",
      "code": "myapp-basic",
      "description": "Basic edition",
      "default_features": ["basic"],
      "default_valid_days": 365,
      "key_pair_id": "123e4567-e89b-12d3-a456-426614174000",
      "created_at": "2024-01-10T08:00:00Z",
      "updated_at": "2024-01-10T08:00:00Z"
    }
  ],
  "total": 2
}

Get Product

Retrieve details of a specific product.

Request

curl https://api.licenz.io/v1/products/550e8400-e29b-41d4-a716-446655440000 \
  -H "Authorization: Bearer YOUR_API_KEY"

Response

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "My Application Pro",
  "code": "myapp-pro",
  "description": "Professional edition with advanced features",
  "default_features": ["pro", "analytics", "export"],
  "default_valid_days": 365,
  "key_pair_id": "123e4567-e89b-12d3-a456-426614174000",
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-15T10:30:00Z"
}

Update Product

Update an existing product. Only provided fields will be updated.

Request

curl -X PUT https://api.licenz.io/v1/products/550e8400-e29b-41d4-a716-446655440000 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "My Application Professional",
  "description": "Updated description with more details",
  "default_features": ["pro", "analytics", "export", "priority-support"],
  "default_valid_days": 730
}'

Request Body

Field Type Description
name string Display name (1-255 characters)
description string Product description
default_features string[] Default features for new licenses
default_valid_days integer Default validity period in days
key_pair_id UUID Signing key pair to use

Product code cannot be changed

The product code is immutable after creation, as it is embedded in license serial numbers.

Response

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "My Application Professional",
  "code": "myapp-pro",
  "description": "Updated description with more details",
  "default_features": ["pro", "analytics", "export", "priority-support"],
  "default_valid_days": 730,
  "key_pair_id": "123e4567-e89b-12d3-a456-426614174000",
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-02-20T14:45:00Z"
}

Delete Product

Delete a product from your organization. Products with existing licenses cannot be deleted.

Request

curl -X DELETE https://api.licenz.io/v1/products/550e8400-e29b-41d4-a716-446655440000 \
  -H "Authorization: Bearer YOUR_API_KEY"

Response

{
  "message": "Product deleted successfully"
}

Error Responses

Status Code Description
404 not_found Product not found
409 conflict Cannot delete product with existing licenses

Get Product Public Key

Retrieve the public key for a product. This key is used to verify licenses offline in your application.

Request

curl https://api.licenz.io/v1/products/550e8400-e29b-41d4-a716-446655440000/public-key \
  -H "Authorization: Bearer YOUR_API_KEY"

Response

{
  "product_id": "550e8400-e29b-41d4-a716-446655440000",
  "product_name": "My Application Pro",
  "product_code": "myapp-pro",
  "public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA...\n-----END PUBLIC KEY-----"
}

Embed in Your Application

Embed the public key in your application to verify licenses offline without requiring network access. The public key is safe to distribute.


Product Object

The product object contains all information about a product.

Field Type Description
id UUID Unique product identifier
name string Display name
code string Unique code (used in license serials)
description string Product description
default_features string[] Default feature flags for new licenses
default_valid_days integer Default license validity period in days
key_pair_id UUID Associated key pair for license signing
created_at datetime Creation timestamp
updated_at datetime Last update timestamp

Working with Features

Features are string identifiers that represent capabilities in your software. You define what features mean in your application.

Example Features

[
  "basic",           // Basic tier access
  "pro",             // Pro tier access
  "enterprise",      // Enterprise tier access
  "analytics",       // Analytics module
  "export",          // Export functionality
  "api-access",      // API access
  "priority-support" // Priority support
]

Feature Validation in Your App

// In your Rust application
use licenz_sdk::LicenseVerifier;

let verifier = LicenseVerifier::from_pem(PUBLIC_KEY)?;
let license = verifier.verify(&license_data)?;

if license.has_feature("analytics") 

if license.has_feature("export") 

Next Steps