---
title: "Create a schedule"
---

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

# Create a schedule

Path: Simplcron API › Schedules

`POST /v1/schedules`

Create a recurring job with a UTC cadence preset. Daily and weekdays run at 09:00 UTC, and weekly runs on Mondays at 09:00 UTC. The Wait Until and Wait for Reply starters are available for one-off submissions.

## Authentication

Requires one of the following:

- `bearerAuth`, http bearer, header `Authorization`
- `browserSession`, apiKey, in cookie
- `localBrowserSession`, apiKey, in cookie

## Request body

_Required._

- `name` (`createSchedule.name`; string, required)
  - maxLength: `100` · minLength: `1`
- `task` (`createSchedule.task`; string, required)
  - maxLength: `64` · pattern: `^[a-z0-9]+(?:-[a-z0-9]+)*$`
- `payload` (`createSchedule.payload`; object, required)
- `preset` (`createSchedule.preset`; string, required)
  - one of `"every-minute"`, `"hourly"`, `"daily"`, `"weekdays"`, `"weekly"`
- `maxAttempts` (`createSchedule.maxAttempts`; integer, optional) — Defaults to the task's maximum attempts.
  - maximum: `5` · minimum: `1`

## Example request

```json
{
  "name": "string",
  "task": "string",
  "payload": {},
  "preset": "every-minute",
  "maxAttempts": 1
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url '<base-url>/v1/schedules' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "string",
  "task": "string",
  "payload": {},
  "preset": "every-minute",
  "maxAttempts": 1
}
'
```

### TypeScript

```typescript
const url = '<base-url>/v1/schedules';
const options = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    Authorization: 'Bearer <token>'
  },
  body: JSON.stringify({
    name: 'string',
    task: 'string',
    payload: {},
    preset: 'every-minute',
    maxAttempts: 1
  })
};

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

### Python

```python
import requests

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

payload = {
    "name": "string",
    "task": "string",
    "payload": {},
    "preset": "every-minute",
    "maxAttempts": 1
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

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

print(response.text)
```

## Responses

### 201

Created schedule

#### Example

```json
{
  "schedule": {
    "id": "string",
    "name": "string",
    "task": "string",
    "payload": {},
    "preset": "every-minute",
    "maxAttempts": 3,
    "enabled": true,
    "nextRunAt": "2019-08-24T14:15:22Z",
    "timezone": "UTC"
  }
}
```

- `schedule` (`createSchedule.response.201.schedule`; object, required)
  - `id` (`createSchedule.response.201.schedule.id`; string, required)
  - `name` (`createSchedule.response.201.schedule.name`; string, required)
    - maxLength: `100` · minLength: `1`
  - `task` (`createSchedule.response.201.schedule.task`; string, required)
    - maxLength: `64` · pattern: `^[a-z0-9]+(?:-[a-z0-9]+)*$`
  - `payload` (`createSchedule.response.201.schedule.payload`; object, required)
  - `preset` (`createSchedule.response.201.schedule.preset`; string, required)
    - one of `"every-minute"`, `"hourly"`, `"daily"`, `"weekdays"`, `"weekly"`
  - `enabled` (`createSchedule.response.201.schedule.enabled`; boolean, required)
  - `maxAttempts` (`createSchedule.response.201.schedule.maxAttempts`; integer, optional)
    - maximum: `5` · minimum: `1` · default: `3`
  - `nextRunAt` (`createSchedule.response.201.schedule.nextRunAt`; any of, optional)
    - any of the following: `string`, `null`
  - `timezone` (`createSchedule.response.201.schedule.timezone`; string, optional)

### 400

Invalid input

#### Example

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

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

### 401

Authentication is required

#### Example

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

- `error` (`createSchedule.response.401.error`; string, required)

### 403

The credential lacks permission

#### Example

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

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

### 404

Task not found in this environment

#### Example

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

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

### 429

Schedule limit reached

#### Example

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

- `error` (`createSchedule.response.429.error`; string, required)


Source: https://simplcron.dev/docs/api/create-schedule/index.md
