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

# POST /v1/projects/{projectsId}/locations/{locationsId}/plugins/{pluginsId}/instances

`POST /v1/projects/{projectsId}/locations/{locationsId}/plugins/{pluginsId}/instances`

## Request

- Base URL: `https://apihub.googleapis.com`
- URL: `https://apihub.googleapis.com/v1/projects/{projectsId}/locations/{locationsId}/plugins/{pluginsId}/instances`
- 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/plugins/:pluginsId/instances/post.ts> (a function with typed inputs; its response is checked against the schema)

Creates a Plugin instance in the API hub.

## Path parameters

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

## Query parameters

- `pluginInstanceId` string

## Request body

- GoogleCloudApihubV1PluginInstance: Represents a plugin instance resource in the API Hub. A PluginInstance is a specific instance of a hub plugin with its own configuration, state, and execution details.
  - `actions` GoogleCloudApihubV1PluginInstanceAction[]: Required. The action status for the plugin instance.
    - `actionId` string: Required. This should map to one of the action id specified in actions_config in the plugin.
    - `curationConfig` GoogleCloudApihubV1CurationConfig: The curation information for this plugin instance.
      - `curationType` 'CURATION_TYPE_UNSPECIFIED' | 'DEFAULT_CURATION_FOR_API_METADATA' | 'CUSTOM_CURATION_FOR_API_METADATA': Required. The curation type for this plugin instance.
      - `customCuration` GoogleCloudApihubV1CustomCuration: Custom curation information for this plugin instance.
        - `curation` string: Required. The unique name of the curation resource. This will be the name of the curation resource in the format: `projects/{project}/locations/{location}/curations/{curation}`
    - `hubInstanceAction` GoogleCloudApihubV1ExecutionStatus: The execution status for the plugin instance.
      - `currentExecutionState` 'CURRENT_EXECUTION_STATE_UNSPECIFIED' | 'RUNNING' | 'NOT_RUNNING': Output only. The current state of the execution.
      - `lastExecution` GoogleCloudApihubV1LastExecution: The result of the last execution of the plugin instance.
        - `endTime` string, google-datetime: Output only. The last execution end time of the plugin instance.
        - `errorMessage` string: Output only. Error message describing the failure, if any, during the last execution.
        - `result` 'RESULT_UNSPECIFIED' | 'SUCCEEDED' | 'FAILED': Output only. The result of the last execution of the plugin instance.
        - `resultMetadata` string: Output only. The result metadata of the last execution of the plugin instance. This will be a string representation of a JSON object and will be available on successful execution.
        - `startTime` string, google-datetime: Output only. The last execution start time of the plugin instance.
    - `resourceConfig` GoogleCloudApihubV1ResourceConfig: The configuration of resources created for a given plugin instance action.
      - `actionType` 'ACTION_TYPE_UNSPECIFIED' | 'SYNC_METADATA' | 'SYNC_RUNTIME_DATA': Output only. The type of the action.
      - `pubsubTopic` string: Output only. The pubsub topic to publish the data to. Format is projects/{project}/topics/{topic}
    - `scheduleCronExpression` string: Optional. The schedule for this plugin instance action. This can only be set if the plugin supports API_HUB_SCHEDULE_TRIGGER mode for this action.
    - `scheduleTimeZone` string: Optional. The time zone for the schedule cron expression. If not provided, UTC will be used.
    - `serviceAccount` string: Optional. The service account used to publish data. Note, the service account will only be accepted for non-Google Cloud plugins like OPDK.
    - `state` 'STATE_UNSPECIFIED' | 'ENABLED' | 'DISABLED' | 'ENABLING' | 'DISABLING' | 'ERROR': Output only. The current state of the plugin action in the plugin instance.
  - `additionalConfig` object: Optional. The additional information for this plugin instance corresponding to the additional config template of the plugin. This information will be sent to plugin hosting service on each call to plugin hosted service. The key will be the config_variable_template.display_name to uniquely identify the config variable.
  - `authConfig` GoogleCloudApihubV1AuthConfig: AuthConfig represents the authentication information.
    - `apiKeyConfig` GoogleCloudApihubV1ApiKeyConfig: Config for authentication with API key.
      - `apiKey` GoogleCloudApihubV1Secret: Secret provides a reference to entries in Secret Manager.
        - `secretVersion` string: Required. The resource name of the secret version in the format, format as: `projects/*/secrets/*/versions/*`.
      - `httpElementLocation` 'HTTP_ELEMENT_LOCATION_UNSPECIFIED' | 'QUERY' | 'HEADER' | 'PATH' | 'BODY' | 'COOKIE': Required. The location of the API key. The default value is QUERY.
      - `name` string: Required. The parameter name of the API key. E.g. If the API request is "https://example.com/act?api_key=", "api_key" would be the parameter name.
    - `authType` 'AUTH_TYPE_UNSPECIFIED' | 'NO_AUTH' | 'GOOGLE_SERVICE_ACCOUNT' | 'USER_PASSWORD' | 'API_KEY' | 'OAUTH2_CLIENT_CREDENTIALS': Required. The authentication type.
    - `googleServiceAccountConfig` GoogleCloudApihubV1GoogleServiceAccountConfig: Config for Google service account authentication.
      - `serviceAccount` string: Required. The service account to be used for authenticating request. The `iam.serviceAccounts.getAccessToken` permission should be granted on this service account to the impersonator service account.
    - `oauth2ClientCredentialsConfig` GoogleCloudApihubV1Oauth2ClientCredentialsConfig: Parameters to support Oauth 2.0 client credentials grant authentication. See https://tools.ietf.org/html/rfc6749#section-1.3.4 for more details.
      - `clientId` string: Required. The client identifier.
      - `clientSecret` GoogleCloudApihubV1Secret: Secret provides a reference to entries in Secret Manager.
        - `secretVersion` string: Required. The resource name of the secret version in the format, format as: `projects/*/secrets/*/versions/*`.
    - `userPasswordConfig` GoogleCloudApihubV1UserPasswordConfig: Parameters to support Username and Password Authentication.
      - `password` GoogleCloudApihubV1Secret: Secret provides a reference to entries in Secret Manager.
        - `secretVersion` string: Required. The resource name of the secret version in the format, format as: `projects/*/secrets/*/versions/*`.
      - `username` string: Required. Username.
  - `createTime` string, google-datetime: Output only. Timestamp indicating when the plugin instance was created.
  - `displayName` string: Required. The display name for this plugin instance. Max length is 500 characters.
  - `errorMessage` string: Output only. Error message describing the failure, if any, during Create, Delete or ApplyConfig operation corresponding to the plugin instance.This field will only be populated if the plugin instance is in the ERROR or FAILED state.
  - `name` string: Identifier. The unique name of the plugin instance resource. Format: `projects/{project}/locations/{location}/plugins/{plugin}/instances/{instance}`
  - `sourceEnvironmentsConfig` object: Optional. The source environment's config present in the gateway instance linked to the plugin instance. The key is the `source_environment` name from the SourceEnvironment message.
  - `sourceProjectId` string: Optional. The source project id of the plugin instance. This will be the id of runtime project in case of Google Cloud based plugins and org id in case of non-Google Cloud based plugins. This field will be a required field for Google provided on-ramp plugins.
  - `state` 'STATE_UNSPECIFIED' | 'CREATING' | 'ACTIVE' | 'APPLYING_CONFIG' | 'ERROR' | 'FAILED' | 'DELETING': Output only. The current state of the plugin instance (e.g., enabled, disabled, provisioning).
  - `updateTime` string, google-datetime: Output only. Timestamp indicating when the plugin instance was last updated.

## 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/plugins/:pluginsId/instances/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)
