Quick Start Guide
Get up and running with Slice License as a Service in just 5 minutes.
What You'll Learn
This guide will walk you through the essential steps to start using Slice
- Create an account and get your API key
- Set up your first product and plan
- Create a license and assign it to a user
- Validate a license using the API
Create an Account
Sign up and get your API key
First, you'll need to create a tenant account. This gives you access to the Slice dashboard where you can manage your products, plans, and licenses.
Steps:
- Go to the signup page
- Enter your business name, email, and password
- Verify your email address
- Log in to your dashboard
Tip: After signing up, you'll need to verify your email before you can access all features. Check your inbox for the verification code.
Get Your API Key
Generate an API key for authentication
API keys are used to authenticate your requests to the Slice API. You'll need one to make API calls from your application.
Steps:
- Navigate to API Keys in your dashboard
- Click "Create API Key"
- Give your key a name (e.g., "Production Key" or "Development Key")
- Copy the API key immediately - you won't be able to see it again!
- Store it securely in your environment variables
Security Warning: API keys are sensitive credentials. Never commit them to version control. Always use environment variables or secure secret management.
Example:
# .env
SLICE_API_KEY=sk_live_abc123...
SLICE_API_URL=https://api.slice.example.comCreate a Product and Plan
Set up your licensing structure
Products represent your software applications, and Plans define the licensing tiers (e.g., Basic, Professional, Enterprise). You need at least one product and plan before you can create licenses.
Using the Dashboard:
Using the API:
# Create a product
POST /api/v1/admin/products
{
"name": "My Software",
"description": "My awesome software product"
}
# Create a plan
POST /api/v1/admin/plans
{
"productId": "<product-id>",
"name": "Professional",
"maxSeats": 5,
"expiresInDays": 365,
"features": ["feature1", "feature2"]
}See the Products Guide and Plans Guide for detailed information.
Create and Assign a License
Generate a license and assign it to a user
Licenses are created from plans and assigned to users. When a user validates their license, they get access to the features defined in the plan.
Using the Dashboard:
- Go to Licenses
- Click "Create License" and select a plan
- Go to the license details and assign it to a user
Using the API:
# Create a license from a plan
POST /api/v1/admin/licenses
{
"planId": "<plan-id>"
}
# Assign license to a user
POST /api/v1/admin/licenses/:licenseId/assign
{
"userId": "user_123"
}Validate a License
Check if a user has a valid license
This is the core operation - validating whether a user has a valid license. This endpoint is called from your application to check license status.
Using the API:
POST /api/v1/validate
Authorization: Bearer sk_live_...
Content-Type: application/json
{
"userId": "user_123"
}
# Response (valid)
{
"success": true,
"data": {
"valid": true,
"license": {
"id": "...",
"status": "active",
"features": ["feature1", "feature2"]
}
}
}
# Response (invalid)
{
"success": true,
"data": {
"valid": false,
"reason": "no_license"
}
}Using the SDK:
import { SliceClient } from '@sliceapi/sdk';
const client = new SliceClient(process.env.SLICE_API_KEY!);
const result = await client.validate.validate('user_123');
if (result.valid) {
console.log('License is valid!');
console.log('Features:', result.features);
} else {
console.log('License invalid:', result.reason);
}See the License Validation API documentation for complete details.
Next Steps
You're ready to start! Here are some helpful resources: