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

> Soft-delete a crop. Records remain in the database for audit and FK integrity.

```
DELETE https://www.wiseyield.co/api/v1/crops/{id}
```

### Authentication

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

### Path parameters

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

### Response

Returns `204 No Content` on success. The crop's `deletedAt` is set to the current timestamp; subsequent reads return `404 NOT_FOUND`. See [Soft deletes](/concepts/soft-delete) for the full semantics.

<RequestExample>
  ```bash cURL theme={null}
  curl -X DELETE 'https://www.wiseyield.co/api/v1/crops/33333333-4444-5555-6666-777777777777' \
    -H "Authorization: Bearer $WISEYIELD_API_KEY"
  ```

  ```javascript JavaScript theme={null}
  const res = await fetch(
    `https://www.wiseyield.co/api/v1/crops/${cropId}`,
    {
      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/crops/{crop_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": "Crop not found"
  }
  ```
</ResponseExample>

## Errors

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