API Reference
Routines API

Routines API

Routines are scheduled, recurring queries that run on a cron schedule. Use them to generate periodic reports, run automated checks, or trigger agent workflows on a fixed cadence. Each routine is associated with a routing rule that determines how its query is processed.

Routine Object

{
  "id": "rtn_01HXYZ",
  "name": "Daily market summary",
  "query": "Summarize today's top market movements",
  "schedule_cron": "0 9 * * *",
  "routing_rule_id": "rule_01HXYZ",
  "is_active": true,
  "last_run_at": "2025-01-15T09:00:00Z",
  "created_at": "2025-01-10T08:00:00Z",
  "updated_at": "2025-01-10T08:00:00Z"
}

Endpoints

MethodPathDescription
GET/routinesList all routines
POST/routinesCreate a new routine
PUT/routines/{id}Update an existing routine
DELETE/routines/{id}Delete a routine
POST/routines/{id}/runManually trigger a routine

List Routines

GET /api/v1/routines

cURL

curl https://api.xilos.ai/api/v1/routines \
  -H "Authorization: Bearer YOUR_X..._KEY"

Response

Returns an array of Routine Objects.


Create Routine

POST /api/v1/routines

Request Body

FieldTypeRequiredDescription
namestringYesHuman-readable name for the routine.
querystringYesThe query string to execute on each run.
schedule_cronstringYesCron expression defining the schedule (e.g., 0 9 * * * for daily at 9 AM).
routing_rule_idstringNoRouting rule to apply. If omitted, the default routing rule is used.
is_activebooleanNoWhether the routine is active. Default: true.

Info: Cron expressions use standard 5-field format: minute hour day-of-month month day-of-week. Times are in UTC.

cURL

curl -X POST https://api.xilos.ai/api/v1/routines \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_X..._KEY" \
  -d '{
    "name": "Daily market summary",
    "query": "Summarize today'"'"'s top market movements",
    "schedule_cron": "0 9 * * *",
    "routing_rule_id": "rule_01HXYZ",
    "is_active": true
  }'

Response

Returns the created Routine Object.


Update Routine

PUT /api/v1/routines/{id}

Updates an existing routine. All fields are optional.

Request Body

FieldTypeRequiredDescription
namestringNoUpdated name.
querystringNoUpdated query.
schedule_cronstringNoUpdated schedule.
routing_rule_idstringNoUpdated routing rule.
is_activebooleanNoToggle active state.

cURL

curl -X PUT https://api.xilos.ai/api/v1/routines/rtn_01HXYZ \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_X..._KEY" \
  -d '{
    "schedule_cron": "0 8 * * 1-5",
    "is_active": true
  }'

Response

Returns the updated routine object.


Delete Routine

DELETE /api/v1/routines/{id}

cURL

curl -X DELETE https://api.xilos.ai/api/v1/routines/rtn_01HXYZ \
  -H "Authorization: Bearer YOUR_X..._KEY"

Response

{
  "id": "rtn_01HXYZ",
  "deleted": true
}

Manually Trigger a Routine

POST /api/v1/routines/{id}/run

Triggers an immediate execution of the routine, regardless of its schedule. Useful for testing or on-demand runs.

cURL

curl -X POST https://api.xilos.ai/api/v1/routines/rtn_01HXYZ/run \
  -H "Authorization: Bearer YOUR_X..._KEY"

Response

{
  "id": "rtn_01HXYZ",
  "status": "running",
  "triggered_at": "2025-01-15T14:22:00Z"
}

Info: Manual runs do not affect the scheduled cadence. The routine will still execute at its next scheduled time.

Working With Routines

Define the Query

Write the query string you want to run on a schedule. Keep it self-contained — routines do not maintain conversation context between runs.

Set the Schedule

Use a cron expression to define when the routine runs. Test the expression with a cron parser (opens in a new tab) if needed.

Assign a Routing Rule

Point the routine at a routing rule to control which model handles it and whether caching is enabled.

Test Manually

Use the manual trigger endpoint to verify the routine works before relying on the schedule.