- NAME
-
- gcloud alpha apihub apis versions specs create - create a Spec
- SYNOPSIS
-
-
gcloud alpha apihub apis versions specs create(SPEC:--api=API--location=LOCATION--version=VERSION)--display-name=DISPLAY_NAME(--spec-type-enum-values=[description=DESCRIPTION],[displayName=DISPLAYNAME],[id=ID],[immutable=IMMUTABLE] |--spec-type-json-values=[SPEC_TYPE_JSON_VALUES,…] |--spec-type-string-values=[SPEC_TYPE_STRING_VALUES,…] |--spec-type-uri-values=[SPEC_TYPE_URI_VALUES,…]) [--attributes=[ATTRIBUTES,…]] [--documentation-external-uri=DOCUMENTATION_EXTERNAL_URI] [--parsing-mode=PARSING_MODE] [--source-uri=SOURCE_URI] [--contents=CONTENTS--contents-mime-type=CONTENTS_MIME_TYPE] [[--lint-response-create-time=LINT_RESPONSE_CREATE_TIME--lint-response-linter=LINT_RESPONSE_LINTER--lint-response-source=LINT_RESPONSE_SOURCE--lint-response-state=LINT_RESPONSE_STATE:--lint-response-issues=[code=CODE],[message=MESSAGE],[path=PATH],[range=RANGE],[severity=SEVERITY]--lint-response-summary=[count=COUNT],[severity=SEVERITY]]] [GCLOUD_WIDE_FLAG …]
-
- DESCRIPTION
-
(ALPHA)Create a spec - EXAMPLES
-
To create a spec with the ID
my-specfor versionmy-versionand APImy-api, run:gcloud alpha apihub apis versions specs create --spec=my-spec --version=my-version --api=my-api --display-name="My Spec" --spec-type=openapi --project=my-project --location=us-central1 - POSITIONAL ARGUMENTS
-
-
Spec resource - Identifier. The name of the spec.
Format:
projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}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
specon the command line with a fully specified name; -
provide the argument
--projecton the command line; -
set the property
core/project.
This must be specified.
SPEC-
ID of the spec or fully qualified identifier for the spec.
To set the
specattribute:-
provide the argument
specon 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 spec resource.
To set the
apiattribute:-
provide the argument
specon the command line with a fully specified name; -
provide the argument
--apion the command line.
-
provide the argument
--location=LOCATION-
The location id of the spec resource.
To set the
locationattribute:-
provide the argument
specon the command line with a fully specified name; -
provide the argument
--locationon the command line.
-
provide the argument
--version=VERSION-
The version id of the spec resource.
To set the
versionattribute:-
provide the argument
specon the command line with a fully specified name; -
provide the argument
--versionon the command line.
-
provide the argument
-
provide the argument
-
Spec resource - Identifier. The name of the spec.
- REQUIRED FLAGS
-
--display-name=DISPLAY_NAME- The display name of the spec. This can contain the file name of the spec.
-
The attribute values associated with resource.
This must be specified.
-
Arguments for the Value.
At most one of these can be specified:
- The attribute values of data type enum.
--spec-type-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:--spec-type-enum-values=description=string,displayName=string,id=string,immutable=boolean --spec-type-enum-values=description=string,displayName=string,id=string,immutable=boolean
JSON Example:--spec-type-enum-values='[{"description": "string", "displayName": "string", "id": "string", "immutable": boolean}]'
File Example:--spec-type-enum-values=path_to_file.(yaml|json)
- The attribute values of data type string or JSON.
--spec-type-json-values=[SPEC_TYPE_JSON_VALUES,…]- The attribute values in case attribute data type is string or JSON.
- The attribute values of data type string or JSON.
--spec-type-string-values=[SPEC_TYPE_STRING_VALUES,…]- The attribute values in case attribute data type is string or JSON.
- The attribute values of data type string or JSON.
--spec-type-uri-values=[SPEC_TYPE_URI_VALUES,…]- The attribute values in case attribute data type is string or JSON.
-
Arguments for the Value.
- OPTIONAL FLAGS
-
--attributes=[ATTRIBUTES,…]-
The list of user defined attributes associated with the spec. 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)
- Documentation details.
--documentation-external-uri=DOCUMENTATION_EXTERNAL_URI- The uri of the externally hosted documentation.
--parsing-mode=PARSING_MODE-
Enum specifying the parsing mode for OpenAPI Specification (OAS) parsing.
PARSING_MODEmust be one of:relaxed- Parsing of the Spec on create and update is relaxed, meaning that parsing errors the spec contents will not fail the API call.
strict- Parsing of the Spec on create and update is strict, meaning that parsing errors in the spec contents will fail the API call.
--source-uri=SOURCE_URI- The URI of the spec source in case file is uploaded from an external version control system.
- The spec contents.
--contents=CONTENTS-
The contents of the spec.
This flag argument must be specified if any of the other arguments in this group are specified.
--contents-mime-type=CONTENTS_MIME_TYPE-
The mime type of the content for example application/json, application/yaml,
application/wsdl etc.
This flag argument must be specified if any of the other arguments in this group are specified.
- LintResponse contains the response from the linter.
--lint-response-create-time=LINT_RESPONSE_CREATE_TIME-
Timestamp when the linting response was generated.
This flag argument must be specified if any of the other arguments in this group are specified.
--lint-response-linter=LINT_RESPONSE_LINTER-
Name of the linter used.
LINT_RESPONSE_LINTERmust be one of:other- Linter type other.
spectral- Linter type spectral.
--lint-response-source=LINT_RESPONSE_SOURCE-
Name of the linting application.
This flag argument must be specified if any of the other arguments in this group are specified.
--lint-response-state=LINT_RESPONSE_STATE-
Lint state represents success or failure for linting.
LINT_RESPONSE_STATEmust be one of:lint-state-error- Linting encountered errors.
lint-state-success- Linting was completed successfully.
--lint-response-issues=[code=CODE],[message=MESSAGE],[path=PATH],[range=RANGE],[severity=SEVERITY]-
Array of issues found in the analyzed document.
code- Rule code unique to each rule defined in linter.
message- Human-readable message describing the issue found by the linter.
path- An array of strings indicating the location in the analyzed document where the rule was triggered.
range-
Object describing where in the file the issue was found.
end-
End of the issue.
character- Character position within the line (zero-indexed).
line- Line number (zero-indexed).
start-
Start of the issue.
character- Character position within the line (zero-indexed).
line- Line number (zero-indexed).
severity- Severity level of the rule violation.
Shorthand Example:--lint-response-issues=code=string,message=string,path=[string],range={end={character=int,line=int},start={character=int,line=int}},severity=string --lint-response-issues=code=string,message=string,path=[string],range={end={character=int,line=int},start={character=int,line=int}},severity=string
JSON Example:--lint-response-issues='[{"code": "string", "message": "string", "path": ["string"], "range": {"end": {"character": int, "line": int}, "start": {"character": int, "line": int}}, "severity": "string"}]'
File Example:--lint-response-issues=path_to_file.(yaml|json)
--lint-response-summary=[count=COUNT],[severity=SEVERITY]-
Summary of all issue types and counts for each severity level.
count- Count of issues with the given severity.
severity- Severity of the issue.
Shorthand Example:--lint-response-summary=count=int,severity=string --lint-response-summary=count=int,severity=string
JSON Example:--lint-response-summary='[{"count": int, "severity": "string"}]'
File Example:--lint-response-summary=path_to_file.(yaml|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 command is currently in alpha and might change without notice. If this
command fails with API permission errors despite specifying the correct project,
you might be trying to access an API with an invitation-only early access
allowlist. This variant is also available:
gcloud apihub apis versions specs create
gcloud alpha apihub apis versions specs 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.