Manage documents
Look up a document, replace it with a new version, or delete it.
Look up a document
Use the document_uuid from a search result to get a document’s title and path:
curl --cert client_cert.pem --key client_key.pem --cacert ca_root_cert.pem \
https://api.knovas.ch:8443/secured/document/550e8400-e29b-41d4-a716-446655440000import requests
BASE = "https://api.knovas.ch:8443"
AUTH = dict(
cert=("client_cert.pem", "client_key.pem"), # your certificate and private key
verify="ca_root_cert.pem", # Knovas' certificate
timeout=60,
)
document_uuid = "550e8400-e29b-41d4-a716-446655440000" # from a search result
r = requests.get(f"{BASE}/secured/document/{document_uuid}", **AUTH)
r.raise_for_status()
print(r.json()["document"]["title"])Update a document
Upload it again with the same identifier. The new version replaces the old one. See Add documents.
Delete one document
Delete a document by its identifier. Its text and search data are removed.
curl -X DELETE https://api.knovas.ch:8443/secured/delete_information_object \
--cert client_cert.pem --key client_key.pem --cacert ca_root_cert.pem \
-H "Content-Type: application/json" \
-d '{"pointer": "reports/2025/q3.pdf"}'import requests
BASE = "https://api.knovas.ch:8443"
AUTH = dict(
cert=("client_cert.pem", "client_key.pem"), # your certificate and private key
verify="ca_root_cert.pem", # Knovas' certificate
timeout=60,
)
r = requests.delete(f"{BASE}/secured/delete_information_object", **AUTH, json={
"pointer": "reports/2025/q3.pdf",
})
r.raise_for_status()If the identifier does not exist, you get 404.
Delete all documents
This erases every document you have uploaded. Neither you nor Knovas can bring them back. You would have to upload them again.
As a safety check, you must repeat your own account number (client_id). You got it when you signed up, and it is also written in your certificate. Both examples read it for you:
# Your account number is the id in the OU field of your certificate
CLIENT_ID=$(openssl x509 -in client_cert.pem -noout -subject -nameopt multiline \
| grep organizationalUnitName | grep -oE '[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}')
curl -X DELETE https://api.knovas.ch:8443/secured/delete_all_documents \
--cert client_cert.pem --key client_key.pem --cacert ca_root_cert.pem \
-H "Content-Type: application/json" \
-d "{\"confirm_client_id\": \"$CLIENT_ID\"}"import requests
BASE = "https://api.knovas.ch:8443"
AUTH = dict(
cert=("client_cert.pem", "client_key.pem"), # your certificate and private key
verify="ca_root_cert.pem", # Knovas' certificate
timeout=60,
)
import re
# Your account number is the id in the OU field of your certificate
info = requests.get(f"{BASE}/secured/cert-info", **AUTH).json()["certificate"]
client_id = re.search(r"[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}", info["organisational_unit"]).group()
r = requests.delete(f"{BASE}/secured/delete_all_documents", **AUTH, json={
"confirm_client_id": client_id,
})
r.raise_for_status()
print(r.json())If the number does not match, nothing is deleted.
| Deleted | Kept |
|---|---|
| All documents, all versions and their search data | Your account, certificates and access groups. You can upload again right away. |
| Your ratings and feedback | Usage and billing records (they count requests, never contents) |
| Uploads that were still in progress |
To close your account and erase everything, including usage records, contact Knovas.
Questions? Write to contact@knovas.ch.
This page describes Knovas 1.3.0. Last updated .