Upload File
This endpoint allows you to upload a file to TaskingAI, which can then be used in creating records within collections.
Endpoint
- Method:
POST
- URL:
https://api.tasking.ai/v1/files
- Content-Type:
multipart/form-data
Header Parameters
All TaskingAI API requests require the following headers:
Header | Type | Description |
---|---|---|
Content-Type | string | The content type of the request. Set to multipart/form-data . |
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. |
Payload Parameters
Parameter | Type | Required | Description |
---|---|---|---|
purpose | string | Yes | The purpose of the file upload. Acceptable values are "record_file" (for records in a text collection) or "qa_record_file" (for records in a QA collection). |
file | file (binary data) | Yes | The file to be uploaded. Supported formats vary based on the type of record: .txt , .pdf , .docx , .md , .html for record_file , and .csv , .xlsx for qa_record_file . |
Request Example
curl -X POST https://api.tasking.ai/v1/files \
-H "Authorization: Bearer $TASKINGAI_API_KEY" \
-H "Content-Type: multipart/form-data" \
-F "purpose=record_file" \
-F "file=@/path/to/your/file.pdf"
Response Example
{
"status": "success",
"data": {
"file_id": "xlsx_file1"
}
}
file_id
: The unique identifier for the uploaded file. Thisfile_id
can be used to create records associated with the uploaded file.