Files
Files are how Clarity LLM's understand your organization and your Patients. These files can be JSON, PDFs, Images, FHIR, HL7, Clincal Data, or any structured or unstructured data. This will give you unprecedented insight into Patients and ask any question or build prompts.
The File model
Properties
- Name
id
- Type
- string
- Description
Unique identifier for the file.
- Name
message_id
- Type
- string
- Description
Unique identifier for the message associated with the file.
List all Files
This endpoint allows you to retrieve a paginated list of all your files (in a conversation if a conversation id is provided). By default, a maximum of ten files are shown per page.
Optional attributes
- Name
conversation_id
- Type
- string
- Description
Limit to files from a given conversation.
- Name
limit
- Type
- integer
- Description
Limit the number of files returned.
Request
curl -G https://api.clarityapp.ai/v1/files \
-H "Authorization: Bearer {token}" \
-d conversation_id="xgQQXg3hrtjh7AvZ" \
-d limit=10
Response
{
"has_more": false,
"data": [
{
"id": "Nc6yKKMpcxiiFxp6",
"message_id": "LoPsJaMcPBuFNjg1",
"filename": "Invoice_room_service__Plaza_Hotel.pdf",
"file_url": "https://assets.protocol.chat/files/Invoice_room_service__Plaza_Hotel.pdf",
"file_type": "application/pdf",
"file_size": 21352,
"created_at": 692233200
},
{
"id": "hSIhXBhNe8X1d8Et"
// ...
}
]
}
Create an file
This endpoint allows you to upload a new file to a conversation. See the code examples for how to send the file to the Clarity API.
Required attributes
- Name
file
- Type
- string
- Description
The file you want to add as an file.
Request
curl https://api.clarityapp.ai/v1/files \
-H "Authorization: Bearer {token}" \
-F file="../Invoice_room_service__Plaza_Hotel.pdf"
Response
{
"id": "Nc6yKKMpcxiiFxp6",
"message_id": "LoPsJaMcPBuFNjg1",
"filename": "Invoice_room_service__Plaza_Hotel.pdf",
"file_url": "https://assets.protocol.chat/files/Invoice_room_service__Plaza_Hotel.pdf",
"file_type": "application/pdf",
"file_size": 21352,
"created_at": 692233200
}
Retrieve an file
This endpoint allows you to retrieve an file by providing the file id. Refer to the list at the top of this page to see which properties are included with file objects.
Request
curl https://api.clarityapp.ai/v1/files/Nc6yKKMpcxiiFxp6 \
-H "Authorization: Bearer {token}"
Response
{
"id": "Nc6yKKMpcxiiFxp6",
"message_id": "LoPsJaMcPBuFNjg1",
"filename": "Invoice_room_service__Plaza_Hotel.pdf",
"file_url": "https://assets.protocol.chat/files/Invoice_room_service__Plaza_Hotel.pdf",
"file_type": "application/pdf",
"file_size": 21352,
"created_at": 692233200
}
Update an file
This endpoint allows you to perform an update on an file. Currently, the only supported type of update is changing the filename.
Optional attributes
- Name
filename
- Type
- string
- Description
The new filename for the file.
Request
curl -X PUT https://api.clarityapp.ai/v1/files/Nc6yKKMpcxiiFxp6 \
-H "Authorization: Bearer {token}" \
-d filename="Invoice_room_service__Plaza_Hotel_updated.pdf"
Response
{
"id": "Nc6yKKMpcxiiFxp6",
"message_id": "LoPsJaMcPBuFNjg1",
"filename": "Invoice_room_service__Plaza_Hotel.pdf",
"file_url": "https://assets.protocol.chat/files/Invoice_room_service__Plaza_Hotel_updated.pdf",
"file_type": "application/pdf",
"file_size": 21352,
"created_at": 692233200
}
Delete an file
This endpoint allows you to delete files. Note: This will permanently delete the file.
Request
curl -X DELETE https://api.clarityapp.ai/v1/files/Nc6yKKMpcxiiFxp6 \
-H "Authorization: Bearer {token}"