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

# Create cron

> Create a new recurring scheduled webhook

## Request body

<ResponseField name="cron" type="string" required>
  Cron expression defining the schedule (e.g., `*/5 * * * *`). Must be a valid 5-field cron expression.
</ResponseField>

<ResponseField name="url" type="string" required>
  Webhook URL to call on each execution.
</ResponseField>

<ResponseField name="name" type="string">
  Optional display name for the cron.
</ResponseField>

<ResponseField name="method" type="string" default="POST">
  HTTP method: `GET`, `POST`, or `DELETE`.
</ResponseField>

<ResponseField name="headers" type="object" default="{}">
  Custom HTTP headers to include in the webhook request.
</ResponseField>

<ResponseField name="body" type="object" default="{}">
  JSON body to send with the webhook request (used with POST).
</ResponseField>

## Response

Returns the created cron object with a `201` status code.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://app.cronapi.dev/api/v1/crons \
    -H "Authorization: Bearer your_api_key_here" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Daily report",
      "cron": "0 9 * * *",
      "url": "https://example.com/report",
      "method": "POST",
      "headers": {"X-Custom": "value"},
      "body": {"notify": true}
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch("https://app.cronapi.dev/api/v1/crons", {
    method: "POST",
    headers: {
      "Authorization": `Bearer your_api_key_here`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      name: "Daily report",
      cron: "0 9 * * *",
      url: "https://example.com/report",
      method: "POST",
      headers: { "X-Custom": "value" },
      body: { type: "daily" },
    }),
  });
  const cron = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      "https://app.cronapi.dev/api/v1/crons",
      headers={"Authorization": "Bearer your_api_key_here"},
      json={
          "name": "Daily report",
          "cron": "0 9 * * *",
          "url": "https://example.com/report",
          "method": "POST",
          "headers": {"X-Custom": "value"},
          "body": {"notify": true},
      },
  )
  cron = response.json()
  ```
</CodeGroup>

```json 201 theme={null}
{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "user_id": "d4e5f6a7-b890-1234-cdef-567890abcdef",
  "name": "Daily report",
  "cron": "0 9 * * *",
  "url": "https://example.com/report",
  "method": "POST",
  "headers": {"X-Custom": "value"},
  "body": {"notify": true},
  "paused": false,
  "last_run_at": null,
  "next_run_at": "2026-04-16T09:00:00.000Z",
  "created_at": "2026-04-15T14:31:00.000Z"
}
```

```json 400 theme={null}
{
  "error": "Invalid cron expression: unexpected character at position 0"
}
```
