Skip to Content

Data Source

Create data source

POST /v2/team/datasets/{id}/datasources

Create a data source in a specified dataset. You can only create data sources in datasets that you have created.

The data source can be in one of the following formats: .csv, .tsv, .md, .mdx, .json, .txt, .pdf, .pptx, .ppt, .doc, .docx, .xls, or .xlsx.

Body Request Parameters

{ "name": "test.csv", "type": "FILE", "user_id": "tmm-dsfasdfasdfa", "url": "https://s3.amazonaws.com/xxxtest/user/clvl4cad2001q01l1m522hxlu/upload/f9773f1e-cd68-489a-8121-d566ca9218b1.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20240924T143419Z&X-Amz-SignedHeaders=host&X-Amz-Expires=599&X-Amz-Credential=AKIARLSQLXURHEIDN4OZ%2F20240924%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=9ca0c58d508926a5811818041d557ffb53c64025dae94c0855280d457c7089a2" }

Request Parameters

NameLocationTypeRequiredChinese NameDescription
idpathstringYesTarget dataset ID.
x-pd-external-trace-idheaderstringNoTrace ID set in your local system, supports up to 128 characters. If an error occurs in the request, provide this ID to the MAXIR AI team for troubleshooting.
bodybodyobjectNonone
» namebodystringYesData source name, must include the file extension (e.g., example.csv), supports up to 128 characters. If it exceeds this limit, the name will be truncated for display.
» typebodystringYesFILEThe type of the data source. Set to FILE.
» urlbodystringNoThe file URL for public access.
» file_object_keybodystringNoThe object storage path of the file uploaded locally.
» user_idbodystringYesUser ID, which is your unique identity in the organization.

Detailed Explanation

id: Target dataset ID.

To query the list of datasets you have access to, call the GET /v2/team/datasets interface.

» url: File URL for public access.

Either url or file_object_key must be specified, but not both.

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

» file_object_key: The object storage path of the file uploaded locally.

Either url or file_object_key must be specified, but not both.

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

How to obtain the file’s file_object_key:

When using the Upload file interface to complete the file upload, the file_object_key of the file will be returned.

Example Response

{ "code": 0, "data": { "id": "datasource-cadsgfsdagasgadsg", "dataset_id": "dataset-dagasdgasgasg", "name": "test.csv", "type": "FILE", "status": "synching" } }

Response

Status CodeStatus Code MeaningDescriptionData Model
200OKnoneInline

Response Data Structure

Status Code 200

NameTypeRequiredConstraintChinese NameDescription
» codeintegertruenoneStatus code. 0 indicates a successful operation. Other values indicate an operation failure. For troubleshooting, refer to Error Codes.
» dataobjecttruenoneData source object.
»» idstringtruenoneData source ID, which is the unique identifier of this data source in the dataset.
»» dataset_idstringtruenoneThe ID of the dataset to which the data source belongs.
»» namestringtruenoneData source name.
»» typestringtruenoneData source type, fixed as FILE.
»» statusstringtruenoneProcessing status of the data source. Possible values are:

- invalid: Pending processing.
- synching: Processing.
- synched: Successfully synchronized.

Enumeration Values

PropertyValue
typeFILE
statussynching
statussynched
statusinvalid

Response Header

StatusHeaderTypeFormatDescription
200x-pd-trace-idstringTrace ID returned by MAXIR AI. In case of an error in the request, this ID can be provided to the MAXIR AI team for troubleshooting.

List data sources

GET /v2/team/datasets/{id}/datasources

Return the list of data sources in the specified dataset. When using this interface, please note:

  • Ensure the specified dataset and your API Key belong to the same project.
  • To view datasets you have access to within the project, call the GET /v2/team/datasets interface.

Request Parameters

NameLocationTypeRequiredChinese NameDescription
idpathstringYesTarget dataset ID.
page_numberqueryintegerNoStart page number for paginated results. If not specified, the default value 1 is used.
page_sizequeryintegerNoNumber of records returned per page. If not specified, the default value 10 is used.
statusquerystringNoData source status. If this parameter is specified, only data sources in the specified status will be returned. Optional values include:
user_idquerystringYesUser ID, which is your unique identity in the organization.
x-pd-external-trace-idheaderstringNoTrace ID set in your local system, supports up to 128 characters. If an error occurs in the request, provide this ID to the MAXIR AI team for troubleshooting.

Detailed Explanation

id: Target dataset ID.

To query the list of datasets you have access to, call the GET /v2/team/datasets interface.

status: Data source status. If this parameter is specified, only data sources in the specified status will be returned. Optional values include:

  • invalid: Pending processing.
  • synching: Processing.
  • synched: Successfully synchronized.

If not specified, all data sources will be returned.

Multiple statuses can be specified as a comma-separated list, and any matching status’s data source will be returned.

Enumeration Values

PropertyValue
statussynching
statusinvalid
statussynched

Example Response

