API Key Management
Manage your API keys to securely authenticate API requests to TextFlow.
What are API Keys?
Section titled “What are API Keys?”API keys are authentication tokens that allow your applications to interact with the TextFlow API. Each key is unique to your organization and grants access to send SMS messages and manage resources programmatically.
API Key Types
Section titled “API Key Types”TextFlow supports two types of API keys:
Production Keys (sk_live_*)
Section titled “Production Keys (sk_live_*)”- Use for: Live production environments
- Prefix:
sk_live_ - Billing: Messages count toward your subscription limits
- Example:
sk_live_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0
Test Keys (sk_test_*)
Section titled “Test Keys (sk_test_*)”- Use for: Development and testing
- Prefix:
sk_test_ - Billing: Messages do not count toward limits (test mode)
- Example:
sk_test_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0
Creating an API Key
Section titled “Creating an API Key”- Log in to your TextFlow account
- Navigate to Settings → API Keys
- Click Create API Key
- Enter a descriptive name (e.g., “Production Server”, “Development”)
- Select environment: Production or Test
- Click Create
- Copy the key immediately - it will only be shown once
Managing API Keys
Section titled “Managing API Keys”Viewing API Keys
Section titled “Viewing API Keys”Your API keys page displays:
- Key prefix: First 16 characters (e.g.,
sk_live_a1b2c3d4) - Name: Descriptive name you assigned
- Environment: Production or Test
- Last used: Timestamp of most recent API call
- Status: Active or Revoked
- Created: When the key was generated
Revoking API Keys
Section titled “Revoking API Keys”To immediately disable an API key:
- Go to Settings → API Keys
- Find the key you want to revoke
- Click Revoke
- Confirm the action
Revoked keys:
- ✅ Stop working immediately
- ✅ Return
401 Unauthorizederrors - ✅ Can be permanently deleted
- ❌ Cannot be reactivated (create a new key instead)
Regenerating API Keys
Section titled “Regenerating API Keys”To replace an existing key with a new one:
- Go to Settings → API Keys
- Find the key you want to regenerate
- Click Regenerate
- Copy the new key immediately
- Update your application with the new key
This is useful when:
- You want to rotate keys without changing the name/description
- The old key was compromised
- You’re implementing key rotation as a security policy
Deleting API Keys
Section titled “Deleting API Keys”To permanently remove a revoked API key:
- Go to Settings → API Keys
- Find the revoked key
- Click Delete
- Confirm permanent deletion
API Key Security
Section titled “API Key Security”Best Practices
Section titled “Best Practices”-
Use Environment Variables
Terminal window # .env fileTEXTFLOW_API_KEY=sk_live_your_api_key_hereNever hardcode API keys in your source code.
-
Separate Keys by Environment
- Use different keys for development, staging, and production
- Never use production keys in development environments
-
Limit Key Access
- Only share keys with team members who need them
- Use a secrets manager (AWS Secrets Manager, HashiCorp Vault, etc.)
- Never commit keys to version control
-
Rotate Keys Regularly
- Change production keys every 90 days
- Document key rotation procedures
- Use calendar reminders for scheduled rotations
-
Monitor Key Usage
- Check “Last used” timestamps regularly
- Revoke keys that haven’t been used in 90+ days
- Set up alerts for unusual API activity
What NOT to Do
Section titled “What NOT to Do”❌ Don’t commit keys to Git:
// BAD - Don't do this!const apiKey = 'sk_live_a1b2c3d4e5f6g7h8'; // Hardcoded key❌ Don’t expose keys in client-side code:
<!-- BAD - Don't do this! --><script> const API_KEY = 'sk_live_a1b2c3d4e5f6g7h8';</script>❌ Don’t share keys in screenshots, support tickets, or chat messages
❌ Don’t use the same key across multiple applications
What TO Do
Section titled “What TO Do”✅ Do use environment variables:
// GOODconst apiKey = process.env.TEXTFLOW_API_KEY;✅ Do use server-side API calls:
// GOOD - Server-side API routeapp.post('/api/send-sms', async (req, res) => { const apiKey = process.env.TEXTFLOW_API_KEY; // Make API call with key});✅ Do use a .gitignore file:
.env.env.localsecrets/✅ Do store keys in a secrets manager for production deployments
API Key Permissions
Section titled “API Key Permissions”All API keys have the same permissions:
- ✅ Send SMS messages via API
- ✅ View message delivery status
- ✅ Access organization resources (contacts, campaigns)
- ❌ Cannot create/modify users or billing settings
Troubleshooting
Section titled “Troubleshooting””API key required”
Section titled “”API key required””Cause: The X-API-Key header is missing from your request.
Solution: Add the header to all API requests:
curl -X POST https://textflow.telair.net/api/v1/messages/send \ -H "X-API-Key: sk_live_your_api_key_here" \ -H "Content-Type: application/json" \ -d '{"to": "+15551234567", "message": "Test"}'“Invalid API key format”
Section titled ““Invalid API key format””Cause: The key doesn’t start with sk_live_ or sk_test_.
Solution:
- Check that you copied the entire key
- Verify there are no extra spaces or line breaks
- Ensure you’re using the correct environment variable
”Invalid or inactive API key”
Section titled “”Invalid or inactive API key””Cause: The key was revoked, deleted, or doesn’t exist.
Solution:
- Check the API Keys page to see if the key is active
- Generate a new key if the old one was revoked
- Verify you’re using the correct key for this account
Key not working after creation
Section titled “Key not working after creation”Cause: Possible caching or environment variable issues.
Solution:
- Restart your application to reload environment variables
- Clear any application caches
- Verify the key was copied correctly (check for trailing spaces)
“Last used” timestamp not updating
Section titled ““Last used” timestamp not updating”Cause: The key might not be making successful API calls.
Solution:
- Check your application logs for API errors
- Verify the key is being sent in the
X-API-Keyheader - Test with a simple curl command to confirm the key works
Rate Limiting
Section titled “Rate Limiting”API keys are subject to rate limits based on your subscription plan:
| Plan | Per-Minute Limit | Daily Limit |
|---|---|---|
| Starter | 100 requests/min | 5,000 messages |
| Marketer | 300 requests/min | 25,000 messages |
| Enterprise | Custom | Custom |
When you exceed the rate limit, you’ll receive a 429 Too Many Requests response. Implement exponential backoff and retry logic in your applications.
Monitoring API Usage
Section titled “Monitoring API Usage”Check API usage in your dashboard:
- Go to Dashboard
- View API Activity section
- See recent API calls, success rates, and errors
You can also see per-key usage:
- Go to Settings → API Keys
- Check the Last used column
- Click on a key to view detailed usage stats
Compliance & Data Security
Section titled “Compliance & Data Security”- Encryption: API keys are hashed using SHA-256 before storage
- HTTPS Only: All API requests must use HTTPS (TLS 1.2+)
- No Logging: Full API keys are never logged in plain text
- Compliance: Meets SOC 2, GDPR, and CASL requirements