Overview
The Shipstar API uses Bearer token authentication. There are two types of tokens depending on which API you’re using:API Key Authentication
API keys are used for programmatic access to the Shipstar API. Include your key in theAuthorization header:
Creating API Keys
1
Sign In
Go to app.shipstar.ai and sign in to your account.
2
Navigate to API Keys
Click on API Keys in the sidebar.
3
Create New Key
Click Create API Key and enter a descriptive name.
4
Copy and Store Securely
Copy your API key immediately and store it securely. You won’t be able to view the full key again — only the first 8 characters are stored for identification.
API Key Details
- Keys are hashed with SHA-256 before storage — Shipstar never stores your raw key
- Each key tracks a
last_used_attimestamp - Keys can have an optional expiration date
- Keys can be deactivated without deletion
JWT Session Authentication
The internal API (dashboard endpoints) uses JWT tokens obtained by logging in:Response
Token Refresh
JWT tokens expire after a configurable period. Refresh an expired token (within a 30-day grace period) at:Implementation Examples
Environment Variables
Always store your API key in environment variables:Backend Proxy Pattern
For web applications, create a backend proxy to keep your API key secure:Reusable Client
Create a reusable client for your application:Security Best Practices
Never expose keys in client-side code
Never expose keys in client-side code
API keys should never be included in frontend JavaScript, mobile apps, or anywhere they can be viewed by end users.
Use environment variables
Use environment variables
Store API keys in environment variables, never in code:
- Use
.envfiles for local development - Use secret management services in production (AWS Secrets Manager, HashiCorp Vault, etc.)
- Never commit
.envfiles to version control
Rotate keys regularly
Rotate keys regularly
Establish a key rotation schedule:
- Create a new API key
- Update your application to use the new key
- Verify the new key works in production
- Deactivate the old key
Use separate keys for environments
Use separate keys for environments
Create different API keys for development, staging, and production. This limits the impact if a key is compromised and makes auditing easier.
Monitor key usage
Monitor key usage
Regularly review your API usage in the Dashboard to detect unusual activity patterns and identify compromised keys.
Troubleshooting
403 Forbidden
403 Forbidden
- Accessing a resource that belongs to another project or team
- Account restrictions
- Check that your API key belongs to the correct project
- Verify your account permissions in the Dashboard