Document Catalog

Upload Document Contents

POST

Request

This endpoint expects an object.
documentName
stringRequired
The name of the document you want to upload.
documentContents
stringRequired
The full LLM-formatted text contents of the document you want to upload.
allowedUsersEmailAddresses
list of stringsRequired
Users allowed to access the document. Unlike Credal's out of the box connectors which reconcile various permissions models from 3rd party software, for custom uploads the caller is responsible for specifying who can access the document and currently flattening groups if applicable. Documents can also be marked as internal public.
uploadAsUserEmail
stringRequired
[Legacy] The user on behalf of whom the document should be uploaded. In most cases, this can simply be the email of the developer making the API call. This field will be removed in the future in favor of purely specifying permissions via allowedUsersEmailAddresses.
documentExternalId
stringRequired
The external ID of the document. This is typically the ID as it exists in its original external system. Uploads to the same external ID will update the document in Credal.
documentExternalUrl
stringOptional
The external URL of the document you want to upload. If provided Credal will link to this URL.
customMetadata
anyOptional
Optional JSON representing any custom metdata for this document
collectionId
stringOptional
If specified, document will also be added to a particular document collection
forceUpdate
booleanOptional
If specified, document contents will be re-uploaded and re-embedded even if the document already exists in Credal
internalPublic
booleanOptional
If specified, document will be accessible to everyone within the organization of the uploader

Response

This endpoint returns an object
documentId
UUID
POST
1curl -X POST https://api.credal.ai/api/v0/catalog/uploadDocumentContents \
2 -H "Authorization: Bearer <apiKey>" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "documentName": "My Document",
6 "documentContents": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
7 "allowedUsersEmailAddresses": [
8 "jack@credal.ai",
9 "ravin@credal.ai"
10 ],
11 "uploadAsUserEmail": "jack@credal.ai",
12 "documentExternalId": "73eead26-d124-4940-b329-5f068a0a8db9"
13}'
200
Successful
1{
2 "documentId": "82e4b12a-6990-45d4-8ebd-85c00e030c24"
3}