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

# Delete documents

> Delete one document, a list of ids, or every match of a filter.

To delete every document in a namespace, [delete the namespace](/namespaces#delete-a-namespace).

## Delete a document

`DELETE /namespaces/:namespace/documents/:id`

<CodeGroup>
  ```bash curl theme={null}
  curl -X DELETE \
    https://api.conare.ai/namespaces/docs/documents/refunds \
    -H "Authorization: Bearer $CONARE_API_KEY"
  ```

  ```ts TypeScript theme={null}
  await docs.delete("refunds");
  ```
</CodeGroup>

```json Response theme={null}
{ "deleted": true }
```

A missing document returns `404 document_not_found`.

## Delete many

`POST /namespaces/:namespace/documents/delete`

Deletes documents by id or by filter.

<CodeGroup>
  ```bash curl theme={null}
  curl https://api.conare.ai/namespaces/docs/documents/delete \
    -H "Authorization: Bearer $CONARE_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"ids": ["refunds", "shipping"]}'

  curl https://api.conare.ai/namespaces/docs/documents/delete \
    -H "Authorization: Bearer $CONARE_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"filter": {"team": "support"}}'
  ```

  ```ts TypeScript theme={null}
  await docs.deleteMany(["refunds", "shipping"]); // number deleted
  await docs.deleteWhere({ team: "support" });    // number deleted
  ```
</CodeGroup>

```json Response theme={null}
{ "deleted": 2, "more": false }
```

### Request

Send `ids` or `filter`, not both.

* `ids` (array): 1-1,000 document ids. Missing ids are skipped.
* `filter` (object): A [metadata filter](/filters) with at least one condition.

### Response

* `deleted`: How many documents this call deleted.
* `more`: `true` if a filter still matches documents. A filter call deletes in batches, so send it
  again until `more` is `false`. The SDK's `deleteWhere` does this for you.

<Warning>
  Filter keys aren't checked. A misspelled key matches nothing, so nothing is deleted.
</Warning>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.