Retrieve a paginated list of all documents you have access to in your Paradigm instance. This endpoint supports filtering by workspace, pagination, and scope management.
Prerequisites
- A Paradigm API key: if you do not have one, go to your Paradigm profile and generate a new API key.
- Access to documents: You need appropriate permissions to view documents in your instance.
Usage methods
There are several ways to call the endpoint:
- With the python
requests
package (recommended)
- Through a curl request: for quick testing or first-time use
Python requests
package
You can directly 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")
response = requests.get(
url=f"{base_url}/files",
headers={
'Authorization': f"Bearer {api_key}"
},
)
print(response.json())
The Paradigm API key and base URL are configured using environment variables. For private instances, set PARADIGM_BASE_URL
to your instance’s URL. See Instance Configuration for details.
The method returns a json
object containing the paginated list of documents:
{
"next": null,
"previous": null,
"count": 1,
"data": [
{
"id": <file_id: int>,
"object": "file",
"created_at": <epoch_time: int>,
"filename": <file_name: str>,
"purpose": "documents",
"status": "embedded"
}
],
"object": "list"
}
The number of documents per page is set to 20 and cannot be modified.
To get documents from a specific page, use the extra_query
parameter:
# Get the second page of documents
response = requests.get(
url=f"{base_url}/files",
headers={
'Authorization': f"Bearer {api_key}"
},
params={"page":"2"}
)
Filtering by Document Scope
Documents can be stored in three different spaces:
- Private space: Only accessible to the user
- Company space: Accessible to all company members
- Workspace: Accessible to specific workspace members
Filter documents using scope parameters:
# Filter for private documents and workspace #2
response = requests.get(
url=f"{base_url}/files",
headers={
'Authorization': f"Bearer {api_key}"
},
params={
"company_scope": False,
"private_scope": True,
"workspace_scope": 2,
}
)
By default, documents from all accessible scopes are returned. Use scope filters to narrow results to specific document collections.
cURL request
If you prefer sending a request to Paradigm with a simple cURL command, here is an example:
curl --request GET \
--url $PARADIGM_BASE_URL/files \
--header 'Authorization: Bearer <token>'