Skip to main content

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:

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

ParameterTypeRequiredDescription
purposestringYesThe 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).
filefile (binary data)YesThe 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. This file_id can be used to create records associated with the uploaded file.