import requests
url = "https://eu.app.clarifeye.ai/api/v1/projects/{project_id}/documents/{document_id}/metadata-add/"
payload = {
"key": "category",
"value": "Finance"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"file": "<string>",
"content_type": "application/pdf",
"computed_pdf_file": "<string>",
"source": "upload",
"source_metadata": {},
"page_count": 123,
"file_size": 123,
"metadata": [
[
"category",
"Finance"
],
[
"region",
"EMEA"
]
],
"collection": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"slug": "<string>",
"name": "<string>"
},
"status": "active",
"created_at": "2023-11-07T05:31:56Z",
"created_by": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"email": "[email protected]"
}
}{
"error": "Authentication credentials were not provided."
}{
"error": "You do not have permission to perform this action."
}{
"error": "Not found."
}Add metadata to a document
Add metadata to a document. Accepts either a single {key, value} pair or a
list of {key, value} pairs in one request. Each pair is appended to the document’s
existing metadata list.
Metadata is stored as a list of [key, value] string pairs. A document can have
multiple values for the same key.
import requests
url = "https://eu.app.clarifeye.ai/api/v1/projects/{project_id}/documents/{document_id}/metadata-add/"
payload = {
"key": "category",
"value": "Finance"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"file": "<string>",
"content_type": "application/pdf",
"computed_pdf_file": "<string>",
"source": "upload",
"source_metadata": {},
"page_count": 123,
"file_size": 123,
"metadata": [
[
"category",
"Finance"
],
[
"region",
"EMEA"
]
],
"collection": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"slug": "<string>",
"name": "<string>"
},
"status": "active",
"created_at": "2023-11-07T05:31:56Z",
"created_by": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"email": "[email protected]"
}
}{
"error": "Authentication credentials were not provided."
}{
"error": "You do not have permission to perform this action."
}{
"error": "Not found."
}Authorizations
Use Authorization: Bearer
Path Parameters
UUID of the project
UUID of the document
Response
Metadata added successfully
Document filename
URL to the document file
MIME type of the document
"application/pdf"
URL to generated PDF version (if applicable)
Origin of the document
upload, connector Metadata about the document source
Number of pages in the document
File size in bytes
List of key-value metadata pairs. Each element is a two-element array [key, value].
2 elements[["category", "Finance"], ["region", "EMEA"]]
The collection this document belongs to (the membership foreign key); null
means the "Default" (uncategorised) bucket. A mirrored ["tag", slug] pair is
also kept on metadata. Move a document with the set-collection action.
Show child attributes
Show child attributes
Document deletion status
active, deleting, deleted When the document was added to the project.
The user who uploaded the document. Only returned to callers with admin permission
on the project; null for non-admin callers. Also null for connector-imported
documents (which are attributed to the connector, not a person) and for documents
created before this was tracked.
Show child attributes
Show child attributes