Help Center/ ModelArts/ API Reference/ Development Environment Management/ Querying the Available Duration of a Running Notebook Instance
Updated on 2025-08-20 GMT+08:00

Querying the Available Duration of a Running Notebook Instance

Function

This API is used to obtain the available duration of a running notebook instance.

This API applies to the following scenario: When you need to know how long a notebook instance can remain running to properly arrange tasks, you can use this API to query the available duration of it. Before using this API, ensure that you have logged in to the system and have the permission to access the target notebook instance. In addition, the notebook instance must be running. After this API is called, the system returns the available duration of the specified notebook instance. If you do not have the permission to access the specified notebook instance or the notebook instance is not running, the API will return an error message. If the specified notebook instance is not found or the query fails, the API will return an error message.

Constraints

No constraints

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

URI

GET /v1/{project_id}/notebooks/{id}/lease

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

id

Yes

String

Definition: Notebook instance ID. The ID is in the format of a Universally Unique Identifier (UUID). For details about how to obtain the ID, see Querying Notebook Instances.

Constraints: N/A

Range: N/A

Default Value: N/A

project_id

Yes

String

Definition: Project ID. For details, see Obtaining a Project ID and Name.

Constraints: N/A

Range: N/A

Default Value: N/A

Request Parameters

None

Response Parameters

Status code: 200

Table 2 Response body parameters

Parameter

Type

Description

create_at

Long

Definition: UTC time when the instance is created, accurate to millisecond.

Range: N/A

duration

Long

Definition: Instance runtime, which is calculated based on the instance creation time. If the instance creation time plus the runtime is greater than the current time, the system automatically stops the instance.

Range: N/A

enable

Boolean

Definition: Specifies whether to enable auto stop.

Range: Boolean

  • true: Auto stop is enabled.

  • false: Auto stop is disabled.

type

String

Definition: Auto stop type.

Range:

  • TIMING: auto stop

  • IDLE: stop when idle

update_at

Long

Definition: Time (UTC) when the instance is last updated (excluding liveness check), accurate to millisecond.

Range: N/A

Example Requests

GET https://{endpoint}/v1/{project_id}/notebooks/{id}/lease

Example Responses

Status code: 200

OK

{
  "create_at" : 1638841744515,
  "duration" : 3600000,
  "enable" : true,
  "type" : "TIMING",
  "update_at" : 1638842905925
}

Status Codes

Status Code

Description

200

OK

401

Unauthorized

403

Forbidden

404

Not found

Error Codes

See Error Codes.