Skip to main content

Delete Document

Permanently delete a document or session.

Delete Document

Remove a specific document from a session.

Endpoint

DELETE /api/v3/speech-to-text/session/{sessionId}/document/{documentId}

Response

Status: 204 No Content or 200 OK

Examples

cURL

curl -X DELETE https://api.scriptix.io/api/v3/speech-to-text/session/sess_abc123/document/doc_xyz789 \
-H "Authorization: Bearer YOUR_API_KEY"

Python

import requests

response = requests.delete(
'https://api.scriptix.io/api/v3/speech-to-text/session/sess_abc123/document/doc_xyz789',
headers={'Authorization': 'Bearer YOUR_API_KEY'}
)

if response.status_code in [200, 204]:
print("Document deleted successfully")

JavaScript

const response = await fetch(
'https://api.scriptix.io/api/v3/speech-to-text/session/sess_abc123/document/doc_xyz789',
{
method: 'DELETE',
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
}
);

if (response.ok) {
console.log('Document deleted');
}

Delete Entire Session

Remove a session and all its associated documents.

Endpoint

DELETE /api/v3/speech-to-text/session/{sessionId}

Response

Status: 204 No Content or 200 OK

Examples

cURL

curl -X DELETE https://api.scriptix.io/api/v3/speech-to-text/session/sess_abc123 \
-H "Authorization: Bearer YOUR_API_KEY"

Python

response = requests.delete(
'https://api.scriptix.io/api/v3/speech-to-text/session/sess_abc123',
headers={'Authorization': 'Bearer YOUR_API_KEY'}
)

if response.status_code in [200, 204]:
print("Session and all documents deleted successfully")

Delete Comments

Remove individual comments from a document.

Endpoint

DELETE /api/v3/speech-to-text/session/{sessionId}/document/{documentId}/comments/{commentId}

Example

curl -X DELETE https://api.scriptix.io/api/v3/speech-to-text/session/sess_abc123/document/doc_xyz789/comments/comment_456 \
-H "Authorization: Bearer YOUR_API_KEY"

Error Responses

See Error Handling for complete error reference.

Common errors:

  • 404: Document not found
  • 403: Insufficient permissions
  • 401: Unauthorized

Important Notes

⚠️ Deletion is Permanent

Deleted documents cannot be recovered. Ensure you have backups if needed before deletion.

Cache Invalidation

After deletion, the API automatically:

  • Removes the document from query cache
  • Invalidates folder listings
  • Prevents 404 errors on the deleted document

Permissions

You can only delete documents you have permission to access:

  • Owner: Full deletion rights
  • Organization members: Based on role permissions
  • Shared link users: Cannot delete (unless explicitly granted)

Best Practices

  • Confirm with users before deletion
  • Check permissions before showing delete option
  • Handle 404 gracefully (document may already be deleted)
  • Consider archiving or marking as finished instead of permanent deletion
  • Export backup before deletion if needed