Cron Job Variable
Cron Job Variables store configuration values and secrets that your automation scripts need at runtime. Variables are available asenv.KEY and secrets as secrets.KEY within your cron job code.
At a Glance
- Two types:
variable(plain text) andsecret(encrypted) - Keys must be uppercase with underscores (e.g.,
API_KEY,WEBHOOK_URL) - Secrets are encrypted at rest and masked in UI
- Scoped to individual cron jobs
- Maximum 10KB per value
Data Shape
Variable Types
| Type | Storage | Display | Access in Code | Use Case |
|---|---|---|---|---|
variable | Plain text | Visible | env.KEY | URLs, configuration, non-sensitive data |
secret | Encrypted | Masked (****) | secrets.KEY | API keys, tokens, passwords |
Key Naming Rules
Variable keys must follow these rules:- Start with an uppercase letter (A-Z)
- Contain only uppercase letters, numbers, and underscores
- Examples:
API_KEY,WEBHOOK_URL,MAX_RETRIES,S3_BUCKET_NAME
Usage in Cron Job Code
Security & Permissions
- Create/Update/Delete: Owner role required (same as parent cron job)
- View: Organization members can see variable keys and types
- Secret Values: Never exposed in API responses (always masked)
- Encryption: Secrets encrypted using organization’s encryption key
- Decryption: Only occurs at runtime within the sandbox
API Notes
cronJobVariable.list: Returns variables with masked secret valuescronJobVariable.create: Creates new variable (encrypts if type is “secret”)cronJobVariable.update: Updates value (re-encrypts secrets)cronJobVariable.delete: Removes variable from job
Best Practices
- Use secrets for sensitive data: API keys, tokens, passwords should always be secrets
- Use variables for configuration: URLs, feature flags, thresholds can be variables
- Descriptive naming: Use clear names like
SLACK_WEBHOOK_URLnotURL1 - Document purpose: Add comments in your cron job code explaining each variable
- Rotate secrets regularly: Update API keys and tokens periodically
Related Concepts
- CronJob - Parent scheduled automation job
- CronJobExecution - Execution history and logs

