πAPI Keys
API Keys are the βpower toolsβ of DevPayr. While License Keys validate your software at runtime, API Keys allow your backend to communicate with DevPayr and perform advanced operations.
If a License Key is your productβs entry pass, an API Key is the VIP badge your backend uses to manage DevPayr itself.
π§ What Are API Keys?
API Keys let your server:
Create, update, revoke, or reactivate licenses
Manage domains for a project
Upload and retrieve injectables
Run server-side payment checks
Automate client provisioning
Integrate DevPayr into your CI/CD or billing pipelines
Build custom dashboards and internal tools
Access DevPayr SDK service classes (
projects(),licenses(),domains(),payments(), etc.)
API Keys turn DevPayr from βa licensing engineβ into a fully programmable backend service.
π API Keys vs License Keys
License Key
Validates whether the running copy of your app is allowed to run
Inside your app (frontend or backend)
API Key
Authenticates your backend to manage DevPayr resources
Server-side only
Quick rule:
License Key β βIs this copy licensed?β API Key β βLet my backend control DevPayr.β
If you only validate licenses β no API Key needed. If you want automation β API Key required.
π― When Do You Need an API Key?
Use an API Key when you want to:
Auto-create licenses after payment
Suspend or reactivate licenses inside your billing system
Assign domains to clients dynamically
Build a custom admin dashboard
Work with injectables programmatically
Check license/payment status from backend
Access richer details via SDK service classes
Build deeper integrations with your software pipeline
You donβt need an API Key if youβre only checking if a license is valid at runtime.
π οΈ Creating an API Key
1. Go to βAPI Keysβ in the sidebar
This page lists all existing keys.
2. Click βCreate New Keyβ
A form will appear.
3. Choose where the key should belong
Project-Scoped Key
Only works for one project.
Global Key (if your plan supports it)
Works across all your projects. Use carefully β global keys are extremely powerful.
4. Select the Scopes
Scopes define what the key can do.
Examples include:
Reading/creating licenses
Managing project domains
Managing injectables
Accessing payment checks
Updating project meta
Each API Key should have only the permissions it needs.
5. (Optional) Set an Expiration Date
Useful for:
Contractors
Temporary integrations
CI bots or staging pipelines
Leave empty for permanent keys.
6. Click βCreateβ
Youβll see the key once. Copy and store it securely.
π Security Best Practices
Treat API Keys like real credentials.
NEVER use API Keys in frontend code
Keep API Keys in environment variables
Prefer project-level keys over global keys
Delete keys youβre no longer using
Rotate keys regularly
Limit scopes aggressively
If an API Key leaks, assume full backend access is compromised.
βοΈ Using API Keys in SDKs
SDKs automatically send all required headers β including the domain from which the app is running.
You can override the domain manually if your setup requires it.
Example (Node.js SDK)
After bootstrapping:
PHP and Python SDKs follow the same principle.
π Raw HTTP Calls (cURL)
When making direct API requests (cURL, Postman, fetch, axios, etc.):
The following headers are mandatory:
X-API-KEYβ authenticates your API KeyX-Devpayr-Domainβ tells DevPayr which domain is using the license
Example (Checking if a project is paid)
Example (License-based validation)
π Best Practices for API Key Usage
Use project-scoped keys unless you truly need global access
Store keys safely in environment variables
Use the SDK whenever possible β it handles all required headers
Always include
X-Devpayr-Domainin raw HTTP requestsDelete old or unused keys
Combine API Key + License Key when you need deep control
π Summary
API Keys grant your backend controlled access to DevPayr
Scopes define exactly what each API Key can do
SDKs manage all required headers automatically
Raw HTTP calls must always include
X-API-KEYandX-Devpayr-DomainAPI Keys complement License Keys β they donβt replace them
This is the full, accurate, clean version of the βAPI Keysβ page.
Last updated