Help Center/ MaaS/ API Reference/ MaaS Call Statistics/ Obtaining Time-based Service Error Code Statistics
Updated on 2026-07-03 GMT+08:00

Obtaining Time-based Service Error Code Statistics

Function

This API is used to display the chronological distribution of service error code statistics. Data is retained for 30 days only.

Constraints

  • Region restrictions: Only the CN-Hong Kong region is supported.
  • API rate limiting: The total number of requests for this API from all users cannot exceed 80 within 20 seconds.
  • User request limit: The number of requests for this API from a single user cannot exceed 1 within 20 seconds.
  • Rate-limiting response: When the rate limit is exceeded, the API returns the HTTP status code 429 "Too Many Requests".
  • Retry suggestion: If the rate limit is exceeded, wait 20 seconds and try again.

URI

POST /v1/{project_id}/maas/monitoring/{service_id}/error-code-chart

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: The value can contain 32 characters. Only lowercase letters and digits are allowed.

Default Value: N/A

service_id

Yes

String

Definition: Service IDs to be queried. Services are filtered based on the input service ID list. If this parameter is not specified, all service names corresponding to the IDs are returned. You can obtain the service ID from the response body during service creation, or call the API for obtaining the service list. The service_id field indicates the service ID.

Constraints: N/A

Range: The value can contain 1 to 128 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed.

Default Value: N/A

Request Parameters

Table 2 Request header parameter

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition: User token. It can be obtained by calling the IAM API that is 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

service_type

Yes

Integer

Definition: Service type.

Constraints: N/A

Range:

Default Value: N/A

api_keys

No

Array of strings

Definition: API key tag list, which is used for filtering.

MaaS services support API key calls.

Go to the API key management page to get the API key tag. The Tag field in the API key list shows the API key tag.

Constraints: N/A

Range:

  • Example for obtaining the online experience call data: api_keys: [""].
  • When obtaining the call data of some API keys, transfer the tags of the corresponding API keys. Example: api_keys: ["test01","test02"].
  • Example for obtaining the call data of online experience and some API keys: api_keys: ["test01", "test02", ""].
  • When obtaining all call data, do not use this parameter.

Default Value: N/A

ips

No

Array of strings

Definition: IP address list, which indicates the source IP addresses of the clients that have been called. If this parameter is not specified, all IP addresses are queried. To query the IP address, you can call the API for obtaining the IP address list.

Constraints: The value must be in the IP address format.

Range: N/A

Default Value: N/A

start_time

Yes

Long

Definition: Timestamp of the start time, in milliseconds.

Constraints: The end time must be within 30 days from the start time.

Range: The value must be greater than 0 and no greater than the value of end_time.

Default Value: N/A

end_time

Yes

Long

Definition: Timestamp of the end time, in milliseconds.

Constraints: The end time must be within 30 days from the start time.

Range: The value must be greater than 0.

Default Value: N/A

timezone

No

String

Definition: Time zone.

Constraints: N/A

Range: The value must comply with the IANA time zone specifications, such as Asia/Shanghai and UTC.

Default Value: Asia/Shanghai (GMT+8)

infer_type

Yes

String

Definition: Service inference type.

Range:

  • real_time: real-time inference
  • batch: batch inference (Batch inference is under restricted use. To use it, submit a service ticket.)

Constraints: N/A

Default Value: N/A

error_code_type

No

String

Definition: Error code type.

Constraints: N/A

Range:

  • 4xx: Error codes starting with 4.
  • 5xx: Error codes starting with 5.

If this parameter is left empty or not specified, all error codes starting with 4 and 5 are displayed.

Default Value: N/A

time_granularity

Yes

Integer

Definition: Time granularity.

Constraints: The time range (interval between the start time and end time) and time precision must meet the following rules:

  • For time ranges 0–2 days, precision to minute or hour is supported.
  • For time ranges 3–7 days, precision to hour or day is supported.
  • For time ranges 8–30 days, precision to day is supported.

