---
title: "POST /v1/projects/{projectsId}/locations/{locationsId}:collectApiData"
method: POST
path: "/v1/projects/{projectsId}/locations/{locationsId}:collectApiData"
tags: ["projects"]
---

# POST /v1/projects/{projectsId}/locations/{locationsId}:collectApiData

`POST /v1/projects/{projectsId}/locations/{locationsId}:collectApiData`

## Request

- Base URL: `https://apihub.googleapis.com`
- URL: `https://apihub.googleapis.com/v1/projects/{projectsId}/locations/{locationsId}:collectApiData`
- Auth: one of:
  - OAuth 2 and OAuth 2
    - Implicit: `https://accounts.google.com/o/oauth2/auth`
    - Scopes: `https://www.googleapis.com/auth/apihub.readwrite`
    - Authorization code: `https://accounts.google.com/o/oauth2/auth`
    - Token URL: `https://accounts.google.com/o/oauth2/token` scopes: `https://www.googleapis.com/auth/apihub.readwrite`
  - OAuth 2 and OAuth 2
    - Implicit: `https://accounts.google.com/o/oauth2/auth`
    - Scopes: `https://www.googleapis.com/auth/cloud-platform`
    - Authorization code: `https://accounts.google.com/o/oauth2/auth`
    - Token URL: `https://accounts.google.com/o/oauth2/token` scopes: `https://www.googleapis.com/auth/cloud-platform`
- TypeScript: <https://skmtc.dev/google/apis/apihub/docs/v1/projects/:projectsId/locations/:locationsId:collectApiData/post.ts> (a function with typed inputs; its response is checked against the schema)

Collect API data from a source and push it to Hub's collect layer.

## Path parameters

- `projectsId` string, required
- `locationsId` string, required

## Request body

