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

> Create a task on a farm owned by the authenticated user.

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

### Authentication

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

### Request body

<ParamField body="farmId" type="string" required>UUID of the parent farm.</ParamField>
<ParamField body="title" 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">Free text.</ParamField>
<ParamField body="status" type="string" default="pending">One of `pending`, `in_progress`, `completed`, `overdue`, `cancelled`.</ParamField>
<ParamField body="priority" type="string" default="medium">One of `low`, `medium`, `high`, `urgent`.</ParamField>
<ParamField body="dueDate" type="string">ISO 8601 datetime.</ParamField>
<ParamField body="startDate" type="string">ISO 8601 datetime.</ParamField>
<ParamField body="assignedTo" type="string">Free-text assignee.</ParamField>
<ParamField body="fieldName" type="string">Free-text field reference (denormalized).</ParamField>
<ParamField body="estimatedDuration" type="string">Free text (e.g. `"2h"`, `"half day"`).</ParamField>
<ParamField body="notes" type="string">Free text.</ParamField>
<ParamField body="cropId" type="string">UUID of a linked crop (Blueprint §9.5).</ParamField>
<ParamField body="fieldId" type="string">UUID of a linked field.</ParamField>
<ParamField body="blockId" type="string">UUID of a linked block.</ParamField>

### Response

Returns the created task wrapped under `data`. See [List tasks](/api-reference/tasks/list-tasks) for the full field reference.

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST 'https://www.wiseyield.co/api/v1/tasks' \
    -H "Authorization: Bearer $WISEYIELD_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "farmId": "11111111-2222-3333-4444-555555555555",
      "title": "Spring NPK application",
      "category": "fertilization",
      "priority": "high",
      "dueDate": "2026-06-01T00:00:00.000Z"
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 201 Created theme={null}
  {
    "data": {
      "id": "...",
      "farmId": "11111111-2222-3333-4444-555555555555",
      "title": "Spring NPK application",
      "category": "fertilization",
      "status": "pending",
      "priority": "high",
      "dueDate": "2026-06-01T00:00:00.000Z",
      "createdAt": "2026-05-17T18:00:00.000Z"
    }
  }
  ```

  ```json 404 Farm not found theme={null}
  { "error": "Not found", "code": "NOT_FOUND", "message": "Farm not found" }
  ```
</ResponseExample>

## 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 doesn't exist or is not owned by the user  |
| `429 RATE_LIMIT_EXCEEDED` | Per-user rate limit reached                     |
| `5xx`                     | Server error                                    |
