Update Record
This endpoint allows you to update the details of an existing record within a specific knowledge collection in TaskingAI. The record type, title, content, and metadata can be modified. Text Records and QA Records have slightly different requirements for updating, and Text Splitters can be used to manage large text data by breaking it into smaller chunks.
Endpoint
- Method:
POST
- URL:
https://api.tasking.ai/v1/collections/{collection_id}/records/{record_id}
Path Parameters
Parameter | Type | Description |
---|---|---|
collection_id | string | The unique identifier for the collection. |
record_id | string | The unique identifier for the record. |
Header Parameters
All TaskingAI API requests require the following headers:
Header | Type | Description |
---|---|---|
Content-Type | string | The content type of the request. Set to application/json . |
Authorization | string | API key for authorization in the format Bearer $TASKINGAI_API_KEY . The key can be obtained in the project settings in your TaskingAI console. |
Update Record in Text Collection
Text records can be updated with new text content, a URL to scrape web content, or a new file. Additionally, you can specify a text splitter to divide the content into smaller chunks for optimized processing.
Payload Parameters
Parameter | Type | Required | Description |
---|---|---|---|
type | string | Yes | The type of record. Possible values are "text" , "file" , or "web" . |
title | string | No | The title of the record, limited to 256 characters. |
file_id | string | Conditional | The file ID, only acceptable when the type is "file" . Obtain the file_id by uploading file separately. |
url | string | Conditional | The URL of the webpage, only acceptable when the type is "web" . |
content | string | Conditional | The text content of the record, only acceptable when the type is "text" . |
text_splitter | object | No | Defines how the text is split into chunks. Learn more |
metadata | object (key-value pairs) | No | Metadata for the record, which can store up to 16 key-value pairs, each key length < 64 and value length < 512. |
Request Example
{
"type": "text",
"content": "Updated content",
"title": "Updated Record Title",
"text_splitter": {
"type": "token",
"chunk_size": 200,
"chunk_overlap": 20
},
"metadata": {
"author": "John Doe",
"source": "Updated"
}
}
Response Example
{
"status": "success",
"data": {
"object": "Record",
"record_id": "record_1",
"collection_id": "collection_1",
"status": "ready",
"num_chunks": 1,
"type": "text",
"content": "Updated content",
"title": "Updated Record Title",
"metadata": {
"author": "John Doe",
"source": "Updated"
},
"updated_timestamp": 1730210035453,
"created_timestamp": 1730210035453
}
}
Update Record in QA Collection
QA records are structured as question-and-answer pairs and are updated by uploading a new .csv
or .xlsx
file.
Text splitters are not required for QA records.
Payload Parameters
Parameter | Type | Required | Description |
---|---|---|---|
type | string | Yes | Set to "qa_sheet" to indicate that this is a QA record. |
file_id | string | Yes | The file ID for the uploaded Q&A sheet. Obtain the file_id by uploading the file separately. |
metadata | object (key-value pairs) or null | No | Metadata for the record, which can store up to 16 key-value pairs, each key length < 64 and value length < 512. |
Request Example
{
"type": "qa_sheet",
"file_id": "YOUR_QA_SHEET_FILE_ID",
"metadata": {"category": "FAQ"}
}
Response Example
{
"status": "success",
"data": {
"object": "Record",
"record_id": "record_1",
"collection_id": "collection_1",
"status": "creating",
"num_chunks": 5,
"type": "qa_sheet",
"metadata": {"category": "FAQ"}
"updated_timestamp": 1730210035453,
"created_timestamp": 1730210035453
}
}