Creating an API Key
1
Access your dashboard
Log in to your Lightyshare owner dashboard
2
Navigate to API settings
Go to Shop → API
3
Generate a new token
Click “Create New Token” and provide a descriptive name
4
Copy your token
Copy the generated token immediately - it won’t be shown again!
Using Your API Key
Send your API key in theAuthorization header. A token in the URL is refused.
Method 1: Authorization Header (Recommended)
Include your token in theAuthorization header using the Bearer scheme:
Token Format
Lightyshare API tokens follow a consistent format:- lsh: Prefix identifying a Lightyshare token
- environment: Either
livefor production ortestfor testing - unique_identifier: A unique string for your token
lsh_live_sk_1234567890abcdef
Token Permissions
Each token holds its own list of permissions, chosen when you create it. A call outside this list answers403. Permissions cannot be changed afterwards: create a new token.
There is no delete permission: listings are archived.
Some permissions are opened progressively: your dashboard only offers the ones available to your account. Tokens created before these permissions keep
rental:read, product:read and product:write.
Best Practices
Use Environment Variables
Store tokens in environment variables, not in code
Rotate Regularly
Rotate your API keys periodically for enhanced security
Limit Scope
Create separate tokens for different applications or environments
Monitor Usage
Track API key usage in your dashboard to detect anomalies
Revoking API Keys
If a token is compromised or no longer needed:- Go to your API settings
- Find the token in your list
- Click “Revoke” next to the token
- The token will be immediately invalidated
Environment-Specific Tokens
Lightyshare provides different token types for different environments:Troubleshooting
Common Authentication Errors
- Verify your token is correct and complete
- Check you’re using the right environment (live vs test)
- Ensure the token hasn’t been revoked