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

# Delete field

> Soft-delete a field. Records remain for audit and FK integrity.

```
DELETE https://www.wiseyield.co/api/v1/farms/{id}/fields/{fieldId}
```

### Authentication

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

### Path parameters

<ParamField path="id" type="string" required>Farm UUID.</ParamField>
<ParamField path="fieldId" type="string" required>Field UUID.</ParamField>

### Response

Returns `204 No Content` on success.

<Warning>
  Fields with associated crops have an `ON DELETE RESTRICT` foreign key (per [Land hierarchy](/concepts/land-hierarchy) — field is the unit of infrastructure). Soft-deleting a field that still has active crops succeeds at the application layer but leaves orphan-reachable crops; soft-delete the crops first when possible.
</Warning>

<RequestExample>
  ```bash cURL theme={null}
  curl -X DELETE 'https://www.wiseyield.co/api/v1/farms/11111111.../fields/88888888...' \
    -H "Authorization: Bearer $WISEYIELD_API_KEY"
  ```

  ```javascript JavaScript theme={null}
  const res = await fetch(
    `https://www.wiseyield.co/api/v1/farms/${farmId}/fields/${fieldId}`,
    {
      method: 'DELETE',
      headers: { Authorization: `Bearer ${process.env.WISEYIELD_API_KEY}` },
    }
  );
  // res.status === 204; no body
  ```

  ```python Python theme={null}
  import os, requests
  res = requests.delete(
      f'https://www.wiseyield.co/api/v1/farms/{farm_id}/fields/{field_id}',
      headers={'Authorization': f"Bearer {os.environ['WISEYIELD_API_KEY']}"},
  )
  assert res.status_code == 204
  ```
</RequestExample>

<ResponseExample>
  ```http 204 No Content theme={null}
  (no body)
  ```

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

## Errors

| Status                    | When                                                                             |
| ------------------------- | -------------------------------------------------------------------------------- |
| `400 INVALID_ID`          | `{id}` or `{fieldId}` is not a valid UUID                                        |
| `401`                     | Missing, malformed, expired, or revoked API key                                  |
| `403 INSUFFICIENT_SCOPE`  | Key lacks `fields:write` scope                                                   |
| `404 NOT_FOUND`           | Farm or field doesn't exist, is already soft-deleted, or belongs to another user |
| `429 RATE_LIMIT_EXCEEDED` | Per-user rate limit reached                                                      |
| `5xx`                     | Server error                                                                     |
