POST
/
v1
/
datasources

Authorizations

x-pd-api-key
string
headerrequired

Headers

x-pd-external-trace-id
string

The external trace ID. The length ranges from 0 to 128 characters.

Body

application/json
fileName
string
required

The file name, preferably including the file extension.

type
string
required

The type of the data source. Set it to FILE.

name
string

The name of the data source. If not provided, it will default to the value of fileName.

url
string

The URL of the file for public access.

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

You must specify either url or fileKey, but not both.

fileKey
string

The object storage path to your locally uploaded file.

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

Each time you upload a file through the Upload file endpoint, its fileKey is returned. For more details, see How to Upload Local Files.

You must specify either url or fileKey, but not both.

Response

200 - application/json
code
integer
required

Status code. 0 indicates that the operation is successful. Otherwise, the operation fails. Possible error codes include:

  • 100: Bad request.
  • 201: Request frequency limit.
  • 9999: Internal error.
  • 100001: Invalid operation.
data
object
required

The returned data object.