Aptly uses two types of API keys to secure your real-time communications: Public Keys for client-side applications and Server Keys for server-side integrations.Documentation Index
Fetch the complete documentation index at: https://docs.aptly.cloud/llms.txt
Use this file to discover all available pages before exploring further.
Key Types Overview
Public Keys
For browsers, mobile apps, and client-side code
Server Keys (sk_)
For backend services, APIs, and server-to-server communication
Public Keys
When to Use
- Browser applications
- Mobile apps (iOS, Android, React Native)
- Client-side JavaScript
- Any code that runs on user devices
Security Features
- Origin validation: Requests are validated against allowed domains
- Restricted permissions: Can only subscribe to channels
- Safe to expose: Designed to be included in client-side code
Example
Server Keys
When to Use
- Backend APIs (Node.js, Python, Go, etc.)
- Serverless functions (AWS Lambda, Vercel, Cloudflare Workers)
- Scheduled jobs and cron tasks
- Webhooks and integrations
- CI/CD pipelines
Security Features
- No origin restrictions: Works from any server environment
- Full permissions: Can publish and subscribe
- Must be kept secret: Should never be exposed in client-side code
Example
Getting Your API Keys
Navigate to Console
Go to console.aptly.cloud and select your project
Best Practices
For Public Keys
For Server Keys
Common Use Cases
Use Case 1: Web Application
Use Case 2: Mobile App
Use Case 3: Serverless Function
Security Checklist
- Store server keys in environment variables
- Add
.envfiles to.gitignore - Use public keys for all client-side code
- Configure allowed origins for public keys
- Rotate keys if accidentally exposed
- Use different keys for development and production
Key Rotation
If you believe your server key has been compromised:Navigate to Console
Go to console.aptly.cloud and select your project
Next Steps
REST API
Learn how to publish with server keys
JavaScript SDK
Subscribe with public keys
Getting Started
Quick start guide
React SDK
Real-time React hooks