Help Center/ AI DataLake/ API Reference/ Agency Management/ Creating a Service Agency
Updated on 2026-11-06 GMT+08:00

Creating a Service Agency

Function

This API is used to create an agency and grant specified permission policies to AI DataLake. You can selectively grant permissions by passing supported agency permission policies. This API is synchronous with no accompanying APIs or specific scenarios.

Calling Method

For details, see Calling APIs.

URI

POST /v2/agencies

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition: User token. It is obtained by calling the Obtaining an IAM User Token API.

Constraints: N/A

Range: Up to 65,534 characters. Only letters, digits, and special characters are allowed. The token format is defined by IAM. For details about the character set, see the IAM documentation.

Default Value: N/A

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

policy_names

Yes

Array of strings

Definition: A list of permission policies that you want to grant to AI DataLake. Range:

  • AI_DATALAKE_COMMON_POLICY: Basic service permission policy.

  • AI_DATALAKE_SELF_POLICY: Access permission policy of AI DataLake, which is used for internal resource access of the service.

  • AI_DATALAKE_LAKEFORMATION_POLICY: Permission policy related to the LakeFormation function.

  • AI_DATALAKE_LTS_POLICY: Permission policy related to the logging function.

  • AI_DATALAKE_SMN_POLICY: Permission policy related to the notification function, which is used to forward system notifications to SMN.

  • AI_DATALAKE_AOM_POLICY: Permission policy related to the AOM function.

  • AI_DATALAKE_SWR_POLICY: Permission policy related to the image package registration function.

  • AI_DATALAKE_VPCEP_POLICY: Permission policy related to the network connectivity function.

  • AI_DATALAKE_DNS_POLICY: Permission policy related to DNS.

  • AI_DATALAKE_OBS_POLICY: Permission policy related to OBS.

  • AI_DATALAKE_VPC_POLICY: Permission policy related to VPC.

  • AI_DATALAKE_DCS_POLICY: Permission policy related to DCS.

  • AI_DATALAKE_DEW_POLICY: Permission policy related to DEW.

Constraints: When creating an agency, the following four mandatory policies must be included:

  • AI_DATALAKE_COMMON_POLICY: Basic service permission policy.

  • AI_DATALAKE_SELF_POLICY: Access permission policy of AI DataLake, which is used for internal resource access of the service.

  • AI_DATALAKE_LAKEFORMATION_POLICY: Permission policy related to the LakeFormation function.

  • AI_DATALAKE_LTS_POLICY: Permission policy related to the logging function.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

agency_name

String

Definition: Agency name.

Range: 1 to 128 characters. Only letters, digits, and underscores (_) are allowed.

Status code: 400

Table 4 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code.

Range: 8 to 36 characters.

error_msg

String

Definition: Error description.

Range: 2 to 512 characters.

solution_msg

String

Definition: Solution.

Range: 0 to 4,096 characters.

Status code: 401

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code.

Range: 8 to 36 characters.

error_msg

String

Definition: Error description.

Range: 2 to 512 characters.

solution_msg

String

Definition: Solution.

Range: 0 to 4,096 characters.

Status code: 403

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code.

Range: 8 to 36 characters.

error_msg

String

Definition: Error description.

Range: 2 to 512 characters.

solution_msg

String

Definition: Solution.

Range: 0 to 4,096 characters.

Status code: 404

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code.

Range: 8 to 36 characters.

error_msg

String

Definition: Error description.

Range: 2 to 512 characters.

solution_msg

String

Definition: Solution.

Range: 0 to 4,096 characters.

Status code: 408

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code.

Range: 8 to 36 characters.

error_msg

String

Definition: Error description.

Range: 2 to 512 characters.

solution_msg

String

Definition: Solution.

Range: 0 to 4,096 characters.

Status code: 500

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code.

Range: 8 to 36 characters.

error_msg

String

Definition: Error description.

Range: 2 to 512 characters.

solution_msg

String

Definition: Solution.

Range: 0 to 4,096 characters.

Example Requests

A user creates an agency for AI DataLake.

POST /v2/agencies

{
  "policy_names" : [ "AI_DATALAKE_COMMON_POLICY", "AI_DATALAKE_SELF_POLICY", "AI_DATALAKE_LTS_POLICY", "AI_DATALAKE_OBS_POLICY", "AI_DATALAKE_LAKEFORMATION_POLICY" ]
}

Example Responses

Status code: 200

{
  "agency_name" : "ai_datalake_admin_trust"
}

Status code: 400

{
  "error_code" : "AIDataLake.00010151",
  "error_msg" : "Parameter value is invalid.",
  "solution_msg" : "Please input valid parameter value."
}

Status code: 401

{
  "error_code" : "APIGW.0301",
  "error_msg" : "Incorrect IAM authentication information: decrypt token fail.",
  "solution_msg" : "Check whether the IAM authentication information is correct."
}

Status code: 403

{
  "error_code" : "AIDataLake.00010150",
  "error_msg" : "The operation is not allowed.",
  "solution_msg" : "Check whether the operation is allowed in the current status."
}

Status code: 404

{
  "error_code" : "AIDataLake.00010009",
  "error_msg" : "No resources found.",
  "solution_msg" : "Ensure the requested resource exists and the parameters are correct."
}

Status code: 408

{
  "error_code" : "common.00000408",
  "error_msg" : "timeout exception occurred",
  "solution_msg" : "Try again later. If the problem persists, contact technical support."
}

Status code: 500

{
  "error_code" : "AIDataLake.00011001",
  "error_msg" : "Internal error.",
  "solution_msg" : "Contact technical support or try again later."
}

Status Codes

Status Code

Description

200

Request succeeded.

400

Invalid request parameters.

401

Unauthorized.

403

Access denied.

404

Resource not found.

408

Request timeout.

500

Internal server error.