Skip to main content

Prerequisites

  • A Paradigm API key: if you do not have one, go to your Paradigm profile (/settings/api-key in your instance) and generate a new API key.
  • The desired document ID to delete: You can use the listing method to get the list of uploaded documents and be able to know the ID of the document you want to delete.

Usage methods

There are several ways to call the endpoint:
  1. With the python requests package
  2. Through a curl request: for quick testing or first-time use

Python requests package

You can send request to the API endpoint through the requests package.
import requests
import os

# Get API key and base URL from environment
api_key = os.getenv("PARADIGM_API_KEY")
base_url = os.getenv("PARADIGM_BASE_URL", "https://paradigm.lighton.ai/api/v2")
# File ID to delete
file_id = 1

response = requests.request(
    method="DELETE",
    url=f"{base_url}/files/{file_id}",
    headers={
        'Authorization': f"Bearer {api_key}"
    }
)

print(response.json())
You would then get a JSON answer as a dictionary:
{
    "id": 1,
    "deleted": true
}

cURL request

If you would prefer sending a request to Paradigm with a simple cURL command, here is an example:
curl --request DELETE \
  --url $PARADIGM_BASE_URL/files/1 \
  --header "Authorization: Bearer $PARADIGM_API_KEY"
I