Cron Secrets

Store sensitive values like API tokens and passwords securely, then reference them in cron job templates using {{secret.KEY_NAME}} syntax.

How It Works

  1. Create a secret with a key and value via the API or dashboard
  2. The value is encrypted with AES-256 and stored securely
  3. Reference the secret in cron job commands or request bodies using {{secret.KEY_NAME}}
  4. At execution time, the CLI agent decrypts and substitutes the value

Security

Secret values are never returned in API responses. They are encrypted at rest with AES-256 and only decrypted at execution time by the CLI agent.

Template Variables

Secrets are referenced using the {{secret.KEY}} syntax. These are resolved at execution time alongside other built-in variables:

VariableExample ValueDescription
{{secret.KEY}}(decrypted value)Your stored secret
{{now}}2026-03-09T15:00:00ZCurrent UTC timestamp
{{now_unix}}1772560800Current Unix timestamp
{{last_run}}2026-03-09T14:00:00ZPrevious execution time
{{job_name}}daily-reportCurrent job name
{{job_id}}cj_abc123Current job ID
{{execution_id}}exec_xyz789Current execution ID
{{random_uuid}}550e8400-e29b-...New UUID per execution

Example Usage

Template

Base URL

https://api.hookwatch.dev/v1/cron-secrets

The Secret Object

The secret value is never included in API responses. Only the key and metadata are returned.

Json

Properties

FieldTypeDescription
idstringUnique identifier
user_idstringOwner user ID
team_idstringTeam ID (if team-scoped)
keystringSecret key name (unique per user, e.g., API_TOKEN)
created_atstringISO 8601 creation timestamp
updated_atstringISO 8601 last update timestamp

Create Secret

Store a new encrypted secret.

POST /v1/cron-secrets

Request Body

FieldTypeRequiredDescription
keystringYesSecret key name (must be unique per user)
valuestringYesSecret value (encrypted at rest with AES-256)

Example

curl

Unique Keys

Each user can only have one secret per key name. Attempting to create a duplicate returns 409 Conflict.

List Secrets

Retrieve all secrets for the authenticated user. Values are not included.

GET /v1/cron-secrets

Response

Json

Update Secret

Update the value of an existing secret. The key is immutable.

PUT /v1/cron-secrets/:id

Request Body

FieldTypeRequiredDescription
valuestringYesNew secret value (re-encrypted at rest)
curl

Delete Secret

Permanently delete a secret.

DELETE /v1/cron-secrets/:id

Warning

Any cron jobs referencing this secret via {{secret.KEY}} will fail to resolve the variable at execution time.

Error Codes

StatusErrorDescription
400Bad RequestMissing key or value
401UnauthorizedInvalid or missing access token
404Not FoundSecret not found or access denied
409ConflictA secret with this key already exists

Related