Skip to main content

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

ParameterTypeDescription
collection_idstringThe unique identifier for the collection.
record_idstringThe unique identifier for the record.

Header Parameters

All TaskingAI API requests require the following headers:

HeaderTypeDescription
Content-TypestringThe content type of the request. Set to application/json.
AuthorizationstringAPI 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

ParameterTypeRequiredDescription
typestringYesThe type of record. Possible values are "text", "file", or "web".
titlestringNoThe title of the record, limited to 256 characters.
file_idstringConditionalThe file ID, only acceptable when the type is "file". Obtain the file_id by uploading file separately.
urlstringConditionalThe URL of the webpage, only acceptable when the type is "web".
contentstringConditionalThe text content of the record, only acceptable when the type is "text".
text_splitterobjectNoDefines how the text is split into chunks. Learn more
metadataobject (key-value pairs)NoMetadata 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

ParameterTypeRequiredDescription
typestringYesSet to "qa_sheet" to indicate that this is a QA record.
file_idstringYesThe file ID for the uploaded Q&A sheet. Obtain the file_id by uploading the file separately.
metadataobject (key-value pairs) or nullNoMetadata 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
}
}