All Products
Search
Document Center

Platform For AI:GetLifecycle

Last Updated:Nov 28, 2025

Retrieves the lifecycle of an instance.

Operation description

Retrieves the lifecycle transition information for an instance. You can retrieve details about the state of an instance at a specific time.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

paidsw:GetLifecycle

get

*All Resource

*

None None

Request syntax

GET /api/v2/instances/{InstanceId}/lifecycle HTTP/1.1

Path Parameters

Parameter

Type

Required

Description

Example

InstanceId

string

Yes

The instance ID. For more information about how to obtain an instance ID, see ListInstances.

dsw-9698d842b6***

Request parameters

Parameter

Type

Required

Description

Example

SessionNumber

integer

No

A session is the period from when an instance is started until it fails or is stopped. sessionNumber specifies the ordinal number offset of the session.

1

StartTime

string

No

The start time of the query.

2020-11-08T15:00:00Z

EndTime

string

No

The end time of the query.

2020-11-08T15:00:00Z

Limit

integer

No

The maximum number of sessions to return in the query.

1

Order

string

No

The order in which to sort the results. Valid values:

  • ASC: ascending order by time.

  • DESC: descending order by time.

DESC

Token

string

No

A token used for sharing URLs.

Response elements

Element

Type

Description

Example

object

The result of the lifecycle query.

RequestId

string

The request ID.

E7D55162-4489-1619-AAF5-3F97D5FC****

Success

boolean

Indicates whether the request was successful. Valid values:

  • true

  • false

true

Message

string

The message returned for the operation.

"XXX"

Code

string

The status code. Valid values:

  • InternalError: An internal error occurred. This includes all errors except for parameter validation errors.

  • ValidationError: A parameter validation error occurred.

null

Lifecycle

array<object>

The details of the instance lifecycle, organized by session.

[[{"Status":"Creating","GmtCreateTime":"2022-09-19T22:38:00Z","Reason":"","ReasonCode":""}]]

array<object>

A list of lifecycles where each subkey represents the lifecycle of a Session.

object

A single lifecycle event.

Status

string

The status of the instance. Possible values:

  • Creating: The instance is being created.

  • SaveFailed: Failed to save the instance image.

  • Stopped: The instance is stopped.

  • Failed: Failed to create the instance.

  • ResourceAllocating: Allocating resources.

  • Stopping: The instance is stopping.

  • Updating: The instance is being updated.

  • Saving: The instance is being saved.

  • Starting: The instance is starting.

  • Running: The instance is running.

  • Saved: The instance is saved.

  • EnvPreparing: Preparing the environment.

  • ArrearStopping: Stopping due to an overdue payment.

  • Arrearge: Stopped due to an overdue payment.

  • Queuing: The instance is waiting in a queue.

  • Recovering: The instance is being recovered.

Valid values:

  • ArrearStopping :

    ArrearStopping

  • Creating :

    Creating

  • SaveFailed :

    SaveFailed

  • Stopped :

    Stopped

  • Failed :

    Failed

  • ResourceAllocating :

    ResourceAllocating

  • Stopping :

    Stopping

  • Updating :

    Updating

  • Saving :

    Saving

  • Arrearge :

    Arrearage

  • Queuing :

    Queuing

  • Recovering :

    Recovering

  • Starting :

    Starting

  • Running :

    Running

  • Saved :

    Saved

  • EnvPreparing :

    EnvPreparing

Starting

ReasonCode

string

The code for the reason why an event occurred.

“”

ReasonMessage

string

The description of the reason why an event occurred.

“”

GmtCreateTime

string

The time when the instance transitioned to this state. The time is in GMT.

2022-10-21T07:27:44Z

GmtEndTime

string

LifecycleId

string

TotalCount

integer

The total number of sessions returned.

35

Examples

Success response

JSON format

{
  "RequestId": "E7D55162-4489-1619-AAF5-3F97D5FC****",
  "Success": true,
  "Message": "\"XXX\"",
  "Code": "null",
  "Lifecycle": [
    [
      {
        "Status": "Starting",
        "ReasonCode": "“”",
        "ReasonMessage": "“”",
        "GmtCreateTime": "2022-10-21T07:27:44Z",
        "GmtEndTime": "",
        "LifecycleId": ""
      }
    ]
  ],
  "TotalCount": 35
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.