{ "code": 0, "data": { "total_items": 1, "page_size": 10, "page_number": 1, "records": [ { "id": "datasource-cadsgfsdagasgadsg", "dataset_id": "dataset-dagasdgasgasg", "name": "test.csv", "type": "FILE", "status": "synching" } ] } }

Response

Status CodeStatus Code MeaningDescriptionData Model
200OKnoneInline

Response Data Structure

Status Code 200

NameTypeRequiredConstraintChinese NameDescription
» codeintegertruenoneStatus code. 0 indicates a successful operation. Other values indicate an operation failure. For troubleshooting, refer to Error Codes.
» dataobjecttruenonePaginated list of data sources.
»» total_itemsintegertruenoneTotal number of data sources returned.
»» page_sizeintegertruenoneNumber of data sources returned per page.
»» page_numberintegertruenonePage number of the current page.
»» recordsobjecttruenoneList of data sources returned on the current page.
»»» idstringtruenoneData source ID, which is the unique identifier of this data source in the dataset.
»»» dataset_idstringtruenoneThe ID of the dataset to which the data source belongs.
»»» namestringtruenoneData source name.
»»» typestringtruenoneData source type, fixed as FILE.
»»» statusstringtruenoneProcessing status of the data source. Possible values are:

- invalid: Pending processing.
- synching: Processing.
- synched: Successfully synchronized.

Enumeration Values

PropertyValue
typeFILE
statussynching
statussynched
statusinvalid

Response Header

StatusHeaderTypeFormatDescription
200x-pd-trace-idstringTrace ID returned by MAXIR AI. In case of an error in the request, this ID can be provided to the MAXIR AI team for troubleshooting.

Delete data source

DELETE /v2/team/datasets/{dataset_id}/datasources/{datasource_id}

Delete a data source from the specified dataset. Once deleted, the data source cannot be recovered.

You can only delete data sources in your own datasets.

Body Request Parameters

{ "user_id": "tmm-dafasdfasdfasdf" }

Request Parameters

NameLocationTypeRequiredChinese NameDescription
dataset_idpathstringYesTarget dataset ID.
datasource_idpathstringYesID of the data source to delete.
x-pd-external-trace-idheaderstringNoTrace ID set in your local system, supports up to 128 characters. If an error occurs in the request, provide this ID to the MAXIR AI team for troubleshooting.
bodybodyobjectNonone
» user_idbodystringYesUser ID, which is your unique identity in the organization.

Detailed Explanation

dataset_id: Target dataset ID.

To query the list of datasets you have access to, call the GET /v2/team/datasets interface.

datasource_id: ID of the data source to delete.

To query the data sources in a specified dataset, call the GET /v2/team/datasets/{id}/datasources interface.

Example Response

200 Response

{ "code": 0, "data": {} }

Response

Status CodeStatus Code MeaningDescriptionData Model
200OKnoneInline

Response Data Structure

Status Code 200

NameTypeRequiredConstraintChinese NameDescription
» codeintegertruenoneStatus code. 0 indicates a successful operation. Other values indicate an operation failure. For troubleshooting, refer to Error Codes.
» dataobject¦nullfalsenoneReturns null if the operation is successful.

Response Header

StatusHeaderTypeFormatDescription
200x-pd-trace-idstringTrace ID returned by MAXIR AI. In case of an error in the request, this ID can be provided to the MAXIR AI team for troubleshooting.

Get data source

GET /v2/team/datasets/{dataset_id}/datasources/{datasource_id}

Retrieve information about a specified data source.

Request Parameters

NameLocationTypeRequiredChinese NameDescription
dataset_idpathstringYesThe dataset ID where the target data source is located.
datasource_idpathstringYesThe target data source ID.
user_idquerystringYesUser ID, which is your unique identity in the organization.
x-pd-external-trace-idheaderstringNoTrace ID set in your local system, supports up to 128 characters. If an error occurs in the request, provide this ID to the MAXIR AI team for troubleshooting.

Detailed Explanation

dataset_id: The dataset ID where the target data source is located.

To query the list of datasets you have access to, call the GET /v2/team/datasets interface.

datasource_id: The target data source ID.

To query the data sources in a specified dataset, call the GET /v2/team/datasets/{id}/datasources interface.

Example Response

{ "code": 0, "data": { "id": "datasource-cadsgfsdagasgadsg", "dataset_id": "dataset-dagasdgasgasg", "name": "test.csv", "type": "FILE", "status": "synching" } }

Response

Status CodeStatus Code MeaningDescriptionData Model
200OKnoneInline

Response Data Structure

Status Code 200

NameTypeRequiredConstraintChinese NameDescription
» codeintegertruenoneStatus code. 0 indicates a successful operation. Other values indicate an operation failure. For troubleshooting, refer to Error Codes.
» dataobjecttruenoneData source object.
»» idstringtruenoneData source ID, which is the unique identifier of this data source in the dataset.
»» dataset_idstringtruenoneThe ID of the dataset to which the data source belongs.
»» namestringtruenoneData source name.
»» typestringtruenoneData source type, fixed as FILE.
»» statusstringtruenoneProcessing status of the data source. Possible values are:

