Skip to main content
The Delete Source endpoint allows you to permanently remove documents from your Graphor project using the REST API. This endpoint provides a secure way to clean up your document collection and remove all associated data including parsed elements (partitions), embeddings, and metadata.

Endpoint Overview

HTTP Method

DELETE

Authentication

This endpoint requires authentication using an API token. You must include your API token as a Bearer token in the Authorization header.
Learn how to create and manage API tokens in the API Tokens guide.

Request Format

Headers

Request Body

The request must be sent as JSON with the following field: You can obtain file_id from List sources or from Get build status after an ingestion completes.

Important Considerations

Warning: This operation is irreversible
  • All document content and metadata will be permanently removed
  • Associated partition nodes and embeddings will be deleted
  • No backup or recovery options are available
Identifier required
  • Use the source’s unique file_id (returned by list sources or build status)
  • Use List sources to see all sources and their file_ids

Request Example

Response Format

Success Response (200 OK)

Response Fields

Code Examples

JavaScript/Node.js

Python

cURL

Error Responses

Common Error Codes

Error Response Format

Error Examples

Cause: The specified file doesn’t exist in your projectSolutions:
Cause: API token is invalid, expired, or malformedSolutions:
  • Check your API token format (should start with “grlm_”)
  • Verify the token hasn’t been revoked in the dashboard
  • Ensure correct Authorization header format
Cause: Insufficient permissions or API token doesn’t have accessSolutions:
  • Verify you’re using the correct API token for this project
  • Check that you have delete permissions
  • Contact your project administrator
Cause: Missing file_id in request bodySolutions:

Best Practices

Pre-Deletion Verification

Before deleting documents that are currently processing:
  • Wait for processing to complete when possible
  • Processing documents may be in an inconsistent state
  • Consider the impact on any dependent workflows
  • Monitor processing status using the List Sources endpoint
Before deletion, consider:
  • Which systems depend on this document
  • Impact on downstream processing
  • Whether alternative documents can serve the same purpose
  • Whether you need to re-ingest or reprocess replacement sources

Safety Measures

  • Implement confirmation prompts in interactive applications
  • Log all deletion operations for audit trails
  • Use descriptive variable names to avoid accidental deletions
  • Test with non-production data when implementing deletion features
  • Consider soft deletion patterns for critical applications

Error Handling

  • Implement retry logic for transient network errors (not for 404/403 errors)
  • Validate file_id before making deletion requests
  • Handle batch operations carefully to avoid partial failures
  • Provide clear error messages to end users

Integration Examples

Batch Deletion with Safety Checks

Project Cleanup Tool

File Lifecycle Management

Troubleshooting

Causes: Source doesn’t exist, wrong file_id, or already deletedSolutions:
  • Use List sources to get valid file_ids
  • Verify you’re using the correct project/API token
  • The source may have been deleted by another process
Causes: Invalid token, token revoked, or wrong project accessSolutions:
  • Verify API token format (should start with “grlm_”)
  • Check token status in the Graphor dashboard
  • Ensure token has delete permissions for the project
  • Try regenerating the API token if needed
Causes: Large files, complex cleanup operations, or server loadSolutions:
  • Increase request timeout (60+ seconds recommended)
  • Retry the operation after a short delay
  • Contact support for persistent timeout issues
  • Consider deleting files during off-peak hours
Causes: DNS issues, firewall restrictions, or network timeoutsSolutions:
  • Test connectivity to sources.graphorlm.com
  • Check firewall allows outbound HTTPS traffic
  • Verify DNS resolution is working
  • Try from a different network if issues persist

Next Steps

After successfully deleting your documents:

List sources

Verify the deletion and view remaining sources (with their file_ids)

Upload & ingest

Ingest new files, URLs, GitHub, or YouTube (async)

Reprocess source

Re-process remaining sources with a different partition method (async)

Get build status

Poll status for async ingestion or reprocess