Levain LabsLevain Labs
API ReferenceSchedules

Create Schedule

Create a cron schedule for an agent.

The schedule fires its first run at the next time matching cron_expr after this call returns. Use DELETE /api/v1/schedules/{id} to remove a schedule, or PATCH /api/v1/schedules/{id} with enabled=false to pause it without losing its configuration.

POST
/api/v1/agents/{agent_id}/schedules

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Path Parameters

agent_id*Agent Id
Formatuuid

Header Parameters

X-API-Key?string|null

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X POST "https://api.levainlabs.com/api/v1/agents/497f6eca-6276-4993-bfeb-53cbbbba6f08/schedules" \  -H "Content-Type: application/json" \  -d '{    "cron_expr": "string"  }'
{
  "id": "string",
  "agent_id": "string",
  "agent_version_id": "string",
  "cron_expr": "string",
  "timezone": "string",
  "prompt": "string",
  "initial_state": {},
  "enabled": true,
  "next_fire_at": "string",
  "last_fired_at": "string",
  "last_run_id": "string",
  "created_at": "string"
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}