API Keys
Generate and manage API keys for programmatic access to work.studio.
What Are API Keys?
API keys allow external applications to interact with work.studio programmatically:
- Trigger automations
- Query data
- Manage resources
- Integrate with CI/CD
Creating API Keys
Generate a New Key
- Go to Settings → API Keys
- Click + New API Key
- Configure the key:
- Name: Descriptive identifier
- Expiration: Optional expiry date
- Permissions: What the key can do
- Click Create
Copy Your Key
Important
Your API key is shown only once. Copy it immediately and store it securely.
API Key: {{ api_key_prefix }}a1b2c3d4e5f6g7h8i9j0...
Copy this key now. You won't see it again.
API Key Permissions
Permission Scopes
Least Privilege
Only grant necessary permissions:
# For a CI/CD pipeline that triggers tests:
Name: "CI/CD Runner"
Scopes:
- automations:run
# For a data sync service:
Name: "Data Sync"
Scopes:
- data:read
- data:write
Using API Keys
Authentication
Include the API key in the Authorization header:
curl -X POST api.work.studio/v1/automations/run \
-H "Authorization: Bearer sv_live_a1b2c3d4..." \
-H "Content-Type: application/json" \
-d '{"automation_id": "abc123", "input": {"key": "value"}}'
Example: Trigger an Automation
const response = await fetch('api.work.studio/v1/automations/run', {
method: 'POST',
headers: {
'Authorization': 'Bearer sv_live_a1b2c3d4...',
'Content-Type': 'application/json'
},
body: JSON.stringify({
automation_id: 'abc123',
input: {
customer_id: '12345',
action: 'process'
}
})
});
const result = await response.json();
console.log(result.run_id);
Example: Query Data
const response = await fetch('api.work.studio/v1/data/query', {
method: 'POST',
headers: {
'Authorization': 'Bearer sv_live_a1b2c3d4...',
'Content-Type': 'application/json'
},
body: JSON.stringify({
query: "SELECT * FROM records WHERE schema = 'orders' LIMIT 10"
})
});
const data = await response.json();
console.log(data.rows);
Managing API Keys
View All Keys
- Go to Settings → API Keys
- See all active keys
- View usage statistics
Rotate a Key
Replace an existing key with a new one:
- Click the key to open details
- Click Rotate Key
- Set transition period (optional)
- New key is generated
- Update your applications
- Old key stops working after transition
Revoke a Key
Immediately disable a key:
- Click the key
- Click Revoke
- Confirm action
Immediate Effect
Revoked keys stop working immediately. Any applications using this key will fail.
Key Types
Live Keys
For production use:
- Prefix:
sv_live_ - Access production data
- Quota limits apply
- Audit logged
Test Keys
For development:
- Prefix:
sv_test_ - Access sandbox data
- Higher rate limits
- Useful for testing
Rate Limits
API calls are rate limited:
Rate Limit Headers
X-RateLimit-Limit: 300
X-RateLimit-Remaining: 287
X-RateLimit-Reset: 1640000000
Handling Limits
if (response.status === 429) {
const retryAfter = response.headers.get('Retry-After');
await sleep(retryAfter * 1000);
// Retry request
}
Security Best Practices
Do
- Use descriptive names for keys
- Set expiration dates
- Grant minimum permissions
- Rotate keys regularly
- Store keys in environment variables
- Monitor usage for anomalies
Avoid
- Committing keys to version control
- Sharing keys between environments
- Using admin keys when not needed
- Ignoring unused keys
Secure Storage
# Environment variable (recommended)
export WORKSTUDIO_API_KEY="sv_live_a1b2c3d4..."
# .env file (gitignored)
WORKSTUDIO_API_KEY=sv_live_a1b2c3d4...
# Secret manager (production)
aws secretsmanager get-secret-value --secret-id workstudio/api-key
Audit Logs
Track API key usage:
- Go to Settings → API Keys → Logs
- Filter by:
- Key name
- Endpoint
- Status (success/error)
- Date range
Related Guides
- Team → — Manage access
- Workspace → — Configure settings
- API Reference → — Full API documentation