All Products
Search
Document Center

Function Compute:Version-related commands

Last Updated:Feb 27, 2026

Manage service versions in Function Compute by using the Serverless Devs FC component CLI. The FC component wraps the Function Compute API to publish, delete, and list service versions from the command line.

Command summary

CommandAPI operationDescription
PublishServiceVersionPublishServiceVersionCreate a snapshot of a service as a numbered version.
DeleteServiceVersionDeleteServiceVersionDelete a specific service version.
ListServiceVersionsListServiceVersionsList all versions of a service.

Prerequisites

Before you begin, make sure that you have:

Common parameters

The following parameters apply to all version-related commands. They are omitted from the individual command parameter tables.

ParameterTypeRequiredDescription
--regionStringYesThe region where the service is deployed. Example: cn-hangzhou.
--access or -aStringNoThe Serverless Devs access alias for authentication.
--apiVersionStringNoThe Function Compute API version. Valid values: 20210416, 20160815.

Base syntax

All version-related commands follow this pattern:

sudo s cli fc api <Operation> --region <region-id> [--access <access-alias>] [--apiVersion <api-version>] [operation-specific-parameters]

PublishServiceVersion

Publish a new version of a service. This creates an immutable snapshot of the current service configuration.

Synopsis

sudo s cli fc api PublishServiceVersion --region <region-id> \
  --path '{"serviceName": "<service-name>"}' \
  --body '{"description": "<description>"}'

Parameters

Path parameters

ParameterTypeRequiredDescription
serviceNameStringYesThe name of the service to publish a version for.

Body parameters

ParameterTypeRequiredDescription
descriptionStringNoThe description of the service version.

Examples

Publish a version with a description

sudo s cli fc api PublishServiceVersion --region cn-hangzhou --access default \
  --path '{"serviceName": "mytest"}' \
  --body '{"description": "myversion"}'

Sample output:

{
  "versionId": 1,
  "description": "myversion",
  "createdTime": "2026-02-15T19:44:46Z",
  "lastModifiedTime": "2026-02-15T19:44:46Z"
}
The sample output is for reference only. Actual field values vary based on your service configuration.

For more information about this API operation, see PublishServiceVersion.


DeleteServiceVersion

Delete a specific version of a service.

Synopsis

sudo s cli fc api DeleteServiceVersion --region <region-id> \
  --path '{"serviceName": "<service-name>", "versionId": "<version-id>"}'

Parameters

Path parameters

ParameterTypeRequiredDescription
serviceNameStringYesThe name of the service.
versionIdStringYesThe ID of the version to delete.

Examples

Delete version 1 of a service

sudo s cli fc api DeleteServiceVersion --region cn-hangzhou --access default \
  --path '{"serviceName": "mytest", "versionId": "1"}'

This command produces no output on success.

For more information about this API operation, see DeleteServiceVersion.


ListServiceVersions

List all published versions of a service. Results are paginated.

Synopsis

sudo s cli fc api ListServiceVersions --region <region-id> \
  --path '{"serviceName": "<service-name>"}' \
  --query '{"limit": "<count>", "nextToken": "<token>", "startKey": "<start-key>", "direction": "<FORWARD|BACKWARD>"}'

Parameters

Path parameters

ParameterTypeRequiredDescription
serviceNameStringYesThe name of the service.

Query parameters

ParameterTypeRequiredDescription
limitStringNoThe maximum number of versions to return per request.
nextTokenStringNoA pagination token from a previous response. Include this token to retrieve the next page. Omit for the first request.
startKeyStringNoReturn results in alphabetical order starting from this key (inclusive).
directionStringNoThe sort order of the returned versions. Valid values: FORWARD (ascending), BACKWARD (descending). Default: BACKWARD.

Examples

List the first 10 versions in ascending order

sudo s cli fc api ListServiceVersions --region cn-hangzhou --access default \
  --path '{"serviceName": "mytest"}' \
  --query '{"limit": "10", "direction": "FORWARD"}'

Sample output:

{
  "versions": [
    {
      "versionId": 1,
      "description": "initial version",
      "createdTime": "2026-02-15T19:44:46Z",
      "lastModifiedTime": "2026-02-15T19:44:46Z"
    },
    {
      "versionId": 2,
      "description": "updated config",
      "createdTime": "2026-02-15T19:50:15Z",
      "lastModifiedTime": "2026-02-15T19:50:15Z"
    }
  ],
  "nextToken": null,
  "direction": "FORWARD"
}
The sample output is for reference only. Actual field values vary based on your service configuration. If the response includes a non-null nextToken value, pass it in the next request to retrieve more results.

List all versions with default settings

sudo s cli fc api ListServiceVersions --region cn-hangzhou --access default \
  --path '{"serviceName": "mytest"}'

For more information about this API operation, see ListServiceVersions.