> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getmembrane.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete

The `delete` method removes a record from the collection.

## Configuration Example

```yaml theme={null}
# spec.yml
name: Collection Name
methods:
  delete:
    parametersSchema:
      type: object
      properties:
        hardDelete:
          type: boolean
          default: false
          description: Permanently delete instead of soft delete
```

## Implementation Examples

### REST API Mapping Implementation (Recommended)

**File:** `delete.rest.yml`

```yaml theme={null}
path: /contacts/{id}
method: DELETE
requestMapping:
  pathParameters:
    id: { $var: $.id }
  query:
    permanent: { $var: $.parameters.hardDelete }
responseMapping:
  success: true
```

### JavaScript Implementation

**File:** `delete.js`

```javascript theme={null}
export default async function deleteRecord({ apiClient, id, parameters }) {
  const queryParams = {}

  if (parameters?.hardDelete) {
    queryParams.permanent = true
  }

  await apiClient.delete(`/contacts/${id}`, { params: queryParams })

  return {
    success: true,
  }
}
```

## Input

| Property      | Type   | Description                    |
| ------------- | ------ | ------------------------------ |
| `id`          | string | The ID of the record to delete |
| `credentials` | object | Authentication credentials     |
| `parameters`  | object | Method-specific parameters     |
