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

# Create recurring task

> Create a recurring task schedule linked to a task template.

```
POST https://www.wiseyield.co/api/v1/recurring-tasks
```

### Authentication

Requires a key with the `tasks:write` scope.

### Request body

<ParamField body="farmId" type="string" required>UUID of the parent farm. Must be owned by the user.</ParamField>
<ParamField body="templateId" type="string" required>UUID of an existing [task template](/api-reference/templates/list-templates). Must be either user-owned or global.</ParamField>
<ParamField body="pattern" type="string" required>One of `daily`, `weekly`, `monthly`, `yearly`, `custom`.</ParamField>
<ParamField body="startDate" type="string" required>ISO 8601 datetime for first occurrence.</ParamField>
<ParamField body="interval" type="integer">Pattern interval (default `1`). Range 1–365.</ParamField>
<ParamField body="daysOfWeek" type="array">For `weekly`: array of 0–6 (0 = Sunday).</ParamField>
<ParamField body="dayOfMonth" type="integer">For `monthly`: 1–31.</ParamField>
<ParamField body="monthOfYear" type="integer">For `yearly`: 1–12.</ParamField>
<ParamField body="endDate" type="string">ISO 8601 — schedule stops generating after this date.</ParamField>
<ParamField body="generateDaysBefore" type="integer">0–90. Generate the task this many days before its `nextOccurrence`.</ParamField>
<ParamField body="assignedTo" type="string">Default assignee for generated tasks.</ParamField>
<ParamField body="fieldName" type="string">Free-text field reference (denormalized).</ParamField>

### Response

Returns the created schedule wrapped under `data`. `nextOccurrence` is initialized to `startDate`.

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST 'https://www.wiseyield.co/api/v1/recurring-tasks' \
    -H "Authorization: Bearer $WISEYIELD_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "farmId": "11111111-2222-3333-4444-555555555555",
      "templateId": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
      "pattern": "weekly",
      "interval": 1,
      "daysOfWeek": [1, 4],
      "startDate": "2026-06-01T08:00:00.000Z"
    }'
  ```
</RequestExample>

## Errors

| Status                    | When                                               |
| ------------------------- | -------------------------------------------------- |
| `400 VALIDATION_ERROR`    | Body validation failed                             |
| `401`                     | Missing, malformed, expired, or revoked API key    |
| `403 INSUFFICIENT_SCOPE`  | Key lacks `tasks:write` scope                      |
| `404 NOT_FOUND`           | Farm or template doesn't exist or isn't accessible |
| `429 RATE_LIMIT_EXCEEDED` | Per-user rate limit reached                        |
| `5xx`                     | Server error                                       |
