- NAME
-
- gcloud apihub apis versions create - create a Version
- SYNOPSIS
-
-
gcloud apihub apis versions create(VERSION:--api=API)--display-name=DISPLAY_NAME[--attributes=[ATTRIBUTES,…]] [--deployments=[DEPLOYMENTS,…]] [--description=DESCRIPTION] [--documentation-external-uri=DOCUMENTATION_EXTERNAL_URI] [--location=LOCATION] [--selected-deployment=SELECTED_DEPLOYMENT] [--accreditation-enum-values=[description=DESCRIPTION],[displayName=DISPLAYNAME],[id=ID],[immutable=IMMUTABLE] |--accreditation-json-values=[ACCREDITATION_JSON_VALUES,…] |--accreditation-string-values=[ACCREDITATION_STRING_VALUES,…] |--accreditation-uri-values=[ACCREDITATION_URI_VALUES,…]] [--compliance-enum-values=[description=DESCRIPTION],[displayName=DISPLAYNAME],[id=ID],[immutable=IMMUTABLE] |--compliance-json-values=[COMPLIANCE_JSON_VALUES,…] |--compliance-string-values=[COMPLIANCE_STRING_VALUES,…] |--compliance-uri-values=[COMPLIANCE_URI_VALUES,…]] [--lifecycle-enum-values=[description=DESCRIPTION],[displayName=DISPLAYNAME],[id=ID],[immutable=IMMUTABLE] |--lifecycle-json-values=[LIFECYCLE_JSON_VALUES,…] |--lifecycle-string-values=[LIFECYCLE_STRING_VALUES,…] |--lifecycle-uri-values=[LIFECYCLE_URI_VALUES,…]] [GCLOUD_WIDE_FLAG …]
-
- DESCRIPTION
- Create a version
- EXAMPLES
-
To create a version with the ID
my-versionfor APImy-api, run:gcloud apihub apis versions create --version=my-version --api=my-api --display-name="My Version" --project=my-project --location=us-central1 - POSITIONAL ARGUMENTS
-
-
Version resource - Identifier. The name of the version.
Format:
projects/{project}/locations/{location}/apis/{api}/versions/{version}The arguments in this group can be used to specify the attributes of this resource. (NOTE) Some attributes are not given arguments in this group but can be set in other ways.To set the
projectattribute:-
provide the argument
versionon the command line with a fully specified name; -
provide the argument
--projecton the command line; -
set the property
core/project.
To set the
locationattribute:-
provide the argument
versionon the command line with a fully specified name; -
provide the argument
--locationon the command line.
This must be specified.
VERSION-
ID of the version or fully qualified identifier for the version.
To set the
versionattribute:-
provide the argument
versionon the command line.
This positional argument must be specified if any of the other arguments in this group are specified.
-
provide the argument
--api=API-
The api id of the version resource.
To set the
apiattribute:-
provide the argument
versionon the command line with a fully specified name; -
provide the argument
--apion the command line.
-
provide the argument
-
provide the argument
-
Version resource - Identifier. The name of the version.
- REQUIRED FLAGS
-
--display-name=DISPLAY_NAME- The display name of the version.
- OPTIONAL FLAGS
-
--attributes=[ATTRIBUTES,…]-
The list of user defined attributes associated with the Version resource. The
key is the attribute name. It will be of the format:
projects/{project}/locations/{location}/attributes/{attribute}. The value is the attribute values associated with the resource.KEY-
Sets
KEYvalue. VALUE-
Sets
VALUEvalue.enumValues-
The attribute values associated with a resource in case attribute data type is
enum.
values-
The attribute values in case attribute data type is enum.
description- The detailed description of the allowed value.
displayName- The display name of the allowed value.
id-
The ID of the allowed value.
- If provided, the same will be used. The service will throw an error if the specified id is already used by another allowed value in the same attribute resource.
- If not provided, a system generated id derived from the display name will be used. In this case, the service will handle conflict resolution by adding a system generated suffix in case of duplicates.
This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/.
immutable- When set to true, the allowed value cannot be updated or deleted by the user. It can only be true for System defined attributes.
jsonValues-
The attribute values associated with a resource in case attribute data type is
JSON.
values- The attribute values in case attribute data type is string or JSON.
stringValues-
The attribute values associated with a resource in case attribute data type is
string.
values- The attribute values in case attribute data type is string or JSON.
uriValues-
The attribute values associated with a resource in case attribute data type is
URL, URI or IP, like gs://bucket-name/object-name.
values- The attribute values in case attribute data type is string or JSON.
Shorthand Example:--attributes=string={enumValues={values=[{description=string,displayName=string,id=string,immutable=boolean}]},jsonValues={values=[string]},stringValues={values=[string]},uriValues={values=[string]}}
JSON Example:--attributes='{"string": {"enumValues": {"values": [{"description": "string", "displayName": "string", "id": "string", "immutable": boolean}]}, "jsonValues": {"values": ["string"]}, "stringValues": {"values": ["string"]}, "uriValues": {"values": ["string"]}}}'
File Example:--attributes=path_to_file.(yaml|json)
-
Deployment resource - The deployments linked to this API version. Note: A
particular API version could be deployed to multiple deployments (for dev
deployment, UAT deployment, etc) Format is
projects/{project}/locations/{location}/deployments/{deployment}This represents a Cloud resource. (NOTE) Some attributes are not given arguments in this group but can be set in other ways.To set the
projectattribute:-
provide the argument
--deploymentson the command line with a fully specified name; -
provide the argument
--projecton the command line; -
set the property
core/project.
To set the
locationattribute:-
provide the argument
--deploymentson the command line with a fully specified name; -
provide the argument
--locationon the command line.
-
provide the argument
--deployments=[DEPLOYMENTS,…]-
IDs of the deployments or fully qualified identifiers for the deployments.
To set the
deploymentattribute:-
provide the argument
--deploymentson the command line.
-
provide the argument
--description=DESCRIPTION- The description of the version.
- Documentation details.
--documentation-external-uri=DOCUMENTATION_EXTERNAL_URI- The uri of the externally hosted documentation.
--location=LOCATION- For resources [version, deployments, selected-deployment], provides fallback value for resource location attribute. When the resource's full URI path is not provided, location will fallback to this flag value.
-
Deployment resource - The selected deployment for a Version resource. This can
be used when special handling is needed on client side for a particular
deployment linked to the version. Format is
projects/{project}/locations/{location}/deployments/{deployment}This represents a Cloud resource. (NOTE) Some attributes are not given arguments in this group but can be set in other ways.To set the
projectattribute:-
provide the argument
--selected-deploymenton the command line with a fully specified name; -
provide the argument
--projecton the command line; -
set the property
core/project.
To set the
locationattribute:-
provide the argument
--selected-deploymenton the command line with a fully specified name; -
provide the argument
--locationon the command line.
-
provide the argument
--selected-deployment=SELECTED_DEPLOYMENT-
ID of the deployment or fully qualified identifier for the deployment.
To set the
deploymentattribute:-
provide the argument
--selected-deploymenton the command line.
-
provide the argument
- The attribute values associated with resource.
-
Arguments for the Value.
At most one of these can be specified:
- The attribute values of data type enum.
--accreditation-enum-values=[description=DESCRIPTION],[displayName=DISPLAYNAME],[id=ID],[immutable=IMMUTABLE]-
Required, The attribute values in case attribute data type is enum.
description- The detailed description of the allowed value.
displayName- The display name of the allowed value.
id-
The ID of the allowed value.
- If provided, the same will be used. The service will throw an error if the specified id is already used by another allowed value in the same attribute resource.
- If not provided, a system generated id derived from the display name will be used. In this case, the service will handle conflict resolution by adding a system generated suffix in case of duplicates.
This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/.
immutable- When set to true, the allowed value cannot be updated or deleted by the user. It can only be true for System defined attributes.
Shorthand Example:--accreditation-enum-values=description=string,displayName=string,id=string,immutable=boolean --accreditation-enum-values=description=string,displayName=string,id=string,immutable=boolean
JSON Example:--accreditation-enum-values='[{"description": "string", "displayName": "string", "id": "string", "immutable": boolean}]'
File Example:--accreditation-enum-values=path_to_file.(yaml|json)
- The attribute values of data type string or JSON.
--accreditation-json-values=[ACCREDITATION_JSON_VALUES,…]- The attribute values in case attribute data type is string or JSON.
- The attribute values of data type string or JSON.
--accreditation-string-values=[ACCREDITATION_STRING_VALUES,…]- The attribute values in case attribute data type is string or JSON.
- The attribute values of data type string or JSON.
--accreditation-uri-values=[ACCREDITATION_URI_VALUES,…]- The attribute values in case attribute data type is string or JSON.
- The attribute values associated with resource.
-
Arguments for the Value.
At most one of these can be specified:
- The attribute values of data type enum.
--compliance-enum-values=[description=DESCRIPTION],[displayName=DISPLAYNAME],[id=ID],[immutable=IMMUTABLE]-
Required, The attribute values in case attribute data type is enum.
description- The detailed description of the allowed value.
displayName- The display name of the allowed value.
id-
The ID of the allowed value.
- If provided, the same will be used. The service will throw an error if the specified id is already used by another allowed value in the same attribute resource.
- If not provided, a system generated id derived from the display name will be used. In this case, the service will handle conflict resolution by adding a system generated suffix in case of duplicates.
This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/.
immutable- When set to true, the allowed value cannot be updated or deleted by the user. It can only be true for System defined attributes.
Shorthand Example:--compliance-enum-values=description=string,displayName=string,id=string,immutable=boolean --compliance-enum-values=description=string,displayName=string,id=string,immutable=boolean
JSON Example:--compliance-enum-values='[{"description": "string", "displayName": "string", "id": "string", "immutable": boolean}]'
File Example:--compliance-enum-values=path_to_file.(yaml|json)
- The attribute values of data type string or JSON.
--compliance-json-values=[COMPLIANCE_JSON_VALUES,…]- The attribute values in case attribute data type is string or JSON.
- The attribute values of data type string or JSON.
--compliance-string-values=[COMPLIANCE_STRING_VALUES,…]- The attribute values in case attribute data type is string or JSON.
- The attribute values of data type string or JSON.
--compliance-uri-values=[COMPLIANCE_URI_VALUES,…]- The attribute values in case attribute data type is string or JSON.
- The attribute values associated with resource.
-
Arguments for the Value.
At most one of these can be specified:
- The attribute values of data type enum.
--lifecycle-enum-values=[description=DESCRIPTION],[displayName=DISPLAYNAME],[id=ID],[immutable=IMMUTABLE]-
Required, The attribute values in case attribute data type is enum.
description- The detailed description of the allowed value.
displayName- The display name of the allowed value.
id-
The ID of the allowed value.
- If provided, the same will be used. The service will throw an error if the specified id is already used by another allowed value in the same attribute resource.
- If not provided, a system generated id derived from the display name will be used. In this case, the service will handle conflict resolution by adding a system generated suffix in case of duplicates.
This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/.
immutable- When set to true, the allowed value cannot be updated or deleted by the user. It can only be true for System defined attributes.
Shorthand Example:--lifecycle-enum-values=description=string,displayName=string,id=string,immutable=boolean --lifecycle-enum-values=description=string,displayName=string,id=string,immutable=boolean
JSON Example:--lifecycle-enum-values='[{"description": "string", "displayName": "string", "id": "string", "immutable": boolean}]'
File Example:--lifecycle-enum-values=path_to_file.(yaml|json)
- The attribute values of data type string or JSON.
--lifecycle-json-values=[LIFECYCLE_JSON_VALUES,…]- The attribute values in case attribute data type is string or JSON.
- The attribute values of data type string or JSON.
--lifecycle-string-values=[LIFECYCLE_STRING_VALUES,…]- The attribute values in case attribute data type is string or JSON.
- The attribute values of data type string or JSON.
--lifecycle-uri-values=[LIFECYCLE_URI_VALUES,…]- The attribute values in case attribute data type is string or JSON.
- GCLOUD WIDE FLAGS
-
These flags are available to all commands:
--access-token-file,--account,--billing-project,--configuration,--flags-file,--flatten,--format,--help,--impersonate-service-account,--log-http,--project,--quiet,--trace-token,--user-output-enabled,--verbosity.Run
$ gcloud helpfor details. - API REFERENCE
-
This command uses the
apihub/v1API. The full documentation for this API can be found at: https://cloud.google.com/apigee/docs/api-hub/what-is-api-hub - NOTES
-
This variant is also available:
gcloud alpha apihub apis versions create
gcloud apihub apis versions create
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-02-24 UTC.