Help Center/MaaS/API Reference/Endpoint/Enabling or Disabling an Endpoint
Updated on 2026-02-26 GMT+08:00

Enabling or Disabling an Endpoint

Description

This API is used to enable or disable an endpoint based on the input project-id and custom_endpoint_id.

Constraints

This function is only supported in CN-Hong Kong.

URI

PUT /v1/{project_id}/maas/services/custom-endpoint/control/{custom_endpoint_id}

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project-id

Yes

String

Definition: Project ID. For details about how to obtain the project ID, see Obtaining a Project ID and Name.

Constraints: N/A.

Range: N/A.

Default Value: N/A.

custom_endpoint_id

Yes

String

Definition: Endpoint ID, which is returned when an endpoint is created or obtained using the query API. For details, see Creating an Endpoint or Querying Custom Endpoints.

Constraints: N/A.

Range: N/A.

Default Value: N/A.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition: User token. The token can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token. For details, see Authentication.

Constraints: N/A.

Range: N/A.

Default Value: N/A.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

action

Yes

String

Definition: Specifies whether to enable or disable the endpoint.

Constraints: N/A.

Range:

  • activate: Enable the endpoint.
  • deactivate: Disable the endpoint.

Default Value: N/A.

Response Parameters

  • Success response:

    Status code: 204. If the enabling or disabling is successful, no message is returned.

  • The error response parameters are as follows.

    Parameter

    Type

    Description

    error_msg

    String

    Definition: Error description.

    Range: N/A.

    error_code

    String

    Definition: Error code, indicating the error type.

    Range: N/A.

Request Example

Enable the endpoint whose ID is c4513589-df2e-4d58-ab0c-d5a6f2******.

PUT
/v1/{project_id}/maas/services/custom-endpoint/control/c4513589-df2e-4d58-ab0c-d5a6f2******

{
    "action": "activate"
} 

Response Example

  • Success response:

    Status code: 204. If the operation is successful, no content is returned.

  • Error response:

    Status code: If the endpoint ID is not found, 404 is returned, indicating that the endpoint does not exist. If the parameter does not meet the specifications, 400 is returned.

    {
        "error_msg": "Invalid token.",
        "error_code": "ModelArts.0104"
    } 

Status Codes

For details, see Status Codes.

Error Codes

For details, see Error Codes.