Authentication
GhostSpeak API uses Bearer token authentication for all B2B API requests. API keys are managed through the Web Dashboard and provide secure, revocable access to your organization’s resources.Base URL:
https://api.ghostspeak.io/v1All API requests must be made over HTTPS. Requests made over plain HTTP will fail.Getting Your API Key
1. Generate an API Key
Navigate to the API Keys section in your dashboard:Access Dashboard
Log in to ghostspeak.io/dashboard/api-keys
Create New Key
Click “Generate New API Key” and provide a descriptive name (e.g., “Production Server”, “Staging Environment”)
Copy Key Securely
Your API key will be shown only once. Store it securely in a password manager or secrets vault.
2. API Key Format
API keys follow this format:- Prefix:
gs_live_(production) orgs_test_(sandbox) - Key: 40-character alphanumeric string
- Total Length: 48 characters
Making Authenticated Requests
Authorization Header
Include your API key in theAuthorization header using the Bearer scheme:
Example Requests
API Key Management
Key Permissions
GhostSpeak API keys support three permission levels:| Permission | Description | Use Case |
|---|---|---|
| Read-Only | GET requests only | Analytics dashboards, reporting tools |
| Read-Write | GET, POST, PATCH requests | Application integrations, agent management |
| Admin | All requests including DELETE | Full platform control, administrative tasks |
Rotating API Keys
To rotate an API key:- Generate a new API key in the dashboard
- Update your application configuration with the new key
- Test the new key in a staging environment
- Deploy the configuration change to production
- Revoke the old API key after 24-48 hours
Monitoring Key Usage
Track API key usage in the API Usage Dashboard:- Request Count: Total API calls per key
- Rate Limit Status: Current usage vs. tier limits
- Last Used: Timestamp of most recent request
- Error Rate: Failed requests by HTTP status code
Security Best Practices
Use Environment Variables
Use Environment Variables
Store API keys in environment variables, not in code:Never commit
.env
.env files to version control. Add them to .gitignore.Use Secrets Management
Use Secrets Management
For production systems, use a dedicated secrets manager:
- AWS Secrets Manager:
aws secretsmanager get-secret-value - Google Secret Manager:
gcloud secrets versions access - HashiCorp Vault:
vault kv get secret/ghostspeak - Kubernetes Secrets:
kubectl create secret generic ghostspeak-api
Restrict IP Addresses (Enterprise)
Restrict IP Addresses (Enterprise)
Enterprise plans can whitelist specific IP addresses or CIDR ranges:Contact [email protected] to enable IP whitelisting.
Monitor for Anomalies
Monitor for Anomalies
Set up alerts for unusual API key activity:
- Spike in requests: Potential key compromise or runaway process
- Requests from new IPs: Possible unauthorized access
- High error rates: Misconfigured integration or outdated key
Error Responses
Invalid or Missing API Key
- API key not included in
Authorizationheader - Incorrect Bearer token format (missing
Bearerprefix) - API key has been revoked or expired
Insufficient Permissions
Rate Limit Exceeded
Testing Your Authentication
Use this endpoint to verify your API key is working correctly:Migration from SDK to REST API
If you’re currently using the TypeScript SDK and want to migrate to direct REST API calls:SDK Recommendation: For most use cases, we recommend using the @ghostspeak/sdk package, which handles authentication, retries, and type safety automatically.
Sandbox vs. Production Keys
GhostSpeak provides two environments for development and testing:| Environment | Base URL | API Key Prefix | Purpose |
|---|---|---|---|
| Sandbox | https://api.sandbox.ghostspeak.io/v1 | gs_test_ | Testing and development |
| Production | https://api.ghostspeak.io/v1 | gs_live_ | Live applications |
Next Steps
Rate Limits
Understand tier limits and overage pricing
Agents Endpoint
Query agent data and search capabilities
API Playground
Test API endpoints interactively
SDK Reference
Use the TypeScript SDK instead of raw API calls
Need help? Contact [email protected] or join our Discord community for API assistance.
