Permanently delete documents and all extracted data via the Doc-Vision REST API
DocVision 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.doc-vision.com/api/webhook/{webhookId}/document/delete
Where {webhookId} is your unique webhook identifier.
Example:
POST https://app.doc-vision.com/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.doc-vision.com/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.doc-vision.com/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.doc-vision.com/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 stringNo. The delete operation is permanent and irreversible. All associated data - including extracted fields, search index entries, reconciliation links, and stored files - are removed immediately. Always verify the document ID before deleting.
If a document is deleted while still being processed, any pending webhook callbacks for that document will not be sent. If the document was already processed, existing callback data in your systems is unaffected.
Currently, the API supports deleting one document per request. For bulk deletions, make multiple API calls with different docId values. Consider implementing rate limiting in your client to avoid overwhelming the endpoint.
The deletion removes all traces of the document from the system. If you need an audit trail, we recommend logging the documentId and deletion timestamp in your own system before calling the delete endpoint.
On This Page
OverviewHow It WorksWebhook URL FormatAPI ReferenceEndpointAuthenticationRequest BodyResponse FormatCode ExamplesJavaScript/TypeScriptPythoncURLBest PracticesTroubleshooting401 Unauthorized404 Not Found400 Bad RequestFrequently Asked QuestionsCan I recover a deleted document?What happens to webhook callbacks for deleted documents?Can I delete multiple documents at once?Is deletion audited?Next Steps