Replace metadata for a file in a space
Replaces the metadata fields of a file within a space with the provided set.
You must provide the space ID and file ID in the path and the user ID, tenant ID in the headers.
Behavior:
- The payload is the complete metadata set: any existing field whose key is not included is removed.
- Send an empty array to clear all metadata.
aiExtractedmarks whether the value was produced by AI (defaults tofalse).
Validation:
- Each
keyis required and must be non-empty. - Each
valueis required and must be a non-empty string (nullis not allowed). - Keys must be unique within the payload.
- A maximum of 15 fields is allowed.
Access Control:
Access to update file metadata in a space depends on your permissions and the space's visibility:
- Private Spaces: Only accessible by the space owner
- Public Spaces: Accessible by all users within the same tenant
Authorization
ApiTokenAuth PRODUCTAPI Key with role based permission
In: header
Scope: PRODUCT
Path Parameters
The unique identifier of the space containing the file
The unique identifier of the file whose metadata is being replaced
Header Parameters
The ID of the user requesting the update
The ID of the tenant
Request Body
application/json
The full set of metadata fields to store for the file
TypeScript Definitions
Use the request body type in TypeScript.
The full set of metadata fields for the file. This replaces the current metadata: any existing field whose key is not present in the payload is removed. Send an empty array to clear all metadata.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
curl -X PATCH "https://example.com/v1/spaces/497f6eca-6276-4993-bfeb-53cbbbba6f08/files/497f6eca-6276-4993-bfeb-53cbbbba6f08/metadata" \ -H "x-user-id: string" \ -H "x-tenant-id: string" \ -H "Content-Type: application/json" \ -d '[ { "key": "author", "value": "Jane Doe", "aiExtracted": false }, { "key": "topic", "value": "finance", "aiExtracted": true }, { "key": "fiscal_year", "value": "2023" } ]'{
"id": "123e4567-e89b-12d3-a456-426614174000",
"summary": "Quarterly financial overview",
"language": "en",
"documentKind": "Report",
"domain": "Finance",
"tags": [
{
"key": "author",
"value": "Jane Doe",
"aiExtracted": false
},
{
"key": "topic",
"value": "finance",
"aiExtracted": true
},
{
"key": "fiscal_year",
"value": "2023",
"aiExtracted": false
}
]
}{
"message": {
"description": "Validation failed",
"errors": [
{
"path": "body.0.key",
"message": "Key is required"
}
]
}
}{
"message": "Invalid API Key"
}{
"message": "API Key does not have permission to access this resource"
}{
"message": "Space not found"
}{
"message": "Internal Server Error"
}