- invalid: Pending processing.
- synching: Processing.
- synched: Successfully synchronized.

Enumeration Values

PropertyValue
typeFILE
statussynching
statussynched
statusinvalid

Response Header

StatusHeaderTypeFormatDescription
200x-pd-trace-idstringTrace ID returned by MAXIR AI. In case of an error in the request, this ID can be provided to the MAXIR AI team for troubleshooting.

Create data source without specifying a dataset

POST /v2/team/datasources

This interface is used to create a data source directly without specifying a dataset.

When invoking this interface, MAXIR AI will automatically create a dataset for the data source. Please save the dataset ID in the response for future operations, such as associating the dataset with a job for data analysis and exploration.

Body Request Parameters

{ "name": "test.csv", "type": "FILE", "user_id": "tmm-dafasdfasdfasdf", "file_object_key": "/tmp/sdgsagdsgsadgasdg" }

Request Parameters

NameLocationTypeRequiredChinese NameDescription
x-pd-external-trace-idheaderstringNoTrace ID set in your local system, supports up to 128 characters. If an error occurs in the request, provide this ID to the MAXIR AI team for troubleshooting.
bodybodyobjectNonone

Example Response

{ "code": 0, "data": { "id": "datasource-cadsgfsdagasgadsg", "dataset_id": "dataset-dagasdgasgasg", "name": "test.csv", "type": "FILE", "status": "synching" } }

Response

Status CodeStatus Code MeaningDescriptionData Model
200OKnoneInline

Response Data Structure

Status Code 200

NameTypeRequiredConstraintChinese NameDescription
» codeintegertruenoneStatus code. 0 indicates a successful operation. Other values indicate an operation failure. For troubleshooting, refer to Error Codes.
» dataobjecttruenoneData source object.
»» idstringtruenoneData source ID, which is the unique identifier of this data source in the dataset.
»» dataset_idstringtruenoneThe ID of the dataset to which the data source belongs.
»» namestringtruenoneData source name.
»» typestringtruenoneData source type, fixed as FILE.
»» statusstringtruenoneProcessing status of the data source. Possible values are:

- invalid: Pending processing.
- synching: Processing.
- synched: Successfully synchronized.

Enumeration Values

PropertyValue
typeFILE
statussynching
statussynched
statusinvalid

Response Header

StatusHeaderTypeFormatDescription
200x-pd-trace-idstringTrace ID returned by MAXIR AI. In case of an error in the request, this ID can be provided to the MAXIR AI team for troubleshooting.

Presign data source

POST /v2/team/datasets/{dataset_id}/datasources/{datasource_id}/presign

This interface is used to generate a pre-signed URL (Presigned URL) for the specified data source, allowing you to download the corresponding data source through this URL.

The pre-signed URL has an expiration period, so be sure to complete the download of the data source before the URL expires.

Body Request Parameters

{ "expires_in": 600, "user_id": "tmm-dafasdfasdfasdf" }

Request Parameters

NameLocationTypeRequiredChinese NameDescription
dataset_idpathstringYesThe dataset ID where the target data source is located.
datasource_idpathstringYesThe target data source ID.
x-pd-external-trace-idheaderstringNoTrace ID set in your local system, supports up to 128 characters. If an error occurs in the request, provide this ID to the MAXIR AI team for troubleshooting.
bodybodyobjectNonone
» expires_inbodyintegerNoExpiration time of the pre-signed URL, in seconds (s). The minimum value is 60, and the default value is 600.
» user_idbodystringYesUser ID, which is your unique identity in the organization.

Detailed Explanation

dataset_id: The dataset ID where the target data source is located.

To query the list of datasets you have access to, call the GET /v2/team/datasets interface.

datasource_id: The target data source ID.

To query the data sources in a specified dataset, call the GET /v2/team/datasets/{id}/datasources interface.

Example Response

{ "code": 0, "data": { "presigned_url": "string", "expires_at": "2024-11-13T14:15:22.123Z" } }

Response

Status CodeStatus Code MeaningDescriptionData Model
200OKnoneInline

Response Data Structure

Status Code 200

NameTypeRequiredConstraintChinese NameDescription
» codeintegertruenoneStatus code. 0 indicates a successful operation. Other values indicate an operation failure. For troubleshooting, refer to Error Codes.
» dataobjecttruenoneReturned data object.
»» presigned_urlstringtruenonePre-signed URL for downloading the corresponding data source.
»» expires_atstring(date-time)truenoneExpiration date and time of the pre-signed URL.

Response Header

StatusHeaderTypeFormatDescription
200x-pd-trace-idstringTrace ID returned by MAXIR AI. In case of an error in the request, this ID can be provided to the MAXIR AI team for troubleshooting.