---
updatedAt: 2025-09-24T21:43:34.000Z
agentTools:
  projectIndex: https://docs.quable.com/llms.txt
---

# Document - Delete all orphan documents

```python Python
import requests
import json

pimInstance = "MY-PIM"

urlSession = "https://{}.quable.com/api_1.php/sessions".format(pimUrl)
headers = { 'Content-Type': 'application/json' }
payload = {
	'signin': { 'username': '<USERNAME>', 'password': '<PASSWORD>' }
}
response = requests.request("POST", urlSession, headers=headers, data=json.dumps(payload))
auth_response = json.loads(response.text)
headers['Authorization'] = 'Bearer ' + auth_response["oauth"]["access_token"]

urlDocumentList = "https://{}.quable.com/api_1.php/articles/orphelins".format(pimUrl)
response = requests.request("GET", urlDocumentList, headers=headers, data=payload)
response.raise_for_status()
response_dict = json.loads(response.text)

for document in response_dict['rows']:
  documentCode = document['code']
  print(documentCode)
  url = "https://{}.quable.com/api_1.php/documents/{}". format(pimUrl, documentCode)
  response = requests.request("DELETE", url, headers=headers)
  print(response.status_code)
```

```json Response Example
{"success":true}
```

# Import packages

<!-- python@1-3 -->



# Specify the name of your instance

<!-- python@4 -->

Enter the name used in your Quable PIM URL.

# Authentification

<!-- python@5-13 -->

Include your Quable PIM username and password.

# Get orphans

<!-- python@14-18 -->

Retrieve all orphan documents with a GET request.

# Delete orphans

<!-- python@19-25 -->

Delete all orphan documents retrieved in previous step.