Skip to Content

Local File

Upload local file

POST /v2/team/file/upload-datasource

Upload a local file. Supported file formats include: .csv, .tsv, .md, .mdx, .json, .txt, .pdf, .pptx, .ppt, .doc, .docx, .xls, or .xlsx.

You can use this API to upload local files and then use the obtained file_object_key to create a data source.

Body Request Parameters

file: "" user_id: ""

Request Parameters

NameLocationTypeRequiredDescriptionDetails
x-pd-external-trace-idheaderstringNoTrace ID set in your local system, supporting up to 128 characters. When an error occurs, you can provide this ID to the MAXIR AI team to assist in troubleshooting.
bodybodyobjectNonone
» filebodystring(binary)YesThe file to upload. This field is required and should contain the file data. For example, --form 'file=@"/Users/jiaoqi/Downloads/0f9a7ebd-7a2a-454a-8cd9-96accffa3107.csv"'.
» user_idbodystringYesUser ID, which is your unique identity within the organization.

Response Example

{ "code": 0, "data": { "file_object_key": "/tmp/sdgsagdsgsadgasdg.csv" } }

Response Results

Status CodeStatus Code MeaningDescriptionData Model
200OKnoneInline

Response Data Structure

Status Code 200

NameTypeRequiredConstraintDescriptionDetails
» codeintegertruenoneStatus code. 0 indicates success. Other values indicate failure. For error troubleshooting, refer to Error Codes.
» dataobjecttruenoneReturned data object.
»» file_object_keystringtruenoneObject storage path of the file.

Response Header

StatusHeaderTypeFormatDescription
200x-pd-trace-idstringMAXIR AI returned Trace ID. When an error occurs, you can provide this ID to the MAXIR AI team to assist in troubleshooting.