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

# Complete task

> Mark a task as completed with optional photo, GPS coordinates, and notes.

```
POST https://www.wiseyield.co/api/v1/tasks/{id}/complete
```

Sets `status="completed"` and `completedDate=now()` (unless already set), and persists optional evidence fields on the task row.

<Note>
  **SOP-step completion deferred.** The dashboard `/api/tasks/{id}/complete` route also supports step-by-step completion for SOP-driven tasks (Blueprint §9.5). The v1 wrapper handles plain-task completion only. SOP-step completion via API key is part of a future batch.
</Note>

### Authentication

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

### Path parameters

<ParamField path="id" type="string" required>Task UUID.</ParamField>

### Request body

All fields optional.

<ParamField body="photoUrl" type="string">URL pointing to evidence photo (e.g. uploaded to your own S3).</ParamField>
<ParamField body="gpsLat" type="number">Latitude, −90 to 90.</ParamField>
<ParamField body="gpsLng" type="number">Longitude, −180 to 180.</ParamField>
<ParamField body="notes" type="string">Up to 2,000 characters.</ParamField>

### Response

Returns the updated task wrapped under `data` (status now `completed`).

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST 'https://www.wiseyield.co/api/v1/tasks/aaaaaaaa.../complete' \
    -H "Authorization: Bearer $WISEYIELD_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "photoUrl": "https://example.com/proof.jpg",
      "gpsLat": 30.0444,
      "gpsLng": 31.2357,
      "notes": "Applied 2.5 L/ha"
    }'
  ```
</RequestExample>

## Errors

| Status                    | When                                            |
| ------------------------- | ----------------------------------------------- |
| `400 INVALID_ID`          | `{id}` is not a valid UUID                      |
| `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`           | Task doesn't exist or belongs to another user   |
| `429 RATE_LIMIT_EXCEEDED` | Per-user rate limit reached                     |
| `5xx`                     | Server error                                    |
