1Flow provides a webhook endpoint that allows you to permanently delete documents and all associated data. This operation is irreversible and removes the document, extracted data, search index entries, reconciliation links, and associated files.
This operation permanently deletes the document and all associated data. This action cannot be undone. Use with caution.
When you delete a document:
POST https://app.1flow.io/api/webhook/{webhookId}/document/delete
Where {webhookId} is your unique webhook identifier.
Example:
POST https://app.1flow.io/api/webhook/abc123xyz/document/delete
POST /api/webhook/{webhookId}/document/delete
If a webhook secret is configured, include it in the Authorization header:
Authorization: {your-webhook-secret}
Send a JSON body with the document ID:
{
"docId": "your-document-id"
}
| Field | Type | Required | Description |
|---|---|---|---|
docId | String | Yes | The document ID to delete |
Success Response (200):
{
"success": true,
"message": "Document deleted successfully",
"documentId": "doc_abc123xyz"
}
Error Responses:
401 Unauthorized - Invalid or missing webhook secret404 Not Found - Invalid webhook ID or document not found400 Bad Request - Missing or invalid docId in request bodyExample Error Response:
{
"error": "Missing or invalid docId in request body"
}
async function deleteDocument(
docId: string,
webhookId: string,
secret: string
) {
const response = await fetch(
`https://app.1flow.io/api/webhook/${webhookId}/document/delete`,
{
method: 'POST',
headers: {
'Authorization': secret,
'Content-Type': 'application/json',
},
body: JSON.stringify({
docId: docId,
}),
}
);
const result = await response.json();
if (result.success) {
console.log(`Document ${result.documentId} deleted successfully`);
} else {
console.error('Delete failed:', result.error);
}
return result;
}
import requests
def delete_document(doc_id, webhook_id, secret):
url = f"https://app.1flow.io/api/webhook/{webhook_id}/document/delete"
payload = {
'docId': doc_id
}
headers = {
'Authorization': secret,
'Content-Type': 'application/json'
}
response = requests.post(url, json=payload, headers=headers)
result = response.json()
if result.get('success'):
print(f"Document {result['documentId']} deleted successfully")
else:
print(f"Delete failed: {result.get('error')}")
return result
curl -X POST https://app.1flow.io/api/webhook/{webhookId}/document/delete \
-H "Authorization: {your-webhook-secret}" \
-H "Content-Type: application/json" \
-d '{
"docId": "your-document-id"
}'
Authorization header is included in the requestdocId field is included in the request bodydocId is a valid string