Skip to main content

Create Connector

Create a data connector for managing data import sources.

Prerequisites

You have an Alibaba Cloud Model Studio API key (see the API Key page in the console) and authentication configured. For details, see RAG API overview and Authentication. Data import endpoints use the same base URL and authentication as other RAG APIs, with the path prefix /api/v1/connector/dash/.

Endpoint

POST /api/v1/connector/dash/addConnector Create a data connector for managing data import sources.
Only FILE is currently supported for connectorType. When storeType is CUSTOM, you must also pass regionId and bucketName.

Request body

FieldRequiredTypeDescription
connectorTypeYesstringConnector type. Only FILE is supported.
connectorNameYesstringConnector name, 1 to 20 characters.
descriptionYesstringConnector description, 1 to 200 characters.
fileConnectorConfigYesobjectFile connector configuration. Sub-fields: storeType (string, required, storage type — PLATFORM (platform-managed) or CUSTOM (your own OSS)), regionId (string, OSS region ID. Required when storeType is CUSTOM), bucketName (string, OSS bucket name. Required when storeType is CUSTOM).

Request example

curl -X POST "$BASE_URL/api/v1/connector/dash/addConnector" \
  -H "Authorization: Bearer $BAILIAN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "connectorType": "FILE",
    "connectorName": "产品文档连接器",
    "description": "用于导入产品文档的文件连接器",
    "fileConnectorConfig": {
      "storeType": "PLATFORM"
    }
  }'
BASE_URL is https://{workspace_id}.cn-beijing.maas.aliyuncs.com ({workspace_id} is the Workspace ID), and BAILIAN_API_KEY is your Alibaba Cloud Model Studio API key.

Response example

Returns 200 on success.
{
  "code": "Success",
  "status_code": 200,
  "data": {
    "connectorId": "conn_abc123"
  },
  "requestId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}

Response fields

FieldTypeDescription
codestringResponse code. Success on success.
messagestringError or informational message; an empty string on success.
requestIdstringUnique request identifier. Include this ID when reporting an issue.
dataobjectCreation result. Sub-field: connectorId (string, ID of the new connector).
statusintegerBusiness status code. 200 on success, 400 for failures such as invalid parameters. Note that the HTTP status code remains 200 even on failure, so rely on this field and code to determine the result.

Error codes

HTTP status codeError code codeDescription
400InvalidParameterInvalid request parameters. Example message: Required parameter missing or invalid.
401InvalidApiKeyAuthentication failed; the API key is invalid or missing. Example message: Invalid API-key provided.
On business failures the HTTP status code remains 200. Check status and code in the response body to determine the result.
Managed Agent API
Flow Agent API
Sandbox API
Long-term Memory
ParseX API
Security API
Framework Integration