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

# Delete sources

> Delete source records and optionally delete the linked Articles in the same request.

Use this route to remove source records that no longer belong in the workspace.

<Info>
  Deleting a source removes the input record. It only deletes linked Articles if you explicitly set `deleteArticles` to `true`.
</Info>

## Headers

<ParamField header="Authorization" type="string" required>
  Bearer token containing your Fini workspace API key. Format: `Bearer fini_...` The key needs `write` scope.
</ParamField>

<ParamField header="Content-Type" type="string" required>
  `application/json`
</ParamField>

## Body parameters

<ParamField body="documentIds" type="array" required>
  Source IDs to delete.
</ParamField>

<ParamField body="deleteArticles" type="boolean" default={false}>
  Whether linked articles should be deleted too.
</ParamField>

## Response

<ResponseField name="deletedDocuments" type="array">
  Deleted source records.
</ResponseField>

<ResponseField name="deletedArticles" type="array">
  Articles deleted because `deleteArticles` was `true`.
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl --request DELETE \
    --url 'https://api-prod.usefini.com/v2/documents/public' \
    --header 'Authorization: Bearer fini_your_api_key' \
    --header 'Content-Type: application/json' \
    --data '{
      "documentIds": ["5d9f67a8-d853-4af4-b7ce-23ebba1245e5"],
      "deleteArticles": true
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "deletedDocuments": [
      {
        "id": "5d9f67a8-d853-4af4-b7ce-23ebba1245e5",
        "title": "Refund policy",
        "originalUrl": "https://help.example.com/refunds"
      }
    ],
    "deletedArticles": [
      {
        "id": "7f5392e5-dc7d-4558-8860-cf3ea4b32f94",
        "title": "Refund policy",
        "parentFolderId": "0f4da4fe-b2ae-4787-8c3b-854f36d9eb1b"
      }
    ]
  }
  ```
</ResponseExample>

## Errors

<AccordionGroup>
  <Accordion title="400 Bad Request" icon="circle-exclamation">
    The request body is malformed, `documentIds` is missing or empty, or one of the source IDs does not exist.
  </Accordion>

  <Accordion title="401 Unauthorized" icon="lock">
    The API key is missing, malformed, revoked, or invalid.
  </Accordion>

  <Accordion title="403 Forbidden" icon="shield-halved">
    The API key does not include the `write` scope, or the source IDs belong to a different workspace.
  </Accordion>

  <Accordion title="500 Internal Server Error" icon="triangle-exclamation">
    Fini failed while deleting one or more records. Retry once, then inspect the affected IDs in [List sources](/en/api-reference/list-sources).
  </Accordion>
</AccordionGroup>
