---
title: "updateSchedule"
---

> Documentation Index
> Fetch the complete documentation index at: https://agenthold.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# updateSchedule

Path: agenthold API › triggers

`PUT /schedules/{scheduleId}`

URL: `/api/v1/schedules/{scheduleId}`

## Authentication

Requires one of the following:

- `session`, apiKey, in cookie
- `token`, http bearer, header `Authorization`

## Path parameters

- `scheduleId` (`updateSchedule.path.scheduleId`; string, required)

## Request body

_Required._

- `name` (`updateSchedule.name`; string, required)
  - maxLength: `100` · minLength: `1`
- `cron` (`updateSchedule.cron`; string, required) — Five fields (minute hour day month weekday) or @hourly, @daily, @weekly.
- `prompt` (`updateSchedule.prompt`; string, required)
  - minLength: `1`
- `timezone` (`updateSchedule.timezone`; string, optional) — IANA time zone. Default UTC.
- `enabled` (`updateSchedule.enabled`; boolean, optional)

## Example request

```json
{
  "name": "string",
  "cron": "string",
  "timezone": "string",
  "prompt": "string",
  "enabled": true
}
```

## Code samples

### cURL

```bash
curl --request PUT \
  --url '<base-url>/api/v1/schedules/<scheduleId>' \
  --header 'Content-Type: application/json' \
  --cookie 'agenthold_session=<agenthold_session>' \
  --data '
{
  "name": "string",
  "cron": "string",
  "timezone": "string",
  "prompt": "string",
  "enabled": true
}
'
```

### TypeScript

```typescript
const url = '<base-url>/api/v1/schedules/<scheduleId>';
const options = {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json',
    cookie: 'agenthold_session=<agenthold_session>'
  },
  body: JSON.stringify({
    name: 'string',
    cron: 'string',
    timezone: 'string',
    prompt: 'string',
    enabled: true
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "<base-url>/api/v1/schedules/<scheduleId>"

payload = {
    "name": "string",
    "cron": "string",
    "timezone": "string",
    "prompt": "string",
    "enabled": True
}
headers = {
    "cookie": "agenthold_session=<agenthold_session>",
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

Updated.

#### Example

```json
{
  "name": "string",
  "cron": "string",
  "timezone": "string",
  "prompt": "string",
  "enabled": true,
  "id": "string",
  "agentId": "string",
  "sessionId": "string",
  "createdBy": {
    "id": "string",
    "email": "string",
    "name": "string",
    "avatarUrl": "string"
  },
  "nextRunAt": "2019-08-24T14:15:22Z",
  "lastRunAt": "2019-08-24T14:15:22Z",
  "lastError": "string",
  "createdAt": "2019-08-24T14:15:22Z"
}
```

- `name` (`updateSchedule.response.200.name`; string, required)
  - maxLength: `100` · minLength: `1`
- `cron` (`updateSchedule.response.200.cron`; string, required) — Five fields (minute hour day month weekday) or @hourly, @daily, @weekly.
- `timezone` (`updateSchedule.response.200.timezone`; string, required) — IANA time zone. Default UTC.
- `prompt` (`updateSchedule.response.200.prompt`; string, required)
  - minLength: `1`
- `enabled` (`updateSchedule.response.200.enabled`; boolean, required)
- `id` (`updateSchedule.response.200.id`; string, required)
- `agentId` (`updateSchedule.response.200.agentId`; string, required)
- `sessionId` (`updateSchedule.response.200.sessionId`; string, required)
- `createdBy` (`updateSchedule.response.200.createdBy`; object, required)
  - `id` (`updateSchedule.response.200.createdBy.id`; string, required)
  - `email` (`updateSchedule.response.200.createdBy.email`; string, required)
  - `name` (`updateSchedule.response.200.createdBy.name`; string, required)
  - `avatarUrl` (`updateSchedule.response.200.createdBy.avatarUrl`; string, required)
- `nextRunAt` (`updateSchedule.response.200.nextRunAt`; string, required)
  - format: `date-time`
- `lastError` (`updateSchedule.response.200.lastError`; string, required)
- `createdAt` (`updateSchedule.response.200.createdAt`; string, required)
  - format: `date-time`
- `lastRunAt` (`updateSchedule.response.200.lastRunAt`; string, optional)
  - format: `date-time`

### 400

Error.

#### Example

```json
{
  "error": "string"
}
```

- `error` (`updateSchedule.response.400.error`; string, required)

### 403

Error.

#### Example

```json
{
  "error": "string"
}
```

- `error` (`updateSchedule.response.403.error`; string, required)

### 404

Error.

#### Example

```json
{
  "error": "string"
}
```

- `error` (`updateSchedule.response.404.error`; string, required)


Source: https://agenthold.dev/api/schedules/update/index.md
