# Replace Task Environment Variables (BYO Env Blob)

> Replace Task Environment Variables (BYO Env Blob) is a free API for AI agents from scheduler.withzero.xyz, Free, status unknown (last checked 2026-10-12, last successful call 2026-08-10).

Fully replaces the encrypted environment variable map for a scheduled cron task, with KMS re-encryption at rest and no plaintext echo in responses.

## Facts

- Endpoint: PUT https://scheduler.withzero.xyz/api/v1/tasks/{id}/env?utm_source=zero.xyz
- Price: Free
- Status: unknown
- Last checked: 2026-10-12
- Last successful call: 2026-08-10
- Success rate: 92% of calls made through Zero
- Rating: 5.0 / 5 from 1 review
- Activations on Zero: 12
- Provider: scheduler.withzero.xyz
- Website: https://scheduler.withzero.xyz
- Canonical page: https://www.zero.xyz/c/scheduler-withzero-xyz-replace-task-environment-variables-byo-env-blob-6465a241
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_63xzmnEOT20T0s9jKtCYS

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability scheduler-withzero-xyz-replace-task-environment-variables-byo-env-blob-6465a241 -d '<json body>'
```

Example prompt: Update the environment variables for my scheduled task (ID: a3f1c2d4-...) — replace everything with DATABASE_URL=postgres://... and API_KEY=sk-abc123, and clear out any other existing vars.

## When to prefer this

Use this endpoint when you need to fully replace all environment variables for an existing scheduled task — e.g. rotating secrets, updating API keys, or clearing the env. If you only want to update task metadata like notify_email or tool_list, use the PATCH metadata endpoint instead. If no task exists yet, create the task first and then call this endpoint.

## Known failure modes

- 404 if the task ID does not exist or is not owned by the caller
- 400 if env key names do not match the required SCREAMING_SNAKE_CASE pattern (^[A-Z_][A-Z0-9_]*$)
- 400 if any env value exceeds 4096 characters
- 401/403 if caller lacks ownership proof for the task
- 422 if the request body structure is invalid or missing the required 'env' property
- 500 if KMS re-encryption fails internally

## How this service works

Replace the BYO env blob. KMS-re-encrypted at rest; never echoed. 📖 Full guide: https://scheduler.withzero.xyz/llms.txt

## Output

Returns the task UUID, the new env_key_version string (for tracking secret rotations), and env_keys — an array of the stored variable names (without values, since plaintext is never echoed back).

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "env"
 ],
 "properties": {
  "env": {
   "type": "object",
   "description": "Full replacement env map; submit `{}` to clear.",
   "propertyNames": {
    "type": "string",
    "pattern": "^[A-Z_][A-Z0-9_]*$"
   },
   "additionalProperties": {
    "type": "string",
    "maxLength": 4096
   }
  }
 },
 "additionalProperties": false
}
```

## Response schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "id",
  "env_key_version",
  "env_keys"
 ],
 "properties": {
  "id": {
   "type": "string",
   "format": "uuid",
   "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
  },
  "env_keys": {
   "type": "array",
   "items": {
    "type": "string"
   }
  },
  "env_key_version": {
   "type": "string"
  }
 },
 "additionalProperties": false
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/scheduler-withzero-xyz-replace-task-environment-variables-byo-env-blob-6465a241/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from scheduler.withzero.xyz](https://www.zero.xyz/host/scheduler.withzero.xyz/llms.txt)
