POST
/
v2
/
team
/
file
/
upload-datasource
curl --request POST \
  --url https://ai.data.cloud/api/v2/team/file/upload-datasource \
  --header 'Content-Type: multipart/form-data' \
  --header 'x-pd-api-key: <api-key>' \
  --form user_id=
{
  "code": 0,
  "data": {
    "file_object_key": "/tmp/sdgsagdsgsadgasdg.csv"
  }
}

Introduction

You can use this endpoint to upload your local file and then use the file_key you obtained to create a data source through the Create data source endpoint.

Only files with the following extensions are supported: .csv, .tsv, .md, .mdx, .json, .txt, .pdf, .pptx, .ppt, .doc, .docx, .xls, or .xlsx.

For optimal upload efficiency, we recommend using this endpoint for files smaller than 1 MB. For files larger than 1 MB, please initiate a multipart upload task.

Example request:

curl --location 'http://ai.data.cloud/api/v2/team/file/upload-datasource' \
--header 'x-pd-api-key: <api-key>' \
--header 'x-pd-external-trace-id;' \
--header 'Cookie: Cookie_1=value; metabase.DEVICE=f3cb3dbb-ef62-4026-845e-1480431c751d' \
--form 'file=@"/Users/username/Downloads/c5168946-8f1a-4c92-a167-5e3be57745be.csv"' \
--form 'user_id="tmm-cm5ao3yoe00zm01l1u1e7p3pj"'

Example response:

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

Authorizations

x-pd-api-key
string
header
required

Headers

x-pd-external-trace-id
string

The trace ID you set in your system to trace this request. It can be up to 128 characters in length. If the request fails, you can provide it to the Powerdrill team to help with troubleshooting.

Body

multipart/form-data

Response

200 - application/json

The response is of type object.