Skip to main content

Document Handling

Documents can be uploaded to Cape's secure vector store in order to utilize vector search features.

Security and Privacy

All documents are uploaded using a secure connection to our service running in an enclave. The documents are then encrypted using a key only accessible from within the enclave, and saved to our vector store. No Cape employee is able to view the unencrypted document contents or access the enclave's key. This means that your documents can be safely uploaded in unredacted form in order to take full advantage of the vector search capabilities. When retrieving your document you have the ability to retrieve in either a plaintext or redacted form.

Keys

Documents are organized by key where all documents under a key can be searched together. This allows for groupings of documents into relevant contexts as well as separating unrelated data. Keys are automatically created when a document is uploaded under it.

To list all the created keys for your account you can use the list keys endpoint https://api.capeprivacy.com/v1/keys. Keys can be removed individually using the API as well.

To list all documents under a key my_key use https://api.capeprivacy.com/v1/keys/my_key/uploads

Uploading a file

Here we are uploading the file my_file.pdf under the key my_key

import os
import requests

with open('my_file.pdf', 'rb') as f:
resp = requests.post(
"https://api.capeprivacy.com/v1/keys/my_key/uploads/file",
headers={"Authorization": f"Bearer {os.getenv('CAPE_API_KEY')}"},
files={"file": f}
)

Uploading Text

Here we are uploading the text my_content to a document tited my_filename under the key my_key

import os
import requests

resp = requests.post(
"https://api.capeprivacy.com/v1/keys/my_key/uploads/text",
headers={"Authorization": f"Bearer {os.getenv('CAPE_API_KEY')}"},
json={"filename": "my_filename", "content": "my_content"}
)

Retrieving a Document

The contents of a document can be retrieved in either their plaintext or redacted form using the optional format query parameter.

import os
import requests

params = {
'format': 'redacted',
}
resp = requests.get(
"https://api.capeprivacy.com/v1/keys/my_key/uploads/my_doc_id",
headers={"Authorization": f"Bearer {os.getenv('CAPE_API_KEY')}"},
params=params
)