- GoogleCloudApihubV1CollectApiDataRequest: The CollectApiData method's request.
  - `actionId` string: Required. The action ID to be used for collecting the API data. This should map to one of the action IDs specified in action configs in the plugin.
  - `apiData` GoogleCloudApihubV1ApiData: The API data to be collected.
    - `apiMetadataList` GoogleCloudApihubV1ApiMetadataList: The message to hold repeated API metadata.
      - `apiMetadata` GoogleCloudApihubV1APIMetadata[]: Required. The list of API metadata.
        - `api` GoogleCloudApihubV1Api: An API resource in the API Hub.
          - `apiFunctionalRequirements` GoogleCloudApihubV1AttributeValues: The attribute values associated with resource.
            - `attribute` string: Output only. The name of the attribute. Format: projects/{project}/locations/{location}/attributes/{attribute}
            - `enumValues` GoogleCloudApihubV1EnumAttributeValues: The attribute values of data type enum.
              - …
            - `jsonValues` GoogleCloudApihubV1StringAttributeValues: The attribute values of data type string or JSON.
              - …
            - `stringValues` GoogleCloudApihubV1StringAttributeValues: The attribute values of data type string or JSON.
              - …
            - `uriValues` GoogleCloudApihubV1StringAttributeValues: The attribute values of data type string or JSON.
              - …
          - `apiRequirements` GoogleCloudApihubV1AttributeValues: The attribute values associated with resource.
            - `attribute` string: Output only. The name of the attribute. Format: projects/{project}/locations/{location}/attributes/{attribute}
            - `enumValues` GoogleCloudApihubV1EnumAttributeValues: The attribute values of data type enum.
              - …
            - `jsonValues` GoogleCloudApihubV1StringAttributeValues: The attribute values of data type string or JSON.
              - …
            - `stringValues` GoogleCloudApihubV1StringAttributeValues: The attribute values of data type string or JSON.
              - …
            - `uriValues` GoogleCloudApihubV1StringAttributeValues: The attribute values of data type string or JSON.
              - …
          - `apiStyle` GoogleCloudApihubV1AttributeValues: The attribute values associated with resource.
            - `attribute` string: Output only. The name of the attribute. Format: projects/{project}/locations/{location}/attributes/{attribute}
            - `enumValues` GoogleCloudApihubV1EnumAttributeValues: The attribute values of data type enum.
              - …
            - `jsonValues` GoogleCloudApihubV1StringAttributeValues: The attribute values of data type string or JSON.
              - …
            - `stringValues` GoogleCloudApihubV1StringAttributeValues: The attribute values of data type string or JSON.
              - …
            - `uriValues` GoogleCloudApihubV1StringAttributeValues: The attribute values of data type string or JSON.
              - …
          - `apiTechnicalRequirements` GoogleCloudApihubV1AttributeValues: The attribute values associated with resource.
            - `attribute` string: Output only. The name of the attribute. Format: projects/{project}/locations/{location}/attributes/{attribute}
            - `enumValues` GoogleCloudApihubV1EnumAttributeValues: The attribute values of data type enum.
              - …
            - `jsonValues` GoogleCloudApihubV1StringAttributeValues: The attribute values of data type string or JSON.
              - …
            - `stringValues` GoogleCloudApihubV1StringAttributeValues: The attribute values of data type string or JSON.
              - …
            - `uriValues` GoogleCloudApihubV1StringAttributeValues: The attribute values of data type string or JSON.
              - …
          - `attributes` object: Optional. The list of user defined attributes associated with the API 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.
          - `businessUnit` GoogleCloudApihubV1AttributeValues: The attribute values associated with resource.
            - `attribute` string: Output only. The name of the attribute. Format: projects/{project}/locations/{location}/attributes/{attribute}
            - `enumValues` GoogleCloudApihubV1EnumAttributeValues: The attribute values of data type enum.
              - …
            - `jsonValues` GoogleCloudApihubV1StringAttributeValues: The attribute values of data type string or JSON.
              - …
            - `stringValues` GoogleCloudApihubV1StringAttributeValues: The attribute values of data type string or JSON.
              - …
            - `uriValues` GoogleCloudApihubV1StringAttributeValues: The attribute values of data type string or JSON.
              - …
          - `createTime` string, google-datetime: Output only. The time at which the API resource was created.
          - `description` string: Optional. The description of the API resource.
          - `displayName` string: Required. The display name of the API resource.
          - `documentation` GoogleCloudApihubV1Documentation: Documentation details.
            - `externalUri` string: Optional. The uri of the externally hosted documentation.
          - `fingerprint` string: Optional. Fingerprint of the API resource. This must be unique for each API resource. It can neither be unset nor be updated to an existing fingerprint of another API resource.
          - `maturityLevel` GoogleCloudApihubV1AttributeValues: The attribute values associated with resource.
            - `attribute` string: Output only. The name of the attribute. Format: projects/{project}/locations/{location}/attributes/{attribute}
            - `enumValues` GoogleCloudApihubV1EnumAttributeValues: The attribute values of data type enum.
              - …
            - `jsonValues` GoogleCloudApihubV1StringAttributeValues: The attribute values of data type string or JSON.
              - …
            - `stringValues` GoogleCloudApihubV1StringAttributeValues: The attribute values of data type string or JSON.
              - …
            - `uriValues` GoogleCloudApihubV1StringAttributeValues: The attribute values of data type string or JSON.
              - …
          - `name` string: Identifier. The name of the API resource in the API Hub. Format: `projects/{project}/locations/{location}/apis/{api}`
          - `owner` GoogleCloudApihubV1Owner: Owner details.
            - `displayName` string: Optional. The name of the owner.
            - `email` string: Required. The email of the owner.
          - `selectedVersion` string: Optional. The selected version for an API resource. This can be used when special handling is needed on client side for particular version of the API. Format is `projects/{project}/locations/{location}/apis/{api}/versions/{version}`
          - `serviceType` GoogleCloudApihubV1AttributeValues: The attribute values associated with resource.
            - `attribute` string: Output only. The name of the attribute. Format: projects/{project}/locations/{location}/attributes/{attribute}
            - `enumValues` GoogleCloudApihubV1EnumAttributeValues: The attribute values of data type enum.
              - …
            - `jsonValues` GoogleCloudApihubV1StringAttributeValues: The attribute values of data type string or JSON.
              - …
            - `stringValues` GoogleCloudApihubV1StringAttributeValues: The attribute values of data type string or JSON.
              - …
            - `uriValues` GoogleCloudApihubV1StringAttributeValues: The attribute values of data type string or JSON.
              - …
          - `sourceMetadata` GoogleCloudApihubV1SourceMetadata[]: Output only. The list of sources and metadata from the sources of the API resource.
            - `originalResourceCreateTime` string, google-datetime: Output only. The time at which the resource was created at the source.
            - `originalResourceId` string: Output only. The unique identifier of the resource at the source.
            - `originalResourceUpdateTime` string, google-datetime: Output only. The time at which the resource was last updated at the source.
            - `pluginInstanceActionSource` GoogleCloudApihubV1PluginInstanceActionSource: PluginInstanceActionSource represents the plugin instance action source.
              - …
            - `sourceType` 'SOURCE_TYPE_UNSPECIFIED' | 'PLUGIN': Output only. The type of the source.
          - `targetUser` GoogleCloudApihubV1AttributeValues: The attribute values associated with resource.
            - `attribute` string: Output only. The name of the attribute. Format: projects/{project}/locations/{location}/attributes/{attribute}
            - `enumValues` GoogleCloudApihubV1EnumAttributeValues: The attribute values of data type enum.
              - …
            - `jsonValues` GoogleCloudApihubV1StringAttributeValues: The attribute values of data type string or JSON.
              - …
            - `stringValues` GoogleCloudApihubV1StringAttributeValues: The attribute values of data type string or JSON.
              - …
            - `uriValues` GoogleCloudApihubV1StringAttributeValues: The attribute values of data type string or JSON.
              - …
          - `team` GoogleCloudApihubV1AttributeValues: The attribute values associated with resource.
            - `attribute` string: Output only. The name of the attribute. Format: projects/{project}/locations/{location}/attributes/{attribute}
            - `enumValues` GoogleCloudApihubV1EnumAttributeValues: The attribute values of data type enum.
              - …
            - `jsonValues` GoogleCloudApihubV1StringAttributeValues: The attribute values of data type string or JSON.
              - …
            - `stringValues` GoogleCloudApihubV1StringAttributeValues: The attribute values of data type string or JSON.
              - …
            - `uriValues` GoogleCloudApihubV1StringAttributeValues: The attribute values of data type string or JSON.
              - …
          - `updateTime` string, google-datetime: Output only. The time at which the API resource was last updated.
          - `versions` string[]: Output only. The list of versions present in an API resource. Note: An API resource can be associated with more than 1 version. Format is `projects/{project}/locations/{location}/apis/{api}/versions/{version}`
        - `originalCreateTime` string, google-datetime: Optional. Timestamp indicating when the API was created at the source.
        - `originalId` string: Optional. The unique identifier of the API in the system where it was originally created.
        - `originalUpdateTime` string, google-datetime: Required. Timestamp indicating when the API was last updated at the source.
        - `versions` GoogleCloudApihubV1VersionMetadata[]: Optional. The list of versions present in an API resource.
          - `deployments` GoogleCloudApihubV1DeploymentMetadata[]: Optional. The deployments linked to this API version. Note: A particular API version could be deployed to multiple deployments (for dev deployment, UAT deployment, etc.)
            - `deployment` GoogleCloudApihubV1Deployment: Details of the deployment where APIs are hosted. A deployment could represent an Apigee proxy, API gateway, other Google Cloud services or non-Google Cloud services as well. A deployment entity is a root level entity in the API hub and exists independent of any API.
              - …
            - `originalCreateTime` string, google-datetime: Optional. Timestamp indicating when the deployment was created at the source.
            - `originalId` string: Optional. The unique identifier of the deployment in the system where it was originally created.
            - `originalUpdateTime` string, google-datetime: Required. Timestamp indicating when the deployment was last updated at the source.
          - `originalCreateTime` string, google-datetime: Optional. Timestamp indicating when the version was created at the source.
          - `originalId` string: Optional. The unique identifier of the version in the system where it was originally created.
          - `originalUpdateTime` string, google-datetime: Required. Timestamp indicating when the version was last updated at the source.
          - `specs` GoogleCloudApihubV1SpecMetadata[]: Optional. The specs associated with this version. Note that an API version can be associated with multiple specs.
            - `deploymentResourceUris` string[]: Optional. The gateway-side URIs of deployments that serve this spec. If provided, the API Hub service creates links between this spec and the deployments identified by these URIs. URIs that don't match any known deployment are ignored; a subsequent ingestion cycle that includes the missing deployment will re-establish the link. The maximum number of URIs allowed is 100.
            - `originalCreateTime` string, google-datetime: Optional. Timestamp indicating when the spec was created at the source.
            - `originalId` string: Optional. The unique identifier of the spec in the system where it was originally created.
            - `originalUpdateTime` string, google-datetime: Required. Timestamp indicating when the spec was last updated at the source.
            - `spec` GoogleCloudApihubV1Spec: Represents a spec associated with an API version in the API Hub. Note that specs of various types can be uploaded, however parsing of details is supported for OpenAPI spec currently.
              - …
          - `version` GoogleCloudApihubV1Version: Represents a version of the API resource in API hub. This is also referred to as the API version.
            - `accreditation` GoogleCloudApihubV1AttributeValues: The attribute values associated with resource.
              - …
            - `apiOperations` string[]: Output only. The operations contained in the API version. These operations will be added to the version when a new spec is added or when an existing spec is updated. Format is `projects/{project}/locations/{location}/apis/{api}/versions/{version}/operations/{operation}`
            - `attributes` object: Optional. 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.
            - `compliance` GoogleCloudApihubV1AttributeValues: The attribute values associated with resource.
              - …
            - `createTime` string, google-datetime: Output only. The time at which the version was created.
            - `definitions` string[]: Output only. The definitions contained in the API version. These definitions will be added to the version when a new spec is added or when an existing spec is updated. Format is `projects/{project}/locations/{location}/apis/{api}/versions/{version}/definitions/{definition}`
            - `deployments` string[]: Optional. The deployments linked directly to this API version. Only directly-linked deployments are returned; deployments linked to this version's specs or operations are not included. 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}`
            - `description` string: Optional. The description of the version.
            - `displayName` string: Required. The display name of the version.
            - `documentation` GoogleCloudApihubV1Documentation: Documentation details.
              - …
            - `lifecycle` GoogleCloudApihubV1AttributeValues: The attribute values associated with resource.
              - …
            - `name` string: Identifier. The name of the version. Format: `projects/{project}/locations/{location}/apis/{api}/versions/{version}`
            - `selectedDeployment` string: Optional. 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}`
            - `sourceMetadata` GoogleCloudApihubV1SourceMetadata[]: Output only. The list of sources and metadata from the sources of the version.
              - …
            - `specs` string[]: Output only. The specs associated with this version. Note that an API version can be associated with multiple specs. Format is `projects/{project}/locations/{location}/apis/{api}/versions/{version}/specs/{spec}`
            - `updateTime` string, google-datetime: Output only. The time at which the version was last updated.
  - `collectionType` 'COLLECTION_TYPE_UNSPECIFIED' | 'COLLECTION_TYPE_UPSERT' | 'COLLECTION_TYPE_DELETE': Required. The type of collection. Applies to all entries in api_data.
  - `pluginInstance` string: Required. The plugin instance collecting the API data. Format: `projects/{project}/locations/{location}/plugins/{plugin}/instances/{instance}`.

## Response `200`

Successful response

- GoogleLongrunningOperation: This resource represents a long-running operation that is the result of a network API call.
  - `done` boolean: If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.
  - `error` GoogleRpcStatus: The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
    - `code` integer: The status code, which should be an enum value of google.rpc.Code.
    - `details` object[]: A list of messages that carry the error details. There is a common set of message types for APIs to use.
    - `message` string: A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
  - `metadata` object: Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.
  - `name` string: The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.
  - `response` object: The normal, successful response of the operation. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.

## Changes

- **2026-11-08** `09b6c7d2247b`: 4 info
  - the security scope `https://www.googleapis.com/auth/apihub.readwrite` was added to the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/apihub.readwrite` was added to the endpoint's security scheme `Oauth2c`
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was removed from the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was removed from the endpoint's security scheme `Oauth2c`

[Operation history](https://skmtc.dev/google/apis/apihub/changes/v1/projects/:projectsId/locations/:locationsId:collectApiData/post.md)

---

[API](https://skmtc.dev/google/apis/apihub.md) - [All operations](https://skmtc.dev/google/apis/apihub/llms.txt) - [OpenAPI document](https://skmtc.dev/google/apis/apihub/revisions/09b6c7d2247b?raw)
