> ## 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 template

> Create a task template (own or global).

```
POST https://www.wiseyield.co/api/v1/templates
```

### Authentication

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

### Request body

<ParamField body="name" type="string" required>1–200 characters.</ParamField>
<ParamField body="category" type="string" required>One of `planting`, `irrigation`, `fertilization`, `pest_control`, `harvesting`, `soil_management`, `maintenance`, `planning`, `inspection`, `other`.</ParamField>
<ParamField body="description" type="string">Up to 2,000 characters.</ParamField>
<ParamField body="farmId" type="string">Bind to a specific farm. `null` (or omitted) = farm-agnostic.</ParamField>
<ParamField body="priority" type="string" default="medium">One of `low`, `medium`, `high`, `urgent`.</ParamField>
<ParamField body="estimatedDuration" type="string">Free text (e.g. `"2h"`).</ParamField>
<ParamField body="defaultAssignee" type="string">Default assignee for tasks created from this template.</ParamField>
<ParamField body="isGlobal" type="boolean" default="false">When `true`, the template is visible to all users.</ParamField>

### Response

Returns the created template wrapped under `data`.

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST 'https://www.wiseyield.co/api/v1/templates' \
    -H "Authorization: Bearer $WISEYIELD_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Weekly drip-line check",
      "category": "irrigation",
      "priority": "medium",
      "estimatedDuration": "30m"
    }'
  ```
</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                   |
| `429 RATE_LIMIT_EXCEEDED` | Per-user rate limit reached                     |
| `5xx`                     | Server error                                    |
