In case of an OAS spec, updating spec contents can lead to: 1. Creation, deletion and update of operations. 2. Creation, deletion and update of definitions. 3. Update of other info parsed out from the new spec.
In case of contents or source_uri being present in update mask, specType must also be present. Also, specType can not be present in update mask if contents or source_uri is not present.
The updateMask should be used to specify the fields being updated.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-28 UTC."],[[["\u003cp\u003eThis content describes how to update a \u003ccode\u003eSpec\u003c/code\u003e, which includes information about HTTP requests, path and query parameters, request and response bodies, and authorization.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eSpec\u003c/code\u003e fields that can be updated are: \u003ccode\u003edisplay_name\u003c/code\u003e, \u003ccode\u003esource_uri\u003c/code\u003e, \u003ccode\u003elint_response\u003c/code\u003e, \u003ccode\u003eattributes\u003c/code\u003e, \u003ccode\u003econtents\u003c/code\u003e, and \u003ccode\u003especType\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eUpdating the \u003ccode\u003econtents\u003c/code\u003e or \u003ccode\u003esource_uri\u003c/code\u003e of an OAS spec can result in the creation, deletion, and updating of operations and definitions, along with other info parsed from the spec.\u003c/p\u003e\n"],["\u003cp\u003eWhen updating, you must use the \u003ccode\u003eupdateMask\u003c/code\u003e query parameter to specify the fields being modified, and if either \u003ccode\u003econtents\u003c/code\u003e or \u003ccode\u003esource_uri\u003c/code\u003e is in the update mask, \u003ccode\u003especType\u003c/code\u003e must also be present.\u003c/p\u003e\n"],["\u003cp\u003eUpdating the \u003ccode\u003eSpec\u003c/code\u003e requires the \u003ccode\u003eapihub.specs.update\u003c/code\u003e IAM permission and the \u003ccode\u003ehttps://www.googleapis.com/auth/cloud-platform\u003c/code\u003e OAuth scope.\u003c/p\u003e\n"]]],[],null,["# Method: projects.locations.apis.versions.specs.patch\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [IAM Permissions](#body.aspect_1)\n\nUpdate spec. The following fields in the [spec](/apigee/docs/reference/apis/apihub/rest/v1/projects.locations.apis.versions.specs#Spec) can be updated:\n\n- [display_name](/apigee/docs/reference/apis/apihub/rest/v1/projects.locations.apis.versions.specs#Spec.FIELDS.display_name)\n- [source_uri](/apigee/docs/reference/apis/apihub/rest/v1/projects.locations.apis.versions.specs#Spec.FIELDS.source_uri)\n- [lint_response](/apigee/docs/reference/apis/apihub/rest/v1/projects.locations.apis.versions.specs#Spec.FIELDS.lint_response)\n- [attributes](/apigee/docs/reference/apis/apihub/rest/v1/projects.locations.apis.versions.specs#Spec.FIELDS.attributes)\n- [contents](/apigee/docs/reference/apis/apihub/rest/v1/projects.locations.apis.versions.specs#Spec.FIELDS.contents)\n- [specType](/apigee/docs/reference/apis/apihub/rest/v1/projects.locations.apis.versions.specs#Spec.FIELDS.spec_type)\n\nIn case of an OAS spec, updating spec contents can lead to: 1. Creation, deletion and update of operations. 2. Creation, deletion and update of definitions. 3. Update of other info parsed out from the new spec.\n\nIn case of contents or source_uri being present in update mask, specType must also be present. Also, specType can not be present in update mask if contents or source_uri is not present.\n\nThe [updateMask](/apigee/docs/reference/apis/apihub/rest/v1/projects.locations.apis.versions.specs/patch#body.QUERY_PARAMETERS.update_mask) should be used to specify the fields being updated.\n\n### HTTP request\n\n`PATCH https://apihub.googleapis.com/v1/{spec.name=projects/*/locations/*/apis/*/versions/*/specs/*}`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n### Query parameters\n\n### Request body\n\nThe request body contains an instance of [Spec](/apigee/docs/reference/apis/apihub/rest/v1/projects.locations.apis.versions.specs#Spec).\n\n### Response body\n\nIf successful, the response body contains an instance of [Spec](/apigee/docs/reference/apis/apihub/rest/v1/projects.locations.apis.versions.specs#Spec).\n\n### Authorization scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/cloud-platform`\n\n### IAM Permissions\n\nRequires the following [IAM](https://cloud.google.com/iam/docs) permission on the `name` resource:\n\n- `apihub.specs.update`\n\nFor more information, see the [IAM documentation](https://cloud.google.com/iam/docs)."]]