Range: The value must be an integer ranging from 1 to 3.

  • 1: minute granularity
  • 2: hour granularity
  • 3: day granularity

Default Value: N/A

version_id

No

String

Definition: Service version ID, which is used for filtering. If this parameter is not specified, data of all versions is queried. To query the service version ID, you can call the API for querying the service version.

Constraints: N/A

Range: The value can contain 1 to 128 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed.

Default Value: N/A

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

total

Integer

Definition: Total number of errors.

Range: N/A

count

Integer

Definition: Total number of errors.

Range: N/A

list_4xx

Array of ErrorCodeCount objects

Definition: 4xx error details.

Range: N/A

list_5xx

Array of ErrorCodeCount objects

Definition: 5xx error details.

Range: N/A

Table 5 ErrorCodeCount

Parameter

Type

Description

error_code

String

Definition: 4xx or 5xx error codes.

Range: The error codes and messages are as follows:

  • 401: Insufficient permission. Check your authentication information.
  • 403: Non-compliant content is requested or generated.
  • 404: Resource not found. The request path may be incorrect.
  • 413: The request body is too large and is rejected by the server.
  • 429: Request traffic is limited.
  • 499: The client proactively disables the connection or cancels the request.
  • 500: An unknown error occurred on the server.
  • 503: No inference service is available at the bottom layer.
  • 504: Request timed out.

list

Array of TimestampErrorCnt objects

Definition: Error code occurrences in each time period, including the timestamp in milliseconds and the number of errors.

Range: N/A

Table 6 TimestampErrorCnt

Parameter

Type

Description

time

Long

Definition: Timestamp, in milliseconds.

Range: N/A

count

Long

Definition: Number of error codes in the specified period.

Range: N/A

Status code: 400

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code, which identifies the error type. For details, see MaaS Error Codes.

Range: N/A

error_msg

String

Definition: Error description. For details, see MaaS Error Codes.

Range: N/A

Request Example

Query the metric data generated by real-time inference text of the preset service in the last 14 days. The service ID is 4f6d50ec-0e80-4ea0-983b-d0ad1ede7596 and the version ID is ac73463d-4453-4d62-a3d9-31b627a116b1.

/v1/{{project_id}}/maas/monitoring/4f6d50ec-0e80-4ea0-983b-d0ad1ede7596/error-code-chart

{
  "service_type" : 2,
  "start_time" : 1768406400000,
  "end_time" : 1769532163224,
  "timezone" : "Asia/Shanghai",
  "time_granularity" : 3,
  "infer_type" : "real_time"
}

Response Example

Status code: 200

Success response

{
  "total" : 2,
  "count" : 2,
  "list_4xx" : [ {
    "error_code" : "400",
    "list" : [ {
      "time" : 1768406400000,
      "count" : 2
    }, {
      "time" : 1768492800000,
      "count" : 0
    }, {
      "time" : 1768579200000,
      "count" : 0
    }, {
      "time" : 1768665600000,
      "count" : 0
    }, {
      "time" : 1768752000000,
      "count" : 0
    }, {
      "time" : 1768838400000,
      "count" : 0
    }, {
      "time" : 1768924800000,
      "count" : 0
    }, {
      "time" : 1769011200000,
      "count" : 0
    }, {
      "time" : 1769097600000,
      "count" : 0
    }, {
      "time" : 1769184000000,
      "count" : 0
    }, {
      "time" : 1769270400000,
      "count" : 0
    }, {
      "time" : 1769356800000,
      "count" : 0
    }, {
      "time" : 1769443200000,
      "count" : 0
    }, {
      "time" : 1769529600000,
      "count" : 0
    } ]
  } ],
  "list_5xx" : [ {
    "error_code" : "500",
    "list" : [ ]
  } ]
}

Status code: 400

Failure response

{
  "error_msg" : "The project ID in the request does not match that in the token.",
  "error_code" : "ModelArts.0210"
}

Status Codes

Status Code

Description

200

Success response

400

Failure response

Error Codes

For details, see Error Codes.