#   Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
#
#   Licensed under the Apache License, Version 2.0 (the "License");
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.
################################################################################
openapi: 3.0.1
info:
  title: WSO2 API Manager - Admin
  description: |
    This document specifies a **RESTful API** for WSO2 **API Manager** - **Admin Portal**.
    Please see [full OpenAPI Specification](https://raw.githubusercontent.com/wso2/carbon-apimgt/v6.7.206/components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml) of the API which is written using [OAS 3.0](http://swagger.io/) specification.

    # Authentication
    Our REST APIs are protected using OAuth2 and access control is achieved through scopes. Before you start invoking
    the the API you need to obtain an access token with the required scopes. This guide will walk you through the steps
    that you will need to follow to obtain an access token.
    First you need to obtain the consumer key/secret key pair by calling the dynamic client registration (DCR) endpoint. You can add your preferred grant types
    in the payload. A sample payload is shown below.
    ```
      {
      "callbackUrl":"www.google.lk",
      "clientName":"rest_api_admin",
      "owner":"admin",
      "grantType":"client_credentials password refresh_token",
      "saasApp":true
      }
    ```
    Create a file (payload.json) with the above sample payload, and use the cURL shown bellow to invoke the DCR endpoint. Authorization header of this should contain the
    base64 encoded admin username and password.
    **Format of the request**
    ```
      curl -X POST -H "Authorization: Basic Base64(admin_username:admin_password)" -H "Content-Type: application/json"
      \ -d @payload.json https://<host>:<servlet_port>/client-registration/v0.17/register
    ```
    **Sample request**
    ```
      curl -X POST -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Content-Type: application/json"
      \ -d @payload.json https://localhost:9443/client-registration/v0.17/register
    ```
    Following is a sample response after invoking the above curl.
    ```
    {
    "clientId": "fOCi4vNJ59PpHucC2CAYfYuADdMa",
    "clientName": "rest_api_admin",
    "callBackURL": "www.google.lk",
    "clientSecret": "a4FwHlq0iCIKVs2MPIIDnepZnYMa",
    "isSaasApplication": true,
    "appOwner": "admin",
    "jsonString": "{\"grant_types\":\"client_credentials password refresh_token\",\"redirect_uris\":\"www.google.lk\",\"client_name\":\"rest_api_admin\"}",
    "jsonAppAttribute": "{}",
    "tokenType": null
    }
    ```
    Next you must use the above client id and secret to obtain the access token.
    We will be using the password grant type for this, you can use any grant type you desire.
    You also need to add the proper **scope** when getting the access token. All possible scopes for Admin REST API can be viewed in **OAuth2 Security** section
    of this document and scope for each resource is given in **authorizations** section of resource documentation.
    Following is the format of the request if you are using the password grant type.
    ```
    curl -k -d "grant_type=password&username=<admin_username>&password=<admin_passowrd>&scope=<scopes seperated by space>"
    \ -H "Authorization: Basic base64(cliet_id:client_secret)"
    \ https://<host>:<gateway_port>/token
    ```
    **Sample request**
    ```
    curl https://localhost:8243/token -k \
    -H "Authorization: Basic Zk9DaTR2Tko1OVBwSHVjQzJDQVlmWXVBRGRNYTphNEZ3SGxxMGlDSUtWczJNUElJRG5lcFpuWU1h" \
    -d "grant_type=password&username=admin&password=admin&scope=apim:admin apim:tier_view"
    ```
    Shown below is a sample response to the above request.
    ```
    {
    "access_token": "e79bda48-3406-3178-acce-f6e4dbdcbb12",
    "refresh_token": "a757795d-e69f-38b8-bd85-9aded677a97c",
    "scope": "apim:admin apim:tier_view",
    "token_type": "Bearer",
    "expires_in": 3600
    }
    ```
    Now you have a valid access token, which you can use to invoke an API.
    Navigate through the API descriptions to find the required API, obtain an access token as described above and invoke the API with the authentication header.
    If you use a different authentication mechanism, this process may change.

    # Try out in Postman
    If you want to try-out the embedded postman collection with "Run in Postman" option, please follow the guidelines listed below.
    * All of the OAuth2 secured endpoints have been configured with an Authorization Bearer header with a parameterized access token. Before invoking any REST API resource make sure you run the `Register DCR Application` and `Generate Access Token` requests to fetch an access token with all required scopes.
    * Make sure you have an API Manager instance up and running.
    * Update the `basepath` parameter to match the hostname and port of the APIM instance.

    [![Run in Postman](https://run.pstmn.io/button.svg)](https://app.getpostman.com/run-collection/f5ac2ca9fb22afef6ed6)
  contact:
    name: WSO2
    url: http://wso2.com/products/api-manager/
    email: architecture@wso2.com
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  version: v4
servers:
  - url: https://apis.wso2.com/api/am/admin/v4
paths:
  ######################################################
  # The "Content Search Results" Throttling Policies
  ######################################################
  /throttling/policies/search:
    get:
      tags:
        - Throttling Policy Search
      summary: |
        Retrieve/Search Throttling Policies
      description: |
        This operation provides you a list of available Throttling Policies qualifying the given keyword match.
      parameters:
        - name: query
          in: query
          description: |
            **Search**.
            You can search by providing a keyword. Allowed to search by type only.
          schema:
            type: string
      responses:
        200:
          description: |
            OK.
            List of qualifying Throttling Policies is returned.
          headers:
            Content-Type:
              description: The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ThrottlePolicyDetailsList'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:tier_view
      x-code-samples:
        - lang: Curl
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/throttling/policies/search?query=type:sub"'
      operationId: throttlingPolicySearch

  ######################################################
  # The "Application Throttling Policy Collection" resource API
  ######################################################
  /throttling/policies/application:
    get:
      tags:
        - Application Policy (Collection)
      summary: Get all Application Throttling Policies
      description: |
        Retrieves all existing application throttling policies.
      parameters:
        - $ref: '#/components/parameters/Accept'
        - $ref: '#/components/parameters/If-None-Match'
        - $ref: '#/components/parameters/If-Modified-Since'
      responses:
        200:
          description: |
            OK.
            Policies returned
          headers:
            ETag:
              description: |
                Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future).
              schema:
                type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              schema:
                type: string
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApplicationThrottlePolicyList'
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
          content: {}
        406:
          $ref: '#/components/responses/NotAcceptable'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:tier_view
      x-code-samples:
        - lang: Shell
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/throttling/policies/application"'

    post:
      tags:
        - Application Policy (Collection)
      summary: Add an Application Throttling Policy
      description: |
        This operation can be used to add a new application level throttling policy.
      parameters:
        - $ref: '#/components/parameters/Content-Type'
      requestBody:
        description: |
          Application level policy object that should to be added
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApplicationThrottlePolicy'
        required: true
      responses:
        201:
          description: |
            Created.
            Successful response with the newly created object as entity in the body.
            Location header contains URL of newly created entity.
          headers:
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              schema:
                type: string
            Location:
              description: |
                Location of the newly created Policy object.
              schema:
                type: string
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApplicationThrottlePolicy'
              example:
                policyId: e0fd4a15-969e-4056-94c8-8a7b56f8103f
                policyName: 20PerMin
                displayName: 20PerMin
                description: Allows 20 request per minute
                isDeployed: true
                defaultLimit:
                  type: REQUESTCOUNTLIMIT
                  requestCount:
                    timeUnit: min
                    unitTime: 1
                    requestCount: 20
        400:
          $ref: '#/components/responses/BadRequest'
        415:
          $ref: '#/components/responses/UnsupportedMediaType'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:tier_manage
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          -H "Content-Type: application/json" -d @data.json "https://127.0.0.1:9443/api/am/admin/v4/throttling/policies/application"'

  ######################################################
  # The "Individual Application Throttling Policy" resource API
  ######################################################
  /throttling/policies/application/{policyId}:
    get:
      tags:
        - Application Policy (Individual)
      summary: Get an Application Throttling Policy
      description: |
        Retrieves an application throttling policy.
      parameters:
        - $ref: '#/components/parameters/policyId'
        - $ref: '#/components/parameters/If-None-Match'
        - $ref: '#/components/parameters/If-Modified-Since'
      responses:
        200:
          description: |
            OK.
            Policy returned
          headers:
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              schema:
                type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              schema:
                type: string
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApplicationThrottlePolicy'
              example:
                policyId: e0fd4a15-969e-4056-94c8-8a7b56f8103f
                policyName: 20PerMin
                displayName: 20PerMin
                description: Allows 20 request per minute
                isDeployed: true
                defaultLimit:
                  type: REQUESTCOUNTLIMIT
                  requestCount:
                    timeUnit: min
                    unitTime: 1
                    requestCount: 20
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
          content: {}
        404:
          $ref: '#/components/responses/NotFound'
        406:
          $ref: '#/components/responses/NotAcceptable'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:tier_view
      x-code-samples:
        - lang: Shell
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/throttling/policies/application/4e098fff-7f94-459a-981f-d257332f69d0"'

    put:
      tags:
        - Application Policy (Individual)
      summary: Update an Application Throttling policy
      description: |
        Updates an existing application level throttling policy. Upon a succesfull update, you will receive the updated application policy as the response.
      parameters:
        - $ref: '#/components/parameters/policyId'
        - $ref: '#/components/parameters/Content-Type'
        - $ref: '#/components/parameters/If-Match'
        - $ref: '#/components/parameters/If-Unmodified-Since'
      requestBody:
        description: |
          Policy object that needs to be modified
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApplicationThrottlePolicy'
        required: true
      responses:
        200:
          description: |
            OK.
            Policy updated.
          headers:
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional request.
              schema:
                type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional reuquests.
              schema:
                type: string
            Location:
              description: |
                The URL of the newly created resource.
              schema:
                type: string
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApplicationThrottlePolicy'
              example:
                policyId: e0fd4a15-969e-4056-94c8-8a7b56f8103f
                policyName: 20PerMin
                displayName: 20PerMin
                description: Allows 20 request per minute
                isDeployed: true
                defaultLimit:
                  type: REQUESTCOUNTLIMIT
                  requestCount:
                    timeUnit: min
                    unitTime: 1
                    requestCount: 20
        400:
          $ref: '#/components/responses/BadRequest'
        404:
          $ref: '#/components/responses/NotFound'
        412:
          $ref: '#/components/responses/PreconditionFailed'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:tier_manage
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          -H "Content-Type: application/json" -d @data.json "https://127.0.0.1:9443/api/am/admin/v4/throttling/policies/application/4e098fff-7f94-459a-981f-d257332f69d0"'

    delete:
      tags:
        - Application Policy (Individual)
      summary: Delete an Application Throttling policy
      description: |
        Deletes an application level throttling policy.
      parameters:
        - $ref: '#/components/parameters/policyId'
        - $ref: '#/components/parameters/If-Match'
        - $ref: '#/components/parameters/If-Unmodified-Since'
      responses:
        200:
          description: |
            OK.
            Resource successfully deleted.
          content: {}
        404:
          $ref: '#/components/responses/NotFound'
        412:
          $ref: '#/components/responses/PreconditionFailed'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:tier_manage
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X DELETE -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/throttling/policies/application/4e098fff-7f94-459a-981f-d257332f69d0"'

  ######################################################
  # The "Global Mediation Policy Collections" resource API
  ######################################################
  /policies/mediation:
    get:
      tags:
        - Mediation Policy (Collection)
      summary: |
        Get all Global Mediation Policies
      description: |
        This operation provides you a list of all available global mediation policies.
      parameters:
        - $ref: '#/components/parameters/limit'
        - $ref: '#/components/parameters/offset'
        - name: query
          in: query
          description: -Not supported yet-
          schema:
            type: string
        - $ref: '#/components/parameters/Accept'
        - $ref: '#/components/parameters/If-None-Match'
      responses:
        200:
          description: |
            OK.
            List of mediation policies is returned.
          headers:
            ETag:
              description: |
                Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future).
              schema:
                type: string
            Content-Type:
              description: The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/mediationList'
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
          content: {}
        406:
          $ref: '#/components/responses/NotAcceptable'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:mediation_policy_view
      x-code-samples:
        - lang: Shell
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/policies/mediation"'

    post:
      tags:
        - Mediation Policy (Collection)
      summary: Add a Global Mediation Policy
      description: |
        This operation can be used to add a new global mediation policy.
      parameters:
        - $ref: '#/components/parameters/Content-Type'
        - $ref: '#/components/parameters/If-Match'
        - $ref: '#/components/parameters/If-Unmodified-Since'
      requestBody:
        description: mediation policy to upload
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Mediation'
        required: true
      responses:
        200:
          description: |
            OK.
            Mediation policy added successfully.
          headers:
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              schema:
                type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              schema:
                type: string
            Location:
              description: |
                The URL of the uploaded thumbnail image of the API.
              schema:
                type: string
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Mediation'
        400:
          $ref: '#/components/responses/BadRequest'
        404:
          $ref: '#/components/responses/NotFound'
        412:
          $ref: '#/components/responses/PreconditionFailed'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:mediation_policy_create
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          -H "Content-Type: application/json" -d @data.json "https://127.0.0.1:9443/api/am/admin/v4/policies/mediation"'

  ######################################################
  # The "Individual Global Mediation Policy" resource
  ######################################################
  /policies/mediation/{mediationPolicyId}:
    get:
      tags:
        - Mediation Policy (Individual)
      summary: Get a Global Mediation Policy
      description: |
        This operation can be used to retrieve a particular global mediation policy.
      parameters:
        - $ref: '#/components/parameters/mediationPolicyId'
        - $ref: '#/components/parameters/Accept'
        - $ref: '#/components/parameters/If-None-Match'
        - $ref: '#/components/parameters/If-Modified-Since'
      responses:
        200:
          description: |
            OK.
            Mediation Policy returned.
          headers:
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              schema:
                type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              schema:
                type: string
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Mediation'
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
          content: {}
        404:
          $ref: '#/components/responses/NotFound'
        406:
          $ref: '#/components/responses/NotAcceptable'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:mediation_policy_view
      x-code-samples:
        - lang: Shell
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/policies/mediation/2253cf01-0356-4cc1-9941-3034a8c29007"'

    put:
      tags:
        - Mediation Policy (Individual)
      summary: Update a Global Mediation Policy
      description: |
        This operation can be used to update an existing global mediation policy.
      parameters:
        - $ref: '#/components/parameters/mediationPolicyId'
        - $ref: '#/components/parameters/Content-Type'
        - $ref: '#/components/parameters/If-Match'
        - $ref: '#/components/parameters/If-Unmodified-Since'
      requestBody:
        description: |
          Mediation policy object that needs to be updated
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Mediation'
        required: true
      responses:
        200:
          description: |
            OK.
            Successful response with updated mediation policy object
          headers:
            ETag:
              description: |
                Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future).
              schema:
                type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              schema:
                type: string
            Location:
              description: |
                The URL of the newly created resource.
              schema:
                type: string
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Mediation'
        400:
          $ref: '#/components/responses/BadRequest'
        403:
          $ref: '#/components/responses/Forbidden'
        404:
          $ref: '#/components/responses/NotFound'
        412:
          $ref: '#/components/responses/PreconditionFailed'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:mediation_policy_create
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          -H "Content-Type: application/json" -d @data.json "https://127.0.0.1:9443/api/am/admin/v4/policies/mediation/2253cf01-0356-4cc1-9941-3034a8c29007"'

    delete:
      tags:
        - Mediation Policy (Individual)
      summary: Delete a Global Mediation Policy
      description: |
        This operation can be used to delete an existing global mediation policy providing the Id of the mediation policy.
      parameters:
        - $ref: '#/components/parameters/mediationPolicyId'
        - $ref: '#/components/parameters/If-Match'
        - $ref: '#/components/parameters/If-Unmodified-Since'
      responses:
        200:
          description: |
            OK.
            Mediation policy successfully deleted.
          content: {}
        403:
          $ref: '#/components/responses/Forbidden'
        404:
          $ref: '#/components/responses/NotFound'
        412:
          $ref: '#/components/responses/PreconditionFailed'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:mediation_policy_create
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X DELETE -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/policies/mediation/2253cf01-0356-4cc1-9941-3034a8c29007"'

  ######################################################
  # The "Subscription Throttling Policy Collection" resource API
  ######################################################
  /throttling/policies/subscription:
    get:
      tags:
        - Subscription Policy (Collection)
      summary: Get all Subscription Throttling Policies
      description: |
        This operation can be used to retrieve all Subscription level throttling policies.
      parameters:
        - $ref: '#/components/parameters/Accept'
        - $ref: '#/components/parameters/If-None-Match'
        - $ref: '#/components/parameters/If-Modified-Since'
      responses:
        200:
          description: |
            OK.
            Policies returned
          headers:
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              schema:
                type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              schema:
                type: string
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionThrottlePolicyList'
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
          content: {}
        406:
          $ref: '#/components/responses/NotAcceptable'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:tier_view
      x-code-samples:
        - lang: Shell
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/throttling/policies/subscription"'

    post:
      tags:
        - Subscription Policy (Collection)
      summary: Add a Subscription Throttling Policy
      description: |
        This operation can be used to add a Subscription level throttling policy specifying the details of the policy in the payload.
      parameters:
        - $ref: '#/components/parameters/Content-Type'
      requestBody:
        description: |
          Subscripion level policy object that should to be added
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubscriptionThrottlePolicy'
        required: true
      responses:
        201:
          description: |
            Created.
            Successful response with the newly created object as entity in the body.
            Location header contains URL of newly created entity.
          headers:
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              schema:
                type: string
            Location:
              description: |
                Location of the newly created Policy object.
              schema:
                type: string
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionThrottlePolicy'
              example:
                policyId: 78c3ebff-176d-40d8-9377-fb3276528291
                policyName: Gold
                displayName: Gold
                description: Allows 5000 requests per minute
                isDeployed: true
                graphQLMaxComplexity: 0
                graphQLMaxDepth: 0
                subscriberCount: 0
                defaultLimit:
                  type: REQUESTCOUNTLIMIT
                  requestCount:
                    timeUnit: min
                    unitTime: 1
                    requestCount: 5000
                rateLimitCount: 0
                customAttributes: []
                stopOnQuotaReach: true
                billingPlan: FREE
        400:
          $ref: '#/components/responses/BadRequest'
        415:
          $ref: '#/components/responses/UnsupportedMediaType'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:tier_manage
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          -H "Content-Type: application/json" -d @data.json "https://127.0.0.1:9443/api/am/admin/v4/throttling/policies/subscription"'

  ######################################################
  # The "Individual Subscription Throttling Policy" resource API
  ######################################################
  /throttling/policies/subscription/{policyId}:
    get:
      tags:
        - Subscription Policy (Individual)
      summary: Get a Subscription Policy
      description: |
        This operation can be used to retrieves subscription level throttling policy by specifying the Id of the policy as a path paramter
      parameters:
        - $ref: '#/components/parameters/policyId'
        - $ref: '#/components/parameters/If-None-Match'
        - $ref: '#/components/parameters/If-Modified-Since'
      responses:
        200:
          description: |
            OK.
            Policy returned
          headers:
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              schema:
                type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              schema:
                type: string
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionThrottlePolicy'
              example:
                policyId: 78c3ebff-176d-40d8-9377-fb3276528291
                policyName: Gold
                displayName: Gold
                description: Allows 5000 requests per minute
                isDeployed: true
                graphQLMaxComplexity: 0
                graphQLMaxDepth: 0
                subscriberCount: 0
                defaultLimit:
                  type: REQUESTCOUNTLIMIT
                  requestCount:
                    timeUnit: min
                    unitTime: 1
                    requestCount: 5000
                rateLimitCount: 0
                customAttributes: []
                stopOnQuotaReach: true
                billingPlan: FREE
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
          content: {}
        404:
          $ref: '#/components/responses/NotFound'
        406:
          $ref: '#/components/responses/NotAcceptable'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:tier_view
      x-code-samples:
        - lang: Shell
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/throttling/policies/subscription/c948c723-71dd-4d50-8c77-0a0e99c8cbb1"'

    put:
      tags:
        - Subscription Policy (Individual)
      summary: Update a Subscription Policy
      description: |
        Updates an existing subscription level throttling policy.
      parameters:
        - $ref: '#/components/parameters/policyId'
        - $ref: '#/components/parameters/Content-Type'
        - $ref: '#/components/parameters/If-Match'
        - $ref: '#/components/parameters/If-Unmodified-Since'
      requestBody:
        description: |
          Policy object that needs to be modified
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubscriptionThrottlePolicy'
        required: true
      responses:
        200:
          description: |
            OK.
            Policy updated.
          headers:
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              schema:
                type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              schema:
                type: string
            Location:
              description: |
                The URL of the newly created resource.
              schema:
                type: string
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionThrottlePolicy'
              example:
                policyId: 78c3ebff-176d-40d8-9377-fb3276528291
                policyName: Gold
                displayName: Gold
                description: Allows 5000 requests per minute
                isDeployed: true
                graphQLMaxComplexity: 0
                graphQLMaxDepth: 0
                subscriberCount: 0
                defaultLimit:
                  type: REQUESTCOUNTLIMIT
                  requestCount:
                    timeUnit: min
                    unitTime: 1
                    requestCount: 5000
                rateLimitCount: 0
                customAttributes: []
                stopOnQuotaReach: true
                billingPlan: FREE
        400:
          $ref: '#/components/responses/BadRequest'
        404:
          $ref: '#/components/responses/NotFound'
        412:
          $ref: '#/components/responses/PreconditionFailed'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:tier_manage
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          -H "Content-Type: application/json" -d @data.json "https://127.0.0.1:9443/api/am/admin/v4/throttling/policies/subscription/c948c723-71dd-4d50-8c77-0a0e99c8cbb1"'

    delete:
      tags:
        - Subscription Policy (Individual)
      summary: Delete a Subscription Policy
      description: |
        This operation can be used to delete a subscription level throttling policy by specifying the Id of the policy as a path paramter.
      parameters:
        - $ref: '#/components/parameters/policyId'
        - $ref: '#/components/parameters/If-Match'
        - $ref: '#/components/parameters/If-Unmodified-Since'
      responses:
        200:
          description: |
            OK.
            Resource successfully deleted.
          content: {}
        404:
          $ref: '#/components/responses/NotFound'
        412:
          $ref: '#/components/responses/PreconditionFailed'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:tier_manage
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X DELETE -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/throttling/policies/subscription/c948c723-71dd-4d50-8c77-0a0e99c8cbb1"'

  ######################################################
  # The "Custom Rules Collection" resource API
  ######################################################
  /throttling/policies/custom:
    get:
      tags:
        - Custom Rules (Collection)
      summary: Get all Custom Rules
      description: |
        Retrieves all custom rules.

        **NOTE:**
        * Only super tenant users are allowed for this operation.
      parameters:
        - $ref: '#/components/parameters/Accept'
        - $ref: '#/components/parameters/If-None-Match'
        - $ref: '#/components/parameters/If-Modified-Since'
      responses:
        200:
          description: |
            OK.
            Policies returned
          headers:
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              schema:
                type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              schema:
                type: string
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomRuleList'
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
          content: {}
        406:
          $ref: '#/components/responses/NotAcceptable'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:tier_view
      x-code-samples:
        - lang: Shell
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/throttling/policies/custom"'

    post:
      tags:
        - Custom Rules (Collection)
      summary: Add a Custom Rule
      description: |
        Adds a new custom rule.

        **NOTE:**
        * Only super tenant users are allowed for this operation.
      parameters:
        - $ref: '#/components/parameters/Content-Type'
      requestBody:
        description: |
          Custom Rule object that should to be added
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomRule'
        required: true
      responses:
        201:
          description: |
            Created.
            Successful response with the newly created object as entity in the body.
            Location header contains URL of newly created entity.
          headers:
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              schema:
                type: string
            Location:
              description: |
                Location of the newly created resource.
              schema:
                type: string
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomRule'
              example:
                policyId: 7c7ed7c4-5a7c-4e08-850a-a95bbfcc2fb6
                policyName: custom
                description: Allow 10 requests per minute for admin user
                isDeployed: true
                siddhiQuery: "FROM RequestStream\nSELECT userId, ( userId == 'admin@carbon.super'\
                  \ ) AS isEligible , str:concat('admin@carbon.super','') as throttleKey\n\
                  INSERT INTO EligibilityStream; \n\nFROM EligibilityStream[isEligible==true]#throttler:timeBatch(1\
                  \ min) \nSELECT throttleKey, (count(userId) >= 10) as isThrottled,\
                  \ expiryTimeStamp group by throttleKey \nINSERT ALL EVENTS into\
                  \ ResultStream;"
                keyTemplate: $userId
        400:
          $ref: '#/components/responses/BadRequest'
        415:
          $ref: '#/components/responses/UnsupportedMediaType'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:tier_manage
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          -H "Content-Type: application/json" -d @data.json "https://127.0.0.1:9443/api/am/admin/v4/throttling/policies/custom"'

  ######################################################
  # The "Individual Custom Rule" resource API
  ######################################################
  /throttling/policies/custom/{ruleId}:
    get:
      tags:
        - Custom Rules (Individual)
      summary: Get a Custom Rule
      description: |
        Retrieves a custom rule. We need to provide the policy Id as a path parameter.

        **NOTE:**
        * Only super tenant users are allowed for this operation.
      parameters:
        - $ref: '#/components/parameters/ruleId'
        - $ref: '#/components/parameters/If-None-Match'
        - $ref: '#/components/parameters/If-Modified-Since'
      responses:
        200:
          description: |
            OK.
            Policy returned
          headers:
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              schema:
                type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              schema:
                type: string
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomRule'
              example:
                policyId: 7c7ed7c4-5a7c-4e08-850a-a95bbfcc2fb6
                policyName: custom
                description: Allow 10 requests per minute for admin user
                isDeployed: true
                siddhiQuery: "FROM RequestStream\nSELECT userId, ( userId == 'admin@carbon.super'\
                  \ ) AS isEligible , str:concat('admin@carbon.super','') as throttleKey\n\
                  INSERT INTO EligibilityStream; \n\nFROM EligibilityStream[isEligible==true]#throttler:timeBatch(1\
                  \ min) \nSELECT throttleKey, (count(userId) >= 10) as isThrottled,\
                  \ expiryTimeStamp group by throttleKey \nINSERT ALL EVENTS into\
                  \ ResultStream;"
                keyTemplate: $userId
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
          content: {}
        404:
          $ref: '#/components/responses/NotFound'
        406:
          $ref: '#/components/responses/NotAcceptable'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:tier_view
      x-code-samples:
        - lang: Shell
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/throttling/policies/custom/33662a62-8db1-4d75-af08-afd63c6bd0b4"'

    put:
      tags:
        - Custom Rules (Individual)
      summary: Update a Custom Rule
      description: |
        Updates an existing custom rule.

        **NOTE:**
        * Only super tenant users are allowed for this operation.
      parameters:
        - $ref: '#/components/parameters/ruleId'
        - $ref: '#/components/parameters/Content-Type'
        - $ref: '#/components/parameters/If-Match'
        - $ref: '#/components/parameters/If-Unmodified-Since'
      requestBody:
        description: |
          Policy object that needs to be modified
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomRule'
        required: true
      responses:
        200:
          description: |
            OK.
            Policy updated.
          headers:
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              schema:
                type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              schema:
                type: string
            Location:
              description: |
                The URL of the newly created resource.
              schema:
                type: string
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomRule'
              example:
                policyId: 7c7ed7c4-5a7c-4e08-850a-a95bbfcc2fb6
                policyName: custom
                description: Allow 10 requests per minute for admin user
                isDeployed: true
                siddhiQuery: "FROM RequestStream\nSELECT userId, ( userId == 'admin@carbon.super'\
                  \ ) AS isEligible , str:concat('admin@carbon.super','') as throttleKey\n\
                  INSERT INTO EligibilityStream; \n\nFROM EligibilityStream[isEligible==true]#throttler:timeBatch(1\
                  \ min) \nSELECT throttleKey, (count(userId) >= 10) as isThrottled,\
                  \ expiryTimeStamp group by throttleKey \nINSERT ALL EVENTS into\
                  \ ResultStream;"
                keyTemplate: $userId
        400:
          $ref: '#/components/responses/BadRequest'
        404:
          $ref: '#/components/responses/NotFound'
        412:
          $ref: '#/components/responses/PreconditionFailed'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:tier_manage
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          -H "Content-Type: application/json" -d @data.json "https://127.0.0.1:9443/api/am/admin/v4/throttling/policies/custom/33662a62-8db1-4d75-af08-afd63c6bd0b4"'

    delete:
      tags:
        - Custom Rules (Individual)
      summary: Delete a Custom Rule
      description: |
        Delete a custom rule. We need to provide the Id of the policy as a path parameter.

        **NOTE:**
        * Only super tenant users are allowed for this operation.
      parameters:
        - $ref: '#/components/parameters/ruleId'
        - $ref: '#/components/parameters/If-Match'
        - $ref: '#/components/parameters/If-Unmodified-Since'
      responses:
        200:
          description: |
            OK.
            Resource successfully deleted.
          content: {}
        404:
          $ref: '#/components/responses/NotFound'
        412:
          $ref: '#/components/responses/PreconditionFailed'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:tier_manage
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X DELETE -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/throttling/policies/custom/33662a62-8db1-4d75-af08-afd63c6bd0b4"'

  ######################################################
  # The "Advanced Throttling Policy Collection" resource API
  ######################################################
  /throttling/policies/advanced:
    get:
      tags:
        - Advanced Policy (Collection)
      summary: Get all Advanced Throttling Policies
      description: |
        Retrieves all existing advanced throttling policies.
      parameters:
        - $ref: '#/components/parameters/Accept'
        - $ref: '#/components/parameters/If-None-Match'
        - $ref: '#/components/parameters/If-Modified-Since'
      responses:
        200:
          description: |
            OK.
            Policies returned
          headers:
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              schema:
                type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              schema:
                type: string
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdvancedThrottlePolicyList'
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
          content: {}
        406:
          $ref: '#/components/responses/NotAcceptable'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:tier_view
      x-code-samples:
        - lang: Shell
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/throttling/policies/advanced"'

    post:
      tags:
        - Advanced Policy (Collection)
      summary: Add an Advanced Throttling Policy
      description: |
        Add a new advanced throttling policy.
      parameters:
        - $ref: '#/components/parameters/Content-Type'
      requestBody:
        description: |
          Advanced level policy object that should to be added
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AdvancedThrottlePolicy'
        required: true
      responses:
        201:
          description: |
            Created.
            Successful response with the newly created object as entity in the body.
            Location header contains URL of newly created entity.
          headers:
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              schema:
                type: string
            Location:
              description: |
                Location of the newly created Advanced Throttling Policy.
              schema:
                type: string
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdvancedThrottlePolicy'
              example:
                policyId: 4cf46441-a538-4f79-a499-ab81200c9bca
                policyName: 10KPerMin
                displayName: 10KPerMin
                description: Allows 10000 requests per minute
                isDeployed: true
                defaultLimit:
                  type: REQUESTCOUNTLIMIT
                  requestCount:
                    timeUnit: min
                    unitTime: 1
                    requestCount: 10000
                conditionalGroups: []
        400:
          $ref: '#/components/responses/BadRequest'
        415:
          $ref: '#/components/responses/UnsupportedMediaType'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:tier_manage
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          -H "Content-Type: application/json" -d @data.json "https://127.0.0.1:9443/api/am/admin/v4/throttling/policies/advanced"'

  ######################################################
  # The "Individual Advanced Throttling Policy" resource API
  ######################################################
  /throttling/policies/advanced/{policyId}:
    get:
      tags:
        - Advanced Policy (Individual)
      summary: Get an Advanced Throttling Policy
      description: |
        Retrieves an advanced throttling policy.
      parameters:
        - $ref: '#/components/parameters/policyId'
        - $ref: '#/components/parameters/If-None-Match'
        - $ref: '#/components/parameters/If-Modified-Since'
      responses:
        200:
          description: |
            OK.
            Policy returned
          headers:
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              schema:
                type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              schema:
                type: string
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdvancedThrottlePolicy'
              example:
                policyId: 4cf46441-a538-4f79-a499-ab81200c9bca
                policyName: 10KPerMin
                displayName: 10KPerMin
                description: Allows 10000 requests per minute
                isDeployed: true
                defaultLimit:
                  type: REQUESTCOUNTLIMIT
                  requestCount:
                    timeUnit: min
                    unitTime: 1
                    requestCount: 10000
                conditionalGroups: []
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
          content: {}
        404:
          $ref: '#/components/responses/NotFound'
        406:
          $ref: '#/components/responses/NotAcceptable'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:tier_view
      x-code-samples:
        - lang: Shell
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/throttling/policies/advanced/229a3c46-c836-43c8-b988-8eebd9c7774b"'

    put:
      tags:
        - Advanced Policy (Individual)
      summary: Update an Advanced Throttling Policy
      description: |
        Updates an existing Advanced throttling policy.
      parameters:
        - $ref: '#/components/parameters/policyId'
        - $ref: '#/components/parameters/Content-Type'
        - $ref: '#/components/parameters/If-Match'
        - $ref: '#/components/parameters/If-Unmodified-Since'
      requestBody:
        description: |
          Policy object that needs to be modified
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AdvancedThrottlePolicy'
        required: true
      responses:
        200:
          description: |
            OK.
            Policy updated.
          headers:
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              schema:
                type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              schema:
                type: string
            Location:
              description: |
                The URL of the newly created resource.
              schema:
                type: string
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdvancedThrottlePolicy'
              example:
                policyId: 4cf46441-a538-4f79-a499-ab81200c9bca
                policyName: 10KPerMin
                displayName: 10KPerMin
                description: Allows 10000 requests per minute
                isDeployed: true
                defaultLimit:
                  type: REQUESTCOUNTLIMIT
                  requestCount:
                    timeUnit: min
                    unitTime: 1
                    requestCount: 10000
                conditionalGroups: []
        400:
          $ref: '#/components/responses/BadRequest'
        404:
          $ref: '#/components/responses/NotFound'
        412:
          $ref: '#/components/responses/PreconditionFailed'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:tier_manage
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          -H "Content-Type: application/json" -d @data.json "https://127.0.0.1:9443/api/am/admin/v4/throttling/policies/advanced/229a3c46-c836-43c8-b988-8eebd9c7774b"'

    delete:
      tags:
        - Advanced Policy (Individual)
      summary: Delete an Advanced Throttling Policy
      description: |
        Deletes an advanced throttling policy.
      parameters:
        - $ref: '#/components/parameters/policyId'
        - $ref: '#/components/parameters/If-Match'
        - $ref: '#/components/parameters/If-Unmodified-Since'
      responses:
        200:
          description: |
            OK.
            Resource successfully deleted.
          content: {}
        404:
          $ref: '#/components/responses/NotFound'
        412:
          $ref: '#/components/responses/PreconditionFailed'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:tier_manage
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X DELETE -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/throttling/policies/advanced/229a3c46-c836-43c8-b988-8eebd9c7774b"'

  ######################################################
  # "Export Throttling Policy" resource API
  ######################################################
  /throttling/policies/export:
    get:
      tags:
        - Import Export Throttling Policy
      summary: Export a Throttling Policy
      description: |
        This operation can be used to export the details of a particular Throttling Policy.
      parameters:
        - name: policyId
          in: query
          description: UUID of the ThrottlingPolicy
          schema:
            type: string
        - name: name
          in: query
          description: |
            Throttling Policy Name
          schema:
            type: string
        - name: type
          in: query
          description: |
            Type of the Throttling Policy
          schema:
            type: string
            enum:
              - sub
              - app
              - api
              - global
      responses:
        200:
          description: |
            OK.
            Export Successful.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExportThrottlePolicy'
              example:
                type: rate-limiting policy
                subtype: application
                version: v4.1.0
                data:
                  policyId: cd828243-a0db-430c-97e9-9e41fd865d48
                  policyName: 50PerMin
                  displayName: 50PerMin
                  description: Allows 50 request per minute
                  isDeployed: true
                  type: ApplicationThrottlePolicy
                  defaultLimit:
                    type: BANDWIDTHLIMIT
                    requestCount:
                      timeUnit: min
                      unitTime: 1
                      requestCount: 50
                    bandwidth:
                      timeUnit: min
                      unitTime: 5
                      dataAmount: 100
                      dataUnit: MB
                    eventCount:
                      timeUnit: min
                      unitTime: 5
                      eventCount: 16
        404:
          $ref: '#/components/responses/NotFound'
        500:
          $ref: '#/components/responses/InternalServerError'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:tier_manage
            - apim:policies_import_export
      x-code-samples:
        - lang: Curl
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/throttling/policies/export?policyId=96077508-fd01-4fae-bc64-5de0e2baf43c&name=Bronze&type=subscription&format=YAML"'
      operationId: exportThrottlingPolicy
  ####################################################################
  # Import Throttling Policy
  ####################################################################
  /throttling/policies/import:
    post:
      tags:
        - Import Export Throttling Policy
      summary: Import a Throttling Policy
      description: |
        This operation can be used to import a Throttling Policy
      parameters:
        - name: overwrite
          in: query
          description: |
            Update an existing throttlingpolicy with the same name
          required: false
          schema:
            type: boolean
      requestBody:
        content:
          multipart/form-data:
            schema:
              required:
                - file
              properties:
                file:
                  type: string
                  description: Json File
                  format: binary
        required: true
      responses:
        200:
          description: |
            Created.
            Throttling Policy Imported Successfully.
        403:
          $ref: '#/components/responses/Forbidden'
        404:
          $ref: '#/components/responses/NotFound'
        409:
          $ref: '#/components/responses/Conflict'
        500:
          $ref: '#/components/responses/InternalServerError'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:tier_manage
            - apim:policies_import_export
      x-code-samples:
        - lang: Curl
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/throttling/policies/import?overwrite=True"'
      operationId: importThrottlingPolicy
  ######################################################
  # The "Deny Policy Collection" resource API
  ######################################################
  /throttling/deny-policies:
    get:
      tags:
        - Deny Policies (Collection)
      summary: Get all Deny Policies
      description: |
        Retrieves all existing deny policies.
      parameters:
        - $ref: '#/components/parameters/Accept'
        - $ref: '#/components/parameters/If-None-Match'
        - $ref: '#/components/parameters/If-Modified-Since'
      responses:
        200:
          description: |
            OK.
            Deny Policies returned
          headers:
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              schema:
                type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              schema:
                type: string
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BlockingConditionList'
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
          content: {}
        406:
          $ref: '#/components/responses/NotAcceptable'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:bl_view
      x-code-samples:
        - lang: Shell
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/throttling/policies/deny-policies"'

    post:
      tags:
        - Deny Policies (Collection)
      summary: Add a deny policy
      description: |
        Adds a new deny policy
      parameters:
        - $ref: '#/components/parameters/Content-Type'
      requestBody:
        description: |
          Blocking condition object that should to be added
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BlockingCondition'
        required: true
      responses:
        201:
          description: |
            Created.
            Successful response with the newly created object as entity in the body.
            Location header contains URL of newly created entity.
          headers:
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              schema:
                type: string
            Location:
              description: |
                Location of the newly created resource.
              schema:
                type: string
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BlockingCondition'
        400:
          $ref: '#/components/responses/BadRequest'
        415:
          $ref: '#/components/responses/UnsupportedMediaType'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:bl_manage
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          -H "Content-Type: application/json" -d @data.json "https://127.0.0.1:9443/api/am/admin/v4/throttling/policies/deny-policies"'

  ######################################################
  # The "Individual Deny Policy" resource API
  ######################################################
  /throttling/deny-policy/{conditionId}:
    get:
      tags:
        - Deny Policy (Individual)
      summary: Get a Deny Policy
      description: |
        Retrieves a Deny policy providing the condition Id
      parameters:
        - $ref: '#/components/parameters/conditionId'
        - $ref: '#/components/parameters/If-None-Match'
        - $ref: '#/components/parameters/If-Modified-Since'
      responses:
        200:
          description: |
            OK.
            Condition returned
          headers:
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              schema:
                type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              schema:
                type: string
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BlockingCondition'
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
          content: {}
        404:
          $ref: '#/components/responses/NotFound'
        406:
          $ref: '#/components/responses/NotAcceptable'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:bl_view
      x-code-samples:
        - lang: Shell
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/throttling/policies/deny-policy/b513eb68-69e8-4c32-92cf-852c101363c"'

    delete:
      tags:
        - Deny Policy (Individual)
      summary: Delete a Deny Policy
      description: |
        Deletes an existing deny policy
      parameters:
        - $ref: '#/components/parameters/conditionId'
        - $ref: '#/components/parameters/If-Match'
        - $ref: '#/components/parameters/If-Unmodified-Since'
      responses:
        200:
          description: |
            OK.
            Resource successfully deleted.
          content: {}
        404:
          $ref: '#/components/responses/NotFound'
        412:
          $ref: '#/components/responses/PreconditionFailed'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:bl_manage
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X DELETE -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/throttling/policies/deny-policy/b513eb68-69e8-4c32-92cf-852c101363c"'

    patch:
      tags:
        - Deny Policy (Individual)
      summary: Update a Deny Policy
      description: |
        Update a deny policy by Id
      parameters:
        - $ref: '#/components/parameters/conditionId'
        - $ref: '#/components/parameters/Content-Type'
        - $ref: '#/components/parameters/If-Match'
        - $ref: '#/components/parameters/If-Unmodified-Since'
      requestBody:
        description: |
          Blocking condition with updated status
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BlockingConditionStatus'
        required: true
      responses:
        200:
          description: |
            OK.
            Resource successfully updated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BlockingCondition'
        400:
          $ref: '#/components/responses/BadRequest'
        404:
          $ref: '#/components/responses/NotFound'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:bl_manage
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X PATCH -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          -H "Content-Type: application/json" -d @data.json "https://127.0.0.1:9443/api/am/admin/v4/throttling/policies/deny-policy/b513eb68-69e8-4c32-92cf-852c101363c"'

  ######################################################
  # The "Application Collection" resource APIs
  ######################################################
  /applications:
    get:
      tags:
        - Application (Collection)
      summary: |
        Retrieve/Search Applications
      description: |
        This operation can be used to retrieve list of applications owned by the given user, If no user
        is provided, the applications owned by the user associated with the provided access token will be returned.
      parameters:
        - $ref: '#/components/parameters/user'
        - $ref: '#/components/parameters/limit'
        - $ref: '#/components/parameters/offset'
        - $ref: '#/components/parameters/Accept'
        - $ref: '#/components/parameters/If-None-Match'
        - name: name
          in: query
          description: |
            Application Name
          schema:
            type: string
        - name: tenantDomain
          in: query
          description: |
            Tenant domain of the applications to get. This has to be specified only if it is required to get applications of
            a tenant other than the requester's tenant. So, if not specified, the default will be set as the
            requester's tenant domain. This cross tenant Application access is allowed only for super tenant admin
            users **only at a migration process**.
          schema:
            type: string
      responses:
        200:
          description: |
            OK.
            Application list returned.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApplicationList'
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
          content: {}
        400:
          $ref: '#/components/responses/BadRequest'
        406:
          $ref: '#/components/responses/NotAcceptable'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:app_owner_change
            - apim:app_import_export
      x-code-samples:
        - lang: Shell
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/applications"'

  ######################################################
  # The "Individual Application" resource APIs
  ######################################################
  /applications/{applicationId}:
    delete:
      tags:
        - Applications
      summary: |
        Delete an Application
      description: |
        This operation can be used to delete an application by specifying its id.
      parameters:
        - $ref: '#/components/parameters/applicationId'
        - $ref: '#/components/parameters/If-Match'
      responses:
        200:
          description: |
            OK.
            Resource successfully deleted.
          content: {}
        202:
          description: |
            Accepted.
            The request has been accepted.
          headers:
            Location:
              description: |
                Location of the existing Application.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowResponse'
        404:
          $ref: '#/components/responses/NotFound'
        412:
          $ref: '#/components/responses/PreconditionFailed'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:app_import_export
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X DELETE -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/applications/0a043c2b-ee75-4ef3-9e1c-fc2610ccfa8b"'

  /applications/{applicationId}/change-owner:
    post:
      tags:
        - Application
      summary: Change Application Owner
      description: |
        This operation is used to change the owner of an Application.
        In order to change the owner of an application, we need to pass the new application owner as a query parameter
      parameters:
        - name: owner
          in: query
          required: true
          schema:
            type: string
        - $ref: '#/components/parameters/applicationId'
      responses:
        200:
          description: |
            OK.
            Application owner changed successfully.
          content: {}
        400:
          $ref: '#/components/responses/BadRequest'
        404:
          $ref: '#/components/responses/NotFound'
        412:
          $ref: '#/components/responses/PreconditionFailed'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:app_owner_change
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/applications/0a043c2b-ee75-4ef3-9e1c-fc2610ccfa8b/change-owner?owner=admin"'

  ######################################################
  # Export Resource API
  ######################################################
  /export/applications:
    get:
      tags:
        - Application (Individual)
      summary: Export an Application
      description: |
        This operation can be used to export the details of a particular application as a zip file.
      parameters:
        - name: appName
          in: query
          description: |
            Application Name
          required: true
          schema:
            type: string
        - name: appOwner
          in: query
          description: |
            Owner of the Application
          required: true
          schema:
            type: string
        - name: withKeys
          in: query
          description: |
            Export application keys
          schema:
            type: boolean
      responses:
        200:
          description: |
            OK.
            Export Successful.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                type: string
                format: binary
            application/zip:
              schema:
                type: string
                format: binary
        400:
          $ref: '#/components/responses/BadRequest'
        404:
          $ref: '#/components/responses/NotFound'
        406:
          $ref: '#/components/responses/NotAcceptable'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:app_import_export
      x-code-samples:
        - lang: Shell
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/export/applications?appName=sampleApp&appOwner=admin&withKeys=true"
          > exported-application.zip'

  /export/api:
    get:
      tags:
        - API (Individual)
      summary: Export an API
      description: |
        This operation can be used to export the details of a particular API as a zip file.
      parameters:
        - name: name
          in: query
          description: |
            API Name
          required: true
          schema:
            type: string
        - name: version
          in: query
          description: |
            Version of the API
          required: true
          schema:
            type: string
        - name: providerName
          in: query
          description: |
            Provider name of the API
          schema:
            type: string
        - name: format
          in: query
          description: |
            Format of output documents. Can be YAML or JSON.
          schema:
            type: string
            enum:
              - JSON
              - YAML
        - name: preserveStatus
          in: query
          description: |
            Preserve API Status on export
          schema:
            type: boolean
      responses:
        200:
          description: |
            OK.
            Export Successful.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/zip:
              schema:
                type: string
                format: binary
        404:
          $ref: '#/components/responses/NotFound'
        500:
          $ref: '#/components/responses/InternalServerError'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:api_import_export
      x-code-samples:
        - lang: Shell
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/export/api?name=PizzaShackAPI&version=1.0.0&providerName=admin&format=YAML&preserveStatus=true"
          > exportAPI.zip'

  /export/api-product:
    get:
      tags:
        - API Product (Individual)
      summary: Export an API Product
      description: |
        This operation can be used to export the details of a particular API Product as a zip file.
      parameters:
        - name: name
          in: query
          description: |
            API Product Name
          required: true
          schema:
            type: string
        - name: version
          in: query
          description: |
            Version of the API Product
          required: true
          schema:
            type: string
        - name: providerName
          in: query
          description: |
            Provider name of the API Product
          schema:
            type: string
        - name: format
          in: query
          description: |
            Format of output documents. Can be YAML or JSON.
          schema:
            type: string
            enum:
              - JSON
              - YAML
        - name: preserveStatus
          in: query
          description: |
            Preserve API Product Status on export
          schema:
            type: boolean
      responses:
        200:
          description: |
            OK.
            Export Successful.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/zip:
              schema:
                type: string
                format: binary
        404:
          $ref: '#/components/responses/NotFound'
        500:
          $ref: '#/components/responses/InternalServerError'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:api_product_import_export
      x-code-samples:
        - lang: Shell
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/export/api-product?name=PizzaShackAPIProduct&version=1.0.0&providerName=admin&format=YAML&preserveStatus=true"
          > exportAPIProduct.zip'

  ######################################################
  # Import Resource API
  ######################################################
  /import/applications:
    post:
      tags:
        - Application (Individual)
      summary: Import an Application
      description: |
        This operation can be used to import an application.
      parameters:
        - name: preserveOwner
          in: query
          description: |
            Preserve Original Creator of the Application
          schema:
            type: boolean
        - name: skipSubscriptions
          in: query
          description: |
            Skip importing Subscriptions of the Application
          schema:
            type: boolean
        - name: appOwner
          in: query
          description: |
            Expected Owner of the Application in the Import Environment
          schema:
            type: string
        - name: skipApplicationKeys
          in: query
          description: |
            Skip importing Keys of the Application
          schema:
            type: boolean
        - name: update
          in: query
          description: |
            Update if application exists
          schema:
            type: boolean
      requestBody:
        content:
          multipart/form-data:
            schema:
              required:
                - file
              properties:
                file:
                  type: string
                  description: |
                    Zip archive consisting of exported Application Configuration.
                  format: binary
        required: true
      responses:
        200:
          description: |
            OK.
            Successful response with the updated object information as entity in the body.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApplicationInfo'
        207:
          description: |
            Multi Status.
            Partially successful response with skipped APIs information object as entity in the body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIInfoList'
        400:
          $ref: '#/components/responses/BadRequest'
        406:
          $ref: '#/components/responses/NotAcceptable'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:app_import_export
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          -F file=@exported-application.zip "https://127.0.0.1:9443/api/am/admin/v4/import/applications?preserveOwner=true&skipSubscriptions=false&appOwner=admin&skipApplicationKeys=false&update=true"'

  /import/api:
    post:
      tags:
        - API (Individual)
      summary: Import an API
      description: |
        This operation can be used to import an API.
      parameters:
        - name: preserveProvider
          in: query
          description: |
            Preserve Original Provider of the API. This is the user choice to keep or replace the API provider.
          schema:
            type: boolean
        - name: overwrite
          in: query
          description: |
            Whether to update the API or not. This is used when updating already existing APIs.
          schema:
            type: boolean
      requestBody:
        content:
          multipart/form-data:
            schema:
              required:
                - file
              properties:
                file:
                  type: string
                  description: |
                    Zip archive consisting on exported api configuration
                  format: binary
        required: true
      responses:
        200:
          description: |
            Created.
            API Imported Successfully.
          content: {}
        403:
          $ref: '#/components/responses/Forbidden'
        404:
          $ref: '#/components/responses/NotFound'
        409:
          $ref: '#/components/responses/Conflict'
        500:
          $ref: '#/components/responses/InternalServerError'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:api_import_export
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          -F file=@admin-PizzaShackAPI-1.0.0.zip "https://127.0.0.1:9443/api/am/admin/v4/import/api?preserveProvider=false&overwrite=false"'

  /import/api-product:
    post:
      tags:
        - API Product (Individual)
      summary: Import an API Product
      description: |
        This operation can be used to import an API Product.
      parameters:
        - name: preserveProvider
          in: query
          description: |
            Preserve Original Provider of the API Product. This is the user choice to keep or replace the API Product provider.
          schema:
            type: boolean
        - name: importAPIs
          in: query
          description: |
            Whether to import the dependent APIs or not.
          schema:
            type: boolean
        - name: overwriteAPIProduct
          in: query
          description: |
            Whether to update the API Product or not. This is used when updating already existing API Products.
          schema:
            type: boolean
        - name: overwriteAPIs
          in: query
          description: |
            Whether to update the dependent APIs or not. This is used when updating already existing dependent APIs of an API Product.
          schema:
            type: boolean
      requestBody:
        content:
          multipart/form-data:
            schema:
              required:
                - file
              properties:
                file:
                  type: string
                  description: |
                    Zip archive consisting on exported API Product configuration
                  format: binary
        required: true
      responses:
        200:
          description: |
            Created.
            API Product Imported Successfully.
          content: {}
        403:
          $ref: '#/components/responses/Forbidden'
        404:
          $ref: '#/components/responses/NotFound'
        409:
          $ref: '#/components/responses/Conflict'
        500:
          $ref: '#/components/responses/InternalServerError'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:api_product_import_export
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          -F file=@exportAPIProduct.zip "https://127.0.0.1:9443/api/am/admin/v4/import/api-product?preserveProvider=false&overwriteAPIProduct=false&overwriteAPIs=false&importAPIs=false"'

  ######################################################
  # The "Label" resource API
  ######################################################
  /labels:
    get:
      tags:
        - Label Collection
      summary: Get all registered Labels
      description: |
        Get all Registered Labels
      responses:
        200:
          description: |
            OK.
            Labels returned
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LabelList'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:label_read
      x-code-samples:
        - lang: Shell
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/labels"'

    post:
      tags:
        - Label
      summary: Add a Label
      description: |
        Add a new gateway label
      requestBody:
        description: |
          Label object that should to be added
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Label'
        required: true
      responses:
        201:
          description: |
            Created.
            Successful response with the newly created object as entity in the body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Label'
        400:
          $ref: '#/components/responses/BadRequest'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:label_manage
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          -H "Content-Type: application/json" -d @data.json "https://127.0.0.1:9443/api/am/admin/v4/labels"'

  ######################################################
  # The "Individual label" resource APIs
  ######################################################
  /labels/{labelId}:
    put:
      tags:
        - Label
      summary: Update a Label
      description: |
        Update a Label by label Id
      parameters:
        - $ref: '#/components/parameters/labelId'
      requestBody:
        description: |
          Label object with updated information
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Label'
        required: true
      responses:
        200:
          description: |
            OK.
            Label updated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Label'
        400:
          $ref: '#/components/responses/BadRequest'
        404:
          $ref: '#/components/responses/NotFound'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:label_manage
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          -H "Content-Type: application/json" -d @data.json "https://127.0.0.1:9443/api/am/admin/v4/labels/d7cf8523-9180-4255-84fa-6cb171c1f779"'

    delete:
      tags:
        - Label
      summary: Delete a Label
      description: |
        Delete a Label by label Id
      parameters:
        - $ref: '#/components/parameters/labelId'
        - $ref: '#/components/parameters/If-Match'
        - $ref: '#/components/parameters/If-Unmodified-Since'
      responses:
        200:
          description: |
            OK.
            Label successfully deleted.
          content: {}
        404:
          $ref: '#/components/responses/NotFound'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:label_manage
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X DELETE -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/labels/d7cf8523-9180-4255-84fa-6cb171c1f779"'

  ######################################################
  # The "Environment" resource API
  ######################################################
  /environments:
    get:
      tags:
        - Environment Collection
      summary: Get all registered Environments
      description: |
        Get all Registered Environments
      responses:
        200:
          description: |
            OK.
            Environments returned
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EnvironmentList'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:environment_read
      x-code-samples:
        - lang: Shell
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/environments"'

    post:
      tags:
        - Environment
      summary: Add an Environment
      description: |
        Add a new geteway environment
      requestBody:
        description: |
          Environment object that should to be added
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Environment'
        required: true
      responses:
        201:
          description: |
            Created.
            Successful response with the newly created object as entity in the body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Environment'
        400:
          $ref: '#/components/responses/BadRequest'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:environment_manage
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          -H "Content-Type: application/json" -d @data.json "https://127.0.0.1:9443/api/am/admin/v4/environments"'

  ######################################################
  # The "Individual Environment" resource APIs
  ######################################################
  /environments/{environmentId}:
    put:
      tags:
        - Environment
      summary: Update an Environment
      description: |
        Update a gateway Environment by environment Id
      parameters:
        - $ref: '#/components/parameters/environmentId'
      requestBody:
        description: |
          Environment object with updated information
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Environment'
        required: true
      responses:
        200:
          description: |
            OK.
            Environment updated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Environment'
        400:
          $ref: '#/components/responses/BadRequest'
        404:
          $ref: '#/components/responses/NotFound'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:environment_manage
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          -H "Content-Type: application/json" -d @data.json "https://127.0.0.1:9443/api/am/admin/v4/environments/d7cf8523-9180-4255-84fa-6cb171c1f779"'

    delete:
      tags:
        - Environment
      summary: Delete an Environment
      description: |
        Delete a Environment by Environment Id
      parameters:
        - $ref: '#/components/parameters/environmentId'
      responses:
        200:
          description: |
            OK.
            Environment successfully deleted.
          content: {}
        404:
          $ref: '#/components/responses/NotFound'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:environment_manage
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X DELETE -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/environments/d7cf8523-9180-4255-84fa-6cb171c1f779"'

  ######################################################
  # The Bot Detection Data API resources
  ######################################################
  /bot-detection-data:
    get:
      tags:
        - Bot Detection Data
      summary: |
        Get all Bot Detected Data
      description: |
        Get all bot detected data
      operationId: getBotDetectionData
      responses:
        200:
          description: |
            OK.
            Bot detected data returned.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BotDetectionDataList'
        404:
          $ref: '#/components/responses/NotFound'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:bot_data
      x-code-samples:
        - lang: Shell
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/bot-detection-data"'

  ######################################################
  # The "Monetization" resource APIs
  ######################################################
  /monetization/publish-usage:
    post:
      tags:
        - Monetization (Collection)
      summary: Publish Usage Records
      description: |
        Publish usage records of monetized APIs
      responses:
        200:
          description: Usage records successfully published.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublishStatus'
        202:
          description: Request is sucessfully accepted for processing.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublishStatus'
        404:
          $ref: '#/components/responses/NotFound'
        500:
          $ref: '#/components/responses/InternalServerError'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:monetization_usage_publish
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/monetization/publish-usage"'

  /monetization/publish-usage/status:
    get:
      tags:
        - Monetization (Collection)
      summary: Get the Status of Monetization Usage Publisher
      description: |
        Get the status of monetization usage publisher
      responses:
        200:
          description: |
            OK.
            Status returned
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MonetizationUsagePublishInfo'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:monetization_usage_publish
      x-code-samples:
        - lang: Shell
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/monetization/publish-usage/status"'

  ######################################################
  # The "Workflow Collection" resource APIs
  ######################################################
  /workflows:
    get:
      tags:
        - Workflow (Collection)
      summary: |
        Retrieve All Pending Workflow Processes
      description: |
        This operation can be used to retrieve list of workflow pending processes.
      parameters:
        - $ref: '#/components/parameters/limit'
        - $ref: '#/components/parameters/offset'
        - $ref: '#/components/parameters/Accept'
        - $ref: '#/components/parameters/If-None-Match'
        - name: workflowType
          in: query
          description: |
            We need to show the values of each workflow process separately .for that we use workflow type.
            Workflow type can be AM_APPLICATION_CREATION, AM_SUBSCRIPTION_CREATION,   AM_USER_SIGNUP, AM_APPLICATION_REGISTRATION_PRODUCTION, AM_APPLICATION_REGISTRATION_SANDBOX.
          schema:
            type: string
            enum:
              - AM_APPLICATION_CREATION
              - AM_SUBSCRIPTION_CREATION
              - AM_USER_SIGNUP
              - AM_APPLICATION_REGISTRATION_PRODUCTION
              - AM_APPLICATION_REGISTRATION_SANDBOX
              - AM_SUBSCRIPTION_DELETION
              - AM_APPLICATION_DELETION
              - AM_API_STATE
              - AM_API_PRODUCT_STATE
              - AM_REVISION_DEPLOYMENT
      responses:
        200:
          description: |
            OK.
            Workflow pendding process list returned.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowList'
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
          content: {}
        400:
          $ref: '#/components/responses/BadRequest'
        404:
          $ref: '#/components/responses/NotFound'
        406:
          $ref: '#/components/responses/NotAcceptable'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:api_workflow_view
      x-code-samples:
        - lang: Shell
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/workflows"'

  /workflows/{externalWorkflowRef}:
    get:
      tags:
        - Workflows (Individual)
      summary: |
        Get Pending Workflow Details by External Workflow Reference
      description: |
        Using this operation, you can retrieve complete details of a pending workflow request that either belongs to application creation, application subscription, application registration, api state change, user self sign up.. You need to provide the External_Workflow_Reference of the workflow Request to retrive it.
      parameters:
        - name: externalWorkflowRef
          in: path
          description: |
            from the externel workflow reference we decide what is the the pending request that the are requesting.
          required: true
          schema:
            type: string
        - $ref: '#/components/parameters/If-None-Match'
      responses:
        200:
          description: |
            OK.
            Requested Workflow Pending is returned
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowInfo'
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource.
          content: {}
        404:
          $ref: '#/components/responses/NotFound'
        406:
          $ref: '#/components/responses/NotAcceptable'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:api_workflow_view
      x-code-samples:
        - lang: Shell
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/workflows/c43a325c-260b-4302-81cb-768eafaa3aed"'

  /workflows/update-workflow-status:
    post:
      tags:
        - Workflows (Individual)
      summary: Update Workflow Status
      description: |
        This operation can be used to approve or reject a workflow task.
      parameters:
        - $ref: '#/components/parameters/workflowReferenceId-Q'
      requestBody:
        description: |
          Workflow event that need to be updated
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Workflow'
        required: true
      responses:
        200:
          description: |
            OK.
            Workflow request information is returned.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Workflow'
        400:
          $ref: '#/components/responses/BadRequest'
        404:
          $ref: '#/components/responses/NotFound'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:api_workflow_approve
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          -H "Content-Type: application/json" -d @data.json "https://127.0.0.1:9443/api/am/admin/v4/workflows/update-workflow-status?workflowReferenceId=56e3a170-a7a7-45f8-b051-7e43a58a67e1"'

  ######################################################
  # The Tenant Info resource API
  ######################################################
  /tenant-info/{username}:
    get:
      tags:
        - Tenants
      summary: |
        Get Tenant Id of User
      description: |
        This operation is to get tenant id of the provided user
      operationId: getTenantInfoByUsername
      parameters:
        - name: username
          in: path
          description: |
            The state represents the current state of the tenant. Supported states are [ active, inactive]
          required: true
          schema:
            type: string
            default: john
      responses:
        200:
          description: |
            OK.
            Tenant id of the user retrieved.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TenantInfo'
        404:
          $ref: '#/components/responses/NotFound'
        406:
          $ref: '#/components/responses/NotAcceptable'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:tenantInfo
      x-code-samples:
        - lang: Shell
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/tenant-info/john"'

  ######################################################
  # The Custom URL Info resource API
  ######################################################
  /custom-urls/{tenantDomain}:
    get:
      tags:
        - Tenants
      summary: |
        Get Custom URL Info of a Tenant Domain
      description: |
        This operation is to get custom-url information of the provided tenant-domain
      operationId: getCustomUrlInfoByTenantDomain
      parameters:
        - name: tenantDomain
          in: path
          description: |
            The tenant domain name.
          required: true
          schema:
            type: string
      responses:
        200:
          description: |
            OK.
            Custom url info of the tenant is retrieved.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomUrlInfo'
        404:
          $ref: '#/components/responses/NotFound'
        406:
          $ref: '#/components/responses/NotAcceptable'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:tenantInfo
      x-code-samples:
        - lang: Shell
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/custom-urls/wso2.com"'

  ######################################################
  # The "Category Collection" resource API
  ######################################################
  /api-categories:
    get:
      tags:
        - API Category (Collection)
      summary: Get all API Categories
      description: |
        Get all API categories
      responses:
        200:
          description: |
            OK.
            Categories returned
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APICategoryList'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:admin_operations
      x-code-samples:
        - lang: Shell
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/api-categories"'

    post:
      tags:
        - API Category (Individual)
      summary: Add API Category
      description: |
        Add a new API category
      requestBody:
        description: |
          API Category object that should to be added
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/APICategory'
        required: true
      responses:
        201:
          description: |
            Created.
            Successful response with the newly created object as entity in the body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APICategory'
        400:
          $ref: '#/components/responses/BadRequest'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:admin_operations
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          -H "Content-Type: application/json" -d @data.json "https://127.0.0.1:9443/api/am/admin/v4/api-categories"'

  ######################################################
  # The "Individual Category" resource APIs
  ######################################################
  /api-categories/{apiCategoryId}:
    put:
      tags:
        - API Category (Individual)
      summary: Update an API Category
      description: |
        Update an API Category by category Id
      parameters:
        - $ref: '#/components/parameters/apiCategoryId'
      requestBody:
        description: |
          API Category object with updated information
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/APICategory'
        required: true
      responses:
        200:
          description: |
            OK.
            Label updated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APICategory'
        400:
          $ref: '#/components/responses/BadRequest'
        404:
          $ref: '#/components/responses/NotFound'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:admin_operations
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          -H "Content-Type: application/json" -d @data.json "https://127.0.0.1:9443/api/am/admin/v4/api-categories/d7cf8523-9180-4255-84fa-6cb171c1f779"'

    delete:
      tags:
        - API Category (Individual)
      summary: Delete an API Category
      description: |
        Delete an API Category by API Category Id
      parameters:
        - $ref: '#/components/parameters/apiCategoryId'
        - $ref: '#/components/parameters/If-Match'
        - $ref: '#/components/parameters/If-Unmodified-Since'
      responses:
        200:
          description: |
            OK.
            API Category successfully deleted.
          content: {}
        404:
          $ref: '#/components/responses/NotFound'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:admin_operations
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X DELETE -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/api-categories/d7cf8523-9180-4255-84fa-6cb171c1f779"'

  ######################################################
  # The Admin settings List
  ######################################################
  /settings:
    get:
      tags:
        - Settings
      summary: Retreive Admin Settings
      description: |
        Retreive admin settings
      responses:
        200:
          description: |
            OK.
            Settings returned
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Settings'
        404:
          $ref: '#/components/responses/NotFound'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:admin_settings
      x-code-samples:
        - lang: Shell
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/settings"'

  ####################################################
  # The Admin alert  management resources
  ####################################################
  /alert-types:
    get:
      tags:
        - Alerts
      summary: |
        Get all Admin Alert Types
      description: |
        This operation is used to get the list of supportd alert types for the apim admin dashboard
      operationId: getAdminAlertTypes
      responses:
        200:
          description: |
            OK.
            The list of admin alert types are returned.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AlertTypesList'
        500:
          $ref: '#/components/responses/InternalServerError'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:admin_alert_manage
      x-code-samples:
        - lang: Shell
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/alert-types"'

  /alert-subscriptions:
    get:
      tags:
        - Alert Subscriptions
      summary: |
        Get Subscribed Alert Types
      description: |
        This operation is used to get the list of subscribed alert types by the user.
      operationId: getSubscribedAlertTypes
      responses:
        200:
          description: |
            OK.
            The list of subscribed alert types are returned.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AlertsSubscription'
        500:
          $ref: '#/components/responses/InternalServerError'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:admin_alert_manage
      x-code-samples:
        - lang: Shell
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/alert-subscriptions"'

    put:
      tags:
        - Alert Subscriptions
      summary: |
        Subscribe to an Admin Alert
      description: |
        This operation is used to subscribe to admin alerts
      operationId: subscribeToAlerts
      requestBody:
        description: The alerts list and the email list to subscribe.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AlertsSubscription'
        required: true
      responses:
        200:
          description: |
            OK.
            Successful response with the newly subscribed alerts.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AlertsSubscription'
        400:
          $ref: '#/components/responses/BadRequest'
        500:
          $ref: '#/components/responses/InternalServerError'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:admin_alert_manage
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          -H "Content-Type: application/json" -d @data.json "https://127.0.0.1:9443/api/am/admin/v4/alert-subscriptions"'

    delete:
      tags:
        - Alert Subscriptions
      summary: |
        Unsubscribe User from all Admin Alerts
      description: |
        This operation is used to unsubscribe the respective user from all the admin alert types.
      operationId: unsubscribeAllAlerts
      responses:
        200:
          description: |
            OK.
            The user is unsubscribed from the alerts successfully.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content: {}
        500:
          $ref: '#/components/responses/InternalServerError'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:admin_alert_manage
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X DELETE -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/alert-subscriptions"'

  /alert-subscriptions/bot-detection:
    get:
      tags:
        - Bot Detection Alert Subscriptions
      summary: |
        Get Subscriptions for Bot Detection
      description: |
        Get the list of subscriptions which are subscribed to receive email alerts for bot detection
      operationId: getBotDetectionAlertSubscriptions
      responses:
        200:
          description: |
            OK.
            The list of bot detection alert subscriptions are returned.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BotDetectionAlertSubscriptionList'
        500:
          $ref: '#/components/responses/InternalServerError'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:admin_alert_manage
      x-code-samples:
        - lang: Shell
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/alert-subscriptions/bot-detection"'

    post:
      tags:
        - Bot Detection Alert Subscriptions
      summary: Subscribe for Bot Detection Alerts
      description: |
        Register a subscription for bot detection alerts
      operationId: subscribeForBotDetectionAlerts
      requestBody:
        description: |
          The email to register to receive bot detection alerts
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BotDetectionAlertSubscription'
        required: true
      responses:
        200:
          description: |
            OK.
            Bot detection alert subscription is registered successfully.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BotDetectionAlertSubscription'
        400:
          $ref: '#/components/responses/BadRequest'
        500:
          $ref: '#/components/responses/InternalServerError'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:admin_alert_manage
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          -H "Content-Type: application/json" -d @data.json "https://127.0.0.1:9443/api/am/admin/v4/alert-subscriptions/bot-detection"'

  /alert-subscriptions/bot-detection/{uuid}:
    delete:
      tags:
        - Bot Detection Alert Subscriptions
      summary: Unsubscribe from bot detection alerts.
      description: |
        Delete a Bot Detection Alert Subscription
      operationId: unsubscribeFromBotDetectionAlerts
      parameters:
        - name: uuid
          in: path
          description: uuid of the subscription
          required: true
          schema:
            type: string
      responses:
        200:
          description: |
            OK.
            Bot detection alert subscription is deleted successfully.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content: {}
        404:
          $ref: '#/components/responses/NotFound'
        500:
          $ref: '#/components/responses/InternalServerError'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:admin_alert_manage
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X DELETE -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/alert-subscriptions/bot-detection"'

  ######################################################
  # System scopes resource API
  ######################################################
  /system-scopes/{scopeName}:
    get:
      tags:
        - System Scopes
      summary: Retrieve Scopes for a Particular User
      description: |
        This operation will return the scope list of particular user
        In order to get it, we need to pass the userId as a query parameter
      operationId: systemScopesScopeNameGet
      parameters:
        - name: username
          in: query
          schema:
            type: string
        - $ref: '#/components/parameters/scopeName'
      responses:
        200:
          description: |
            OK.
            Particular scope exists for the given user.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScopeSettings'
        400:
          $ref: '#/components/responses/BadRequest'
        404:
          $ref: '#/components/responses/NotFound'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:scope_manage
      x-code-samples:
        - lang: Shell
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/system-scopes/YXBpbTpzdWJzY3JpYmU?username=john"'

  /system-scopes:
    get:
      tags:
        - System Scopes
      summary: |
        Get Role Scope Mappings
      description: |
        This operation is used to get the list of role scope mapping from tenant-conf for the apim admin dashboard
      operationId: systemScopesGet
      responses:
        200:
          description: |
            OK.
            The list of role scope mappings are returned.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScopeList'
        500:
          $ref: '#/components/responses/InternalServerError'
      security:
        - OAuth2Security:
            - apim:scope_manage
            - apim:admin
      x-code-samples:
        - lang: Shell
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/system-scopes"'

    put:
      tags:
        - System Scopes
      summary: |
        Update Roles For Scope
      description: |
        This operation is used to update the roles for all scopes
      operationId: updateRolesForScope
      requestBody:
        description: |
          Scope list object with updated scope to role mappings
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ScopeList'
        required: true
      responses:
        200:
          description: |
            OK.
            Successful response with the newly added roles.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScopeList'
        400:
          $ref: '#/components/responses/BadRequest'
        500:
          $ref: '#/components/responses/InternalServerError'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:scope_manage
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          -H "Content-Type: application/json" -d @data.json "https://127.0.0.1:9443/api/am/admin/v4/system-scopes"'

  /system-scopes/role-aliases:
    get:
      tags:
        - System Scopes
      summary: Retrieve Role Alias Mappings
      description: |
        This operation can be used to retreive role alias mapping
      responses:
        200:
          description: |
            OK.
            The list of role mappings are returned.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RoleAliasList'
        404:
          $ref: '#/components/responses/NotFound'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:scope_manage
      x-code-samples:
        - lang: Shell
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/system-scopes/role-aliases"'

    put:
      tags:
        - System Scopes
      summary: Add a New Role Alias
      description: |
        This operation can be used to add a new role alias mapping for system scope roles
      requestBody:
        description: role-alias mapping
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RoleAliasList'
        required: true
      responses:
        200:
          description: |
            OK.
            Role mapping alias returned
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RoleAliasList'
        400:
          $ref: '#/components/responses/BadRequest'
        500:
          $ref: '#/components/responses/InternalServerError'
      security:
        - OAuth2Security:
            - apim:scope_manage
            - apim:admin
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          -H "Content-Type: application/json" -d @data.json "https://127.0.0.1:9443/api/am/admin/v4/system-scopes/role-aliases"'

  ######################################################
  # The Tenant Theme resource APIs
  ######################################################
  /tenant-theme:
    get:
      tags:
        - Tenant Theme
      summary: Export a DevPortal Tenant Theme
      description: |
        This operation can be used to export a DevPortal tenant theme as a zip file.
      operationId: exportTenantTheme
      responses:
        200:
          description: |
            OK.
            Tenant Theme Exported Successfully.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/zip:
              schema:
                type: string
                format: binary
        403:
          $ref: '#/components/responses/Forbidden'
        404:
          $ref: '#/components/responses/NotFound'
        500:
          $ref: '#/components/responses/InternalServerError'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:tenant_theme_manage
      x-code-samples:
        - lang: Shell
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/tenant-theme" > theme.zip'

    put:
      tags:
        - Tenant Theme
      summary: Import a DevPortal Tenant Theme
      description: |
        This operation can be used to import a DevPortal tenant theme.
      operationId: importTenantTheme
      requestBody:
        content:
          multipart/form-data:
            schema:
              required:
                - file
              properties:
                file:
                  type: string
                  description: |
                    Zip archive consisting of tenant theme configuration
                  format: binary
        required: true
      responses:
        200:
          description: |
            Ok.
            Tenant Theme Imported Successfully.
          content: {}
        403:
          $ref: '#/components/responses/Forbidden'
        413:
          $ref: '#/components/responses/PayloadTooLarge'
        500:
          $ref: '#/components/responses/InternalServerError'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:tenant_theme_manage
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          -F file=@theme.zip "https://127.0.0.1:9443/api/am/admin/v4/tenant-theme"'

  ######################################################
  # The Tenant config resource APIs
  ######################################################
  /tenant-config:
    get:
      tags:
        - Tenant Config
      summary: Export a tenant-Config.
      description: |
        This operation can be used to export a tenant-config.json used in deployment.
      operationId: exportTenantConfig
      responses:
        200:
          description: |
            OK.
            Tenant config Exported Successfully.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                type: string
        403:
          $ref: '#/components/responses/Forbidden'
        404:
          $ref: '#/components/responses/NotFound'
        500:
          $ref: '#/components/responses/InternalServerError'
      security:
        - OAuth2Security:
            - apim:admin
      x-code-samples:
        - lang: Shell
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/tenant-config" > tenant-config.json'
    put:
      tags:
        - Tenant Config
      summary: Update a tenant-config.
      description: |
        This operation can be used to update tenant-config.
      operationId: updateTenantConfig
      requestBody:
        description: tenant-config
        content:
          application/json:
            schema:
              type: object
        required: true
      responses:
        200:
          description: |
            OK.
            Role mapping alias returned
          content:
            application/json:
              schema:
                type: object
        403:
          $ref: '#/components/responses/Forbidden'
        413:
          $ref: '#/components/responses/PayloadTooLarge'
        500:
          $ref: '#/components/responses/InternalServerError'
      security:
        - OAuth2Security:
            - apim:admin
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
           "https://127.0.0.1:9443/api/am/admin/v4/tenant-config"'

  ######################################################
  # The Tenant config schema resource APIs
  ######################################################
  /tenant-config-schema:
    get:
      tags:
        - Tenant Config Schema
      summary: Export a tenant-Config-Schema.
      description: |
        This operation can be used to export a tenant-config-schema.json used in deployment.
      operationId: exportTenantConfigSchema
      responses:
        200:
          description: |
            OK.
            Tenant config schema exported successfully.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                type: object
        403:
          $ref: '#/components/responses/Forbidden'
        404:
          $ref: '#/components/responses/NotFound'
        500:
          $ref: '#/components/responses/InternalServerError'
      security:
        - OAuth2Security:
            - apim:admin
      x-code-samples:
        - lang: Shell
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/tenant-config-schema" > tenant-config-schema.json'

  ######################################################
  # The "Key Manager Collection" resource API
  ######################################################
  /key-managers:
    get:
      tags:
        - Key Manager (Collection)
      summary: Get all Key managers
      description: |
        Get all Key managers
      responses:
        200:
          description: |
            OK.
            KeyManagers returned
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KeyManagerList'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:admin_operations
      x-code-samples:
        - lang: Shell
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/key-managers"'

    post:
      tags:
        - Key Manager (Collection)
      summary: Add a new API Key Manager
      description: |
        Add a new API Key Manager
      requestBody:
        description: |
          Key Manager object that should to be added
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KeyManager'
        required: true
      responses:
        201:
          description: |
            Created.
            Successful response with the newly created object as entity in the body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KeyManager'
        400:
          $ref: '#/components/responses/BadRequest'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:admin_operations
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          -H "Content-Type: application/json" -d @data.json "https://127.0.0.1:9443/api/am/admin/v4/key-managers"'

  ######################################################
  # The "Individual KeyManager" resource APIs
  ######################################################
  /key-managers/{keyManagerId}:
    get:
      tags:
        - Key Manager (Individual)
      summary: Get a Key Manager Configuration
      description: |
        Retrieve a single Key Manager Configuration. We should provide the Id of the KeyManager as a path parameter.
      parameters:
        - $ref: '#/components/parameters/keyManagerId'
      responses:
        200:
          description: |
            OK.
            KeyManager Configuration returned
          headers:
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KeyManager'
        404:
          $ref: '#/components/responses/NotFound'
        406:
          $ref: '#/components/responses/NotAcceptable'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:admin_operations
      x-code-samples:
        - lang: Shell
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/key-managers/8d263942-a6df-4cc2-a804-7a2525501450"'

    put:
      tags:
        - Key Manager (Individual)
      summary: Update a Key Manager
      description: |
        Update a Key Manager by keyManager id
      parameters:
        - $ref: '#/components/parameters/keyManagerId'
      requestBody:
        description: |
          Key Manager object with updated information
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KeyManager'
        required: true
      responses:
        200:
          description: |
            OK.
            Label updated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KeyManager'
        400:
          $ref: '#/components/responses/BadRequest'
        404:
          $ref: '#/components/responses/NotFound'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:admin_operations
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          -H "Content-Type: application/json" -d @data.json "https://127.0.0.1:9443/api/am/admin/v4/key-managers/8d263942-a6df-4cc2-a804-7a2525501450"'

    delete:
      tags:
        - Key Manager (Individual)
      summary: Delete a Key Manager
      description: |
        Delete a Key Manager by keyManager id
      parameters:
        - $ref: '#/components/parameters/keyManagerId'
      responses:
        200:
          description: |
            OK.
            Key Manager successfully deleted.
          content: {}
        404:
          $ref: '#/components/responses/NotFound'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:admin_operations
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X DELETE -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/admin/v4/key-managers/8d263942-a6df-4cc2-a804-7a2525501450"'

  /key-managers/discover:
    post:
      tags:
        - Key Manager (Collection)
      summary: Retrieve Well-known information from Key Manager Well-known Endpoint
      description: |
        Retrieve well-known information from key manager's well-known endpoint
      requestBody:
        content:
          multipart/form-data:
            schema:
              properties:
                url:
                  type: string
                  description: Well-Known Endpoint
                type:
                  type: string
                  description: |
                    Key Manager Type
                  default: "false"
      responses:
        200:
          description: |
            OK.
            KeyManagers returned
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KeyManagerWellKnownResponse'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:admin_operations
      x-code-samples:
        - lang: Shell
          source: 'curl -k -X POST -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          -F "type=WSO2-IS" "https://127.0.0.1:9443/api/am/admin/v4/key-managers/discover"'
  ######################################################
  # The "API Collection" resource APIs
  ######################################################
  /apis:
    get:
      tags:
        - APIs
      summary: |
        Retrieve/Search APIs
      description: |
        This operation provides you a list of available APIs qualifying under a given search condition.
        Each retrieved API is represented with a minimal amount of attributes. If you want to get complete details of an API, you need to use **Get details of an API** operation.
      parameters:
        - $ref: '#/components/parameters/limit'
        - $ref: '#/components/parameters/offset'
        - name: query
          in: query
          description: |
            **Search and get all apis in admin portal**.

            You can search by proving a keyword.
          schema:
            type: string
        - $ref: '#/components/parameters/If-None-Match'
      responses:
        200:
          description: |
            OK.
            List of qualifying APIs is returned.
          headers:
            ETag:
              description: |
                Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future).
              schema:
                type: string
            Content-Type:
              description: The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchResultList'
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
          content: { }
        406:
          $ref: '#/components/responses/NotAcceptable'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:api_provider_change
      x-code-samples:
        - lang: Curl
          source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
          "https://127.0.0.1:9443/api/am/publisher/v4/apis"'
      operationId: getAllAPIs
  ######################################################
  # Change Api Provider
  ######################################################
  /apis/{apiId}/change-provider:
    post:
      tags:
        - Api Provider Change
      summary: Update the api provider
      description: |
        Update the api provider
      operationId: providerNamePost
      parameters:
        - name: provider
          in: query
          required: true
          schema:
            type: string
        - $ref: '#/components/parameters/apiId'
      responses:
        200:
          description: |
            OK.
            Api Provider updated.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
        400:
          $ref: '#/components/responses/BadRequest'
        404:
          $ref: '#/components/responses/NotFound'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:api_provider_change
      x-code-samples:
        - lang: Curl
          source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
              -H "Content-Type: application/json" "https://127.0.0.1:9443/api/am/admin/v4/provider/admin/apis/33662a62-8db1-4d75-af08-afd63c6bd0b4"'
components:
  schemas:
    Error:
      title: Error object returned with 4XX HTTP status
      required:
        - code
        - message
      type: object
      properties:
        code:
          type: integer
          description: Error code
          format: int64
        message:
          type: string
          description: Error message.
        description:
          type: string
          description: |
            A detail description about the error message.
        moreInfo:
          type: string
          description: |
            Preferably an url with more details about the error.
        error:
          type: array
          description: |
            If there are more than one error list them out.
            For example, list out validation errors by each field.
          items:
            $ref: '#/components/schemas/ErrorListItem'
    ErrorListItem:
      title: Description of individual errors that may have occurred during a request.
      required:
        - code
        - message
      type: object
      properties:
        code:
          type: string
          description: Error code
        message:
          type: string
          description: |
            Description about individual errors occurred
    ThrottlePolicyDetailsList:
      title: Policy List
      type: object
      properties:
        count:
          type: integer
          description: |
            Number of Throttling Policies returned.
          example: 1
        list:
          type: array
          items:
            $ref: '#/components/schemas/ThrottlePolicyDetails'
    ThrottlePolicyDetails:
      title: Generic Policy
      required:
        - policyName
      type: object
      properties:
        policyId:
          type: integer
          description: Id of policy
          readOnly: true
          example: 3
        uuid:
          type: string
          description: UUId of policy
          readOnly: true
          example: 0c6439fd-9b16-3c2e-be6e-1086e0b9aa93
        policyName:
          maxLength: 60
          minLength: 1
          type: string
          description: Name of policy
          example: 30PerMin
        displayName:
          type: string
          description: Display name of the policy
          example: 30PerMin
          maxLength: 512
        description:
          maxLength: 1024
          type: string
          description: Description of the policy
          example: Allows 30 request per minute
        isDeployed:
          type: boolean
          description: Indicates whether the policy is deployed successfully or not.
          default: false
        type:
          type: string
          description: Indicates the type of throttle policy
    ThrottlePolicy:
      title: Generic Throttling Policy
      required:
        - policyName
      type: object
      properties:
        policyId:
          type: string
          description: Id of policy
          readOnly: true
          example: 0c6439fd-9b16-3c2e-be6e-1086e0b9aa93
        policyName:
          maxLength: 60
          minLength: 1
          type: string
          description: Name of policy
          example: 30PerMin
        displayName:
          type: string
          description: Display name of the policy
          example: 30PerMin
          maxLength: 512
        description:
          maxLength: 1024
          type: string
          description: Description of the policy
          example: Allows 30 request per minute
        isDeployed:
          type: boolean
          description: Indicates whether the policy is deployed successfully or not.
          default: false
        type:
          type: string
          description: Indicates the type of throttle policy
      discriminator:
        propertyName: type
    ExportThrottlePolicy:
      title: Export Throttling Policy
      type : object
      properties:
        type:
          type: string
        subtype:
          type: string
        version:
          type: string
        data:
          type: object
    AdvancedThrottlePolicyInfo:
      title: Advanced Throttling Policy
      allOf:
        - $ref: '#/components/schemas/ThrottlePolicy'
        - type: object
          properties:
            defaultLimit:
              $ref: '#/components/schemas/ThrottleLimit'
    AdvancedThrottlePolicy:
      title: Advanced Throttling Policy
      allOf:
        - $ref: '#/components/schemas/ThrottlePolicy'
        - required:
            - defaultLimit
          type: object
          properties:
            defaultLimit:
              $ref: '#/components/schemas/ThrottleLimit'
            conditionalGroups:
              type: array
              description: |
                Group of conditions which allow adding different parameter conditions to the throttling limit.
              items:
                $ref: '#/components/schemas/ConditionalGroup'
    AdvancedThrottlePolicyList:
      title: Advanced Throttling Policy List
      type: object
      properties:
        count:
          type: integer
          description: |
            Number of Advanced Throttling Policies returned.
          example: 1
        list:
          type: array
          items:
            $ref: '#/components/schemas/AdvancedThrottlePolicyInfo'
    ApplicationThrottlePolicy:
      title: Application Throttling Policy
      allOf:
        - $ref: '#/components/schemas/ThrottlePolicy'
        - required:
            - defaultLimit
          type: object
          properties:
            defaultLimit:
              $ref: '#/components/schemas/ThrottleLimit'
            burstLimit:
              $ref: '#/components/schemas/BurstLimit'
    ApplicationThrottlePolicyList:
      title: Application Level Throttling Policy List
      type: object
      properties:
        count:
          type: integer
          description: |
            Number of Application Throttling Policies returned.
          example: 1
        list:
          type: array
          items:
            $ref: '#/components/schemas/ApplicationThrottlePolicy'
    SubscriptionThrottlePolicy:
      title: Subscription Throttling Policy
      allOf:
        - $ref: '#/components/schemas/ThrottlePolicy'
        - $ref: '#/components/schemas/GraphQLQuery'
        - required:
            - defaultLimit
          type: object
          properties:
            defaultLimit:
              $ref: '#/components/schemas/ThrottleLimit'
            monetization:
              $ref: '#/components/schemas/MonetizationInfo'
            rateLimitCount:
              type: integer
              description: Burst control request count
              example: 10
            rateLimitTimeUnit:
              type: string
              description: Burst control time unit
              example: min
            customAttributes:
              type: array
              description: |
                Custom attributes added to the Subscription Throttling Policy
              example: []
              items:
                $ref: '#/components/schemas/CustomAttribute'
            stopOnQuotaReach:
              type: boolean
              description: |
                This indicates the action to be taken when a user goes beyond the allocated quota. If checked, the user's requests will be dropped. If unchecked, the requests will be allowed to pass through.
              default: false
            billingPlan:
              type: string
              description: |
                define whether this is Paid or a Free plan. Allowed values are FREE or COMMERCIAL.
              example: FREE
            permissions:
              $ref: '#/components/schemas/SubscriptionThrottlePolicyPermission'
            subscriberCount:
              type: integer
              description: |
                Number of subscriptions allowed
              example: 10
    SubscriptionThrottlePolicyPermission:
      title: SubscriptionThrottlePolicyPermission
      required:
        - permissionType
        - roles
      type: object
      properties:
        permissionType:
          type: string
          example: deny
          enum:
            - ALLOW
            - DENY
        roles:
          type: array
          example:
            - Internal/everyone
          items:
            type: string
    GraphQLQuery:
      title: GraphQL Query
      type: object
      properties:
        graphQLMaxComplexity:
          type: integer
          description: Maximum Complexity of the GraphQL query
          example: 400
        graphQLMaxDepth:
          type: integer
          description: Maximum Depth of the GraphQL query
          example: 10
    SubscriptionThrottlePolicyList:
      title: Subscription Level Throttling Policy List
      type: object
      properties:
        count:
          type: integer
          description: |
            Number of Subscription Throttling Policies returned.
          example: 1
        list:
          type: array
          items:
            $ref: '#/components/schemas/SubscriptionThrottlePolicy'
    CustomRule:
      title: Custom Rule
      allOf:
        - $ref: '#/components/schemas/ThrottlePolicy'
        - required:
            - keyTemplate
            - siddhiQuery
          type: object
          properties:
            siddhiQuery:
              type: string
              description: Siddhi query which represents the custom throttling policy
              example: |
                FROM RequestStream\nSELECT userId, ( userId == 'admin@carbon.super' ) AS isEligible , str:concat('admin@carbon.super','') as throttleKey\nINSERT INTO EligibilityStream; \n\nFROM EligibilityStream[isEligible==true]#throttler:timeBatch(1 min) \nSELECT throttleKey, (count(userId) >= 10) as isThrottled, expiryTimeStamp group by throttleKey \nINSERT ALL EVENTS into ResultStream;
            keyTemplate:
              type: string
              description: The specific combination of attributes that are checked in
                the policy.
              example: $userId
    CustomRuleList:
      title: Custom Rule List
      type: object
      properties:
        count:
          type: integer
          description: |
            Number of Custom Rules returned.
          example: 1
        list:
          type: array
          items:
            $ref: '#/components/schemas/CustomRule'
    ConditionalGroup:
      title: Conditional Groups for Throttling
      required:
        - conditions
        - limit
      type: object
      properties:
        description:
          type: string
          description: Description of the Conditional Group
        conditions:
          type: array
          description: |
            Individual throttling conditions. They can be defined as either HeaderCondition, IPCondition, JWTClaimsCondition, QueryParameterCondition
            Please see schemas of each of those throttling condition in Definitions section.
          example: |
            [
              {
                "type": "HEADERCONDITION",
                "invertCondition": false,
                "headerCondition":
                {
                  "headerName": "Host",
                  "headerValue": "10.100.7.77"
                }
              },
              {
                "type": "IPCONDITION",
                "invertCondition": false,
                "ipCondition":
                {
                  "ipConditionType": "IPSPECIFIC",
                  "specificIP": "10.100.1.22",
                  "startingIP": null,
                  "endingIP": null
                }
              },
              {
                "type": "QUERYPARAMETERCONDITION",
                "invertCondition": false,
                "queryParameterCondition":
                {
                  "parameterName": "name",
                  "parameterValue": "admin"
                }
              },
              {
                "type": "JWTCLAIMSCONDITION",
                "invertCondition": true,
                "jwtClaimsCondition":
                {
                  "claimUrl": "claimUrl0",
                  "attribute": "claimAttr0"
                }
              }
            ]
          items:
            $ref: '#/components/schemas/ThrottleCondition'
        limit:
          $ref: '#/components/schemas/ThrottleLimit'
    ThrottleCondition:
      title: Throttling Conditions
      required:
        - type
      type: object
      properties:
        type:
          type: string
          description: |
            Type of the throttling condition. Allowed values are "HEADERCONDITION", "IPCONDITION", "JWTCLAIMSCONDITION"
            and "QUERYPARAMETERCONDITION".
          enum:
            - HEADERCONDITION
            - IPCONDITION
            - JWTCLAIMSCONDITION
            - QUERYPARAMETERCONDITION
        invertCondition:
          type: boolean
          description: |
            Specifies whether inversion of the condition to be matched against the request.

            **Note:** When you add conditional groups for advanced throttling policies, this paramater should have the
            same value ('true' or 'false') for the same type of conditional group.
          default: false
        headerCondition:
          $ref: '#/components/schemas/HeaderCondition'
        ipCondition:
          $ref: '#/components/schemas/IPCondition'
        jwtClaimsCondition:
          $ref: '#/components/schemas/JWTClaimsCondition'
        queryParameterCondition:
          $ref: '#/components/schemas/QueryParameterCondition'
      description: Conditions used for Throttling
    HeaderCondition:
      title: HTTP Header based throttling condition
      required:
        - headerName
        - headerValue
      type: object
      properties:
        headerName:
          type: string
          description: Name of the header
        headerValue:
          type: string
          description: Value of the header
    IPCondition:
      title: IP based throttling condition
      required:
        - specificIP
      type: object
      properties:
        ipConditionType:
          type: string
          description: Type of the IP condition. Allowed values are "IPRANGE" and
            "IPSPECIFIC"
          enum:
            - IPRANGE
            - IPSPECIFIC
        specificIP:
          type: string
          description: Specific IP when "IPSPECIFIC" is used as the ipConditionType
        startingIP:
          type: string
          description: Staring IP when "IPRANGE" is used as the ipConditionType
        endingIP:
          type: string
          description: Ending IP when "IPRANGE" is used as the ipConditionType
    JWTClaimsCondition:
      title: JWT claim attibute based throttling condition
      required:
        - attribute
        - claimUrl
      type: object
      properties:
        claimUrl:
          type: string
          description: JWT claim URL
        attribute:
          type: string
          description: Attribute to be matched
    QueryParameterCondition:
      title: Query parameter based throttling condition
      required:
        - parameterName
        - parameterValue
      type: object
      properties:
        parameterName:
          type: string
          description: Name of the query parameter
        parameterValue:
          type: string
          description: Value of the query parameter to be matched
    ThrottleLimitBase:
      title: Throttle Limit Base
      required:
        - timeUnit
        - unitTime
      type: object
      properties:
        timeUnit:
          type: string
          description: Unit of the time. Allowed values are "sec", "min", "hour",
            "day"
          example: min
        unitTime:
          type: integer
          description: Time limit that the throttling limit applies.
          example: 10
    ThrottleLimit:
      title: Throttle Limit
      required:
        - type
      type: object
      properties:
        type:
          type: string
          description: |
            Type of the throttling limit. Allowed values are "REQUESTCOUNTLIMIT" and "BANDWIDTHLIMIT".
            Please see schemas of "RequestCountLimit" and "BandwidthLimit" throttling limit types in
            Definitions section.
          example: REQUESTCOUNTLIMIT
          enum:
            - REQUESTCOUNTLIMIT
            - BANDWIDTHLIMIT
            - EVENTCOUNTLIMIT
        requestCount:
          $ref: '#/components/schemas/RequestCountLimit'
        bandwidth:
          $ref: '#/components/schemas/BandwidthLimit'
        eventCount:
          $ref: '#/components/schemas/EventCountLimit'
    BurstLimit:
      title: Burst Limit object
      type: object
      properties:
        rateLimitCount:
          type: integer
          description: Burst control request count
          example: 10
        rateLimitTimeUnit:
          type: string
          description: Burst control time unit
          example: min
    MonetizationInfo:
      title: API monetization details object
      required:
        - monetizationPlan
        - properties
      type: object
      properties:
        monetizationPlan:
          type: string
          description: Flag to indicate the monetization plan
          example: FixedRate
          enum:
            - FIXEDRATE
            - DYNAMICRATE
        properties:
          type: object
          additionalProperties:
            type: string
          description: Map of custom properties related to each monetization plan
    BandwidthLimit:
      title: Bandwidth Limit object
      allOf:
        - $ref: '#/components/schemas/ThrottleLimitBase'
        - required:
            - dataAmount
            - dataUnit
          type: object
          properties:
            dataAmount:
              type: integer
              description: Amount of data allowed to be transfered
              format: int64
              example: 1000
            dataUnit:
              type: string
              description: Unit of data allowed to be transfered. Allowed values are
                "KB", "MB" and "GB"
              example: KB
    RequestCountLimit:
      title: Request Count Limit object
      allOf:
        - $ref: '#/components/schemas/ThrottleLimitBase'
        - required:
            - requestCount
          type: object
          properties:
            requestCount:
              type: integer
              description: Maximum number of requests allowed
              format: int64
              example: 30
    EventCountLimit:
      title: Event Count Limit object
      allOf:
        - $ref: '#/components/schemas/ThrottleLimitBase'
        - required:
            - eventCount
          type: object
          properties:
            eventCount:
              type: integer
              description: Maximum number of events allowed
              format: int64
              example: 3000
    BlockingCondition:
      title: Blocking Conditions
      required:
        - conditionType
        - conditionValue
      type: object
      properties:
        conditionId:
          type: string
          description: Id of the blocking condition
          example: b513eb68-69e8-4c32-92cf-852c101363cf
        conditionType:
          type: string
          description: Type of the blocking condition
          example: IP
          enum:
            - API
            - APPLICATION
            - IP
            - IPRANGE
            - USER
        conditionValue:
          type: object
          properties: {}
          description: Value of the blocking condition
          example:
            fixedIp: 192.168.1.1
            invert: false
        conditionStatus:
          type: boolean
          description: Status of the blocking condition
          example: true
      description: Blocking Conditions
    BlockingConditionList:
      title: Blocking Conditions List
      type: object
      properties:
        count:
          type: integer
          description: |
            Number of Blocking Conditions returned.
          example: 1
        list:
          type: array
          items:
            $ref: '#/components/schemas/BlockingCondition'
    BlockingConditionStatus:
      title: Blocking Conditions Status
      required:
        - conditionStatus
      type: object
      properties:
        conditionId:
          type: string
          description: Id of the blocking condition
          example: b513eb68-69e8-4c32-92cf-852c101363cf
        conditionStatus:
          type: boolean
          description: Status of the blocking condition
          example: true
      description: Blocking Conditions Status
    CustomAttribute:
      title: Name-Value pair
      required:
        - name
        - value
      type: object
      properties:
        name:
          type: string
          description: Name of the custom attribute
          example: customAttr1
        value:
          type: string
          description: Value of the custom attribute
          example: value1
    mediationList:
      title: Mediation List
      type: object
      properties:
        count:
          type: integer
          description: |
            Number of mediation sequences returned.
          example: 1
        next:
          type: string
          description: |
            Link to the next subset of sequences qualified.
            Empty if no more sequences are to be returned.
          example: ""
        previous:
          type: string
          description: |
            Link to the previous subset of sequences qualified.
            Empty if current subset is the first subset returned.
          example: ""
        list:
          type: array
          items:
            $ref: '#/components/schemas/MediationInfo'
    MediationInfo:
      title: MediationInfo
      required:
        - id
        - name
        - type
      type: object
      properties:
        name:
          type: string
          example: json_fault.xml
        id:
          type: string
          example: 01234567-0123-0123-0123-012345678901
        type:
          type: string
          example: in
          enum:
            - in
            - out
            - fault
    Mediation:
      title: Mediation
      required:
        - config
        - name
        - type
      type: object
      properties:
        id:
          type: string
          readOnly: true
          example: 01234567-0123-0123-0123-012345678901
        name:
          type: string
          example: custom_log_in_message.xml
        type:
          type: string
          example: IN
          enum:
            - IN
            - OUT
            - FAULT
        config:
          type: string
          example: <sequence xmlns="http://ws.apache.org/ns/synapse" name="custom_log_in_message">
            <log level="full"> <property name="IN_MESSAGE" value="IN_MESSAGE_21133232"/>
            </log> </sequence>
    ApplicationList:
      title: Application List
      type: object
      properties:
        count:
          type: integer
          description: |
            Number of applications returned.
          example: 1
        next:
          type: string
          description: |
            Link to the next subset of resources qualified.
            Empty if no more resources are to be returned.
          example: /applications?limit=1&offset=2&user=
        previous:
          type: string
          description: |
            Link to the previous subset of resources qualified.
            Empty if current subset is the first subset returned.
          example: /applications?limit=1&offset=0&user=
        list:
          type: array
          items:
            $ref: '#/components/schemas/ApplicationInfo'
    ApplicationInfo:
      title: Application info object with basic application details
      type: object
      properties:
        applicationId:
          type: string
          example: 01234567-0123-0123-0123-012345678901
        name:
          type: string
          example: CalculatorApp
        owner:
          type: string
          example: admin
        status:
          type: string
          example: APPROVED
        groupId:
          type: string
          example: ""
    APIInfoList:
      title: API Info List
      type: object
      properties:
        count:
          type: integer
          description: |
            Number of API Info objects returned.
          example: 1
        list:
          type: array
          items:
            $ref: '#/components/schemas/APIInfo'
    APIInfo:
      title: API info object with basic API details
      type: object
      properties:
        name:
          type: string
          description: The name of the API.
          example: PizzaShackAPI
        version:
          type: string
          description: The version of the API
          example: 1.0.0
        provider:
          type: string
          description: The provider of the API
          example: admin
    Label:
      title: Label
      required:
        - name
      type: object
      properties:
        id:
          type: string
          readOnly: true
          example: ece92bdc-e1e6-325c-b6f4-656208a041e9
        name:
          maxLength: 255
          minLength: 1
          type: string
          example: Public
        description:
          maxLength: 1024
          type: string
          example: Label to use for public Gateway
        accessUrls:
          type: array
          items:
            type: string
            example: http://localhost:9443/
    LabelList:
      title: Label List
      type: object
      properties:
        count:
          type: integer
          description: |
            Number of Labels returned.
          example: 1
        list:
          type: array
          items:
            $ref: '#/components/schemas/Label'
    Environment:
      title: Environment
      required:
        - name
        - vhosts
      type: object
      properties:
        id:
          type: string
          readOnly: true
          example: ece92bdc-e1e6-325c-b6f4-656208a041e9
        name:
          maxLength: 255
          minLength: 1
          pattern: '(^[^~!@#;:%^*()+={}|\\<>"'',&$\s+]*$)'
          type: string
          example: us-region
        displayName:
          maxLength: 255
          minLength: 1
          type: string
          example: US Region
        description:
          maxLength: 1023
          type: string
          example: Gateway environment in US Region
        provider:
          type: string
          example: wso2
        gatewayType:
          type: string
          example: Regular
          default: Regular
        isReadOnly:
          type: boolean
          readOnly: true
          example: false
        vhosts:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/VHost'
        endpointURIs:
          type: array
          items:
            $ref: '#/components/schemas/GatewayEnvironmentProtocolURI'
        additionalProperties:
          type: array
          items:
            $ref: '#/components/schemas/AdditionalProperty'
    EnvironmentList:
      title: Environment List
      type: object
      properties:
        count:
          type: integer
          description: |
            Number of Environments returned.
          example: 1
        list:
          type: array
          items:
            $ref: '#/components/schemas/Environment'
    VHost:
      title: Virtual Host
      required:
        - host
      type: object
      properties:
        host:
          maxLength: 255
          minLength: 1
          # hostname regex as per RFC 1123 (http://tools.ietf.org/html/rfc1123) and appended *
          pattern: '^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$'
          type: string
          example: mg.wso2.com
        httpContext:
          maxLength: 255
          minLength: 0
          pattern: '^\/?([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])*$'
          type: string
          example: pets
        httpPort:
          type: integer
          example: 80
        httpsPort:
          type: integer
          example: 443
        wsPort:
          type: integer
          example: 9099
        wssPort:
          type: integer
          example: 8099
    AdditionalProperty:
      title: Additional Gateway Properties
      type: object
      properties:
        key:
          type: string
          example: Organization
        value:
          type: string
          example: wso2
    GatewayEnvironmentProtocolURI:
      title: Gateway Environment protocols and URIs
      required:
        - protocol
        - endpointURI
      type: object
      properties:
        protocol:
          type: string
          example: default
        endpointURI:
          type: string
          example: default
    PublishStatus:
      title: Usage publish status
      type: object
      properties:
        status:
          type: string
          description: Status of the usage publish request
          example: successfull
        message:
          type: string
          description: detailed message of the status
          example: Records published successfully
    MonetizationUsagePublishInfo:
      title: Usage publish status
      type: object
      properties:
        state:
          type: string
          description: State of usage publish job
          example: RUNNING
        status:
          type: string
          description: Status of usage publish job
          example: SUCCESSFULL
        startedTime:
          type: string
          description: Timestamp of the started time of the Job
          example: "1599196134000"
        lastPublsihedTime:
          type: string
          description: Timestamp of the last published time
          example: "1599196134000"
    Workflow:
      title: workflow
      required:
        - status
      type: object
      properties:
        status:
          type: string
          description: |
            This attribute declares whether this workflow task is approved or rejected.
          example: APPROVED
          enum:
            - APPROVED
            - REJECTED
        attributes:
          type: object
          additionalProperties:
            type: string
          description: |
            Custom attributes to complete the workflow task
          example: {}
        description:
          type: string
          example: Approve workflow request.
    TenantInfo:
      title: Tenant information
      type: object
      properties:
        username:
          type: string
          example: john
        tenantDomain:
          type: string
          example: carbon.super
        tenantId:
          type: integer
          example: -1234
      description: The tenant information of the user
    CustomUrlInfo:
      title: Custom url information
      type: object
      properties:
        tenantDomain:
          type: string
          example: carbon.super
        tenantAdminUsername:
          type: string
          example: john@foo.com
        enabled:
          type: boolean
          example: true
        devPortal:
          type: object
          properties:
            url:
              type: string
              example: http://example.com
      description: The custom url information of the tenant domain
    APICategory:
      title: API Category
      required:
        - name
      type: object
      properties:
        id:
          type: string
          readOnly: true
          example: 01234567-0123-0123-0123-012345678901
        name:
          maxLength: 255
          minLength: 1
          type: string
          example: Finance
        description:
          maxLength: 1024
          type: string
          example: Finance related APIs
        numberOfAPIs:
          type: integer
          readOnly: true
          example: 1
    APICategoryList:
      title: API Category List
      type: object
      properties:
        count:
          type: integer
          description: |
            Number of API categories returned.
          example: 1
        list:
          type: array
          items:
            $ref: '#/components/schemas/APICategory'
    FileInfo:
      title: File Information including meta data
      type: object
      properties:
        relativePath:
          type: string
          description: relative location of the file (excluding the base context and
            host of the Admin API)
          example: api-categories/01234567-0123-0123-0123-012345678901/thumbnail
        mediaType:
          type: string
          description: media-type of the file
          example: image/jpeg
    Settings:
      title: Settings
      type: object
      properties:
        scopes:
          type: array
          items:
            type: string
        gatewayTypes:
          type: array
          items:
            type: string
        keyManagerConfiguration:
          type: array
          items:
            type: object
            properties:
              type:
                type: string
                example: default
              displayName:
                type: string
                example: default
              defaultConsumerKeyClaim:
                type: string
                example: azp
              defaultScopesClaim:
                type: string
                example: scope
              configurations:
                type: array
                items:
                  $ref: '#/components/schemas/KeyManagerConfiguration'
        analyticsEnabled:
          type: boolean
          description: To determine whether analytics is enabled or not
          example: false
    ScopeList:
      title: Scope Role Mapping List
      type: object
      properties:
        count:
          type: integer
          description: |
            Number of scopes available for tenant.
          readOnly: true
          example: 60
        list:
          type: array
          items:
            $ref: '#/components/schemas/Scope'
    Scope:
      title: Scope Role
      type: object
      properties:
        tag:
          type: string
          description: |
            Portal name.
          example: publisher
        name:
          type: string
          description: |
            Scope name.
          example: apim:api_publish
        description:
          type: string
          description: |
            About scope.
          example: Publish API
        roles:
          type: array
          description: |
            Roles for the particular scope.
          example:
            - admin
            - Internal/publisher
          items:
            type: string
    KeyManagerWellKnownResponse:
      title: Key Manager Well-Known Response.
      type: object
      properties:
        valid:
          type: boolean
          example: true
          default: false
        value:
          $ref: '#/components/schemas/KeyManager'
    KeyManager:
      title: Key Manager
      required:
        - name
        - type
      type: object
      properties:
        id:
          type: string
          readOnly: true
          example: 01234567-0123-0123-0123-012345678901
        name:
          maxLength: 100
          minLength: 1
          type: string
          example: WSO2 Identity Server
        displayName:
          maxLength: 100
          type: string
          description: |
            display name of Key Manager to  show in UI
          example: WSO2 Identity Server
        type:
          maxLength: 45
          minLength: 1
          type: string
          example: WSO2-IS
        description:
          maxLength: 256
          type: string
          example: This is a key manager for Developers
        wellKnownEndpoint:
          type: string
          description: |
            Well-Known Endpoint of Identity Provider.
          example: ""
        introspectionEndpoint:
          type: string
          example: https://localhost:9444/oauth2/introspect
        clientRegistrationEndpoint:
          type: string
          example: https://localhost:9444/keymanager-operations/dcr/register
        tokenEndpoint:
          type: string
          example: https://localhost:9444/oauth2/token
        displayTokenEndpoint:
          type: string
          example: https://localhost:9444/oauth2/token
        revokeEndpoint:
          type: string
          example: https://localhost:9444/oauth2/revoke
        displayRevokeEndpoint:
          type: string
          example: https://localhost:9444/oauth2/revoke
        userInfoEndpoint:
          type: string
          example: https://localhost:9444/oauth2/userinfo?schema=openid
        authorizeEndpoint:
          type: string
          example: https://localhost:9444/oauth2/authorize
        certificates:
          type: object
          properties:
            type:
              type: string
              enum:
                - JWKS
                - PEM
            value:
              type: string
        issuer:
          type: string
          example: https://localhost:9444/services
        alias:
          type: string
          description: |
            The alias of Identity Provider.
            If the tokenType is EXCHANGED, the alias value should be inclusive in the audience values of the JWT token
          example: https://localhost:9443/oauth2/token
        scopeManagementEndpoint:
          type: string
          example: https://wso2is.com:9444/api/identity/oauth2/v1.0/scopes
        availableGrantTypes:
          type: array
          items:
            type: string
            example: client_credentials
        enableTokenGeneration:
          type: boolean
          example: true
        enableTokenEncryption:
          type: boolean
          example: false
          default: false
        enableTokenHashing:
          type: boolean
          example: false
          default: false
        enableMapOAuthConsumerApps:
          type: boolean
          example: false
          default: false
        enableOAuthAppCreation:
          type: boolean
          example: false
          default: false
        enableSelfValidationJWT:
          type: boolean
          example: true
          default: true
        claimMapping:
          type: array
          items:
            $ref: '#/components/schemas/ClaimMappingEntry'
        consumerKeyClaim:
          type: string
          example: azp
        scopesClaim:
          type: string
          example: scp
        tokenValidation:
          type: array
          items:
            $ref: '#/components/schemas/TokenValidation'
        enabled:
          type: boolean
          example: true
        additionalProperties:
          type: object
          properties: { }
          example:
            self_validate_jwt: true
            Username: admin
            Password: admin
        permissions:
          type: object
          properties:
            permissionType:
              type: string
              example: ALLOW
              default: PUBLIC
              enum:
                - PUBLIC
                - ALLOW
                - DENY
            roles:
              type: array
              items:
                type: string
                example: Internal/subscriber
        tokenType:
          type: string
          description: The type of the tokens to be used (exchanged or without exchanged).
            Accepted values are EXCHANGED and DIRECT.
          example: EXCHANGED
          default: DIRECT
          enum:
            - EXCHANGED
            - DIRECT
            - BOTH
    KeyManagerInfo:
      title: Key Manager Info
      required:
        - name
        - type
      type: object
      properties:
        id:
          type: string
          example: 01234567-0123-0123-0123-012345678901
        name:
          type: string
          example: WSO2 IS
        type:
          type: string
          example: IS
        description:
          type: string
          example: This is a key manager for Developers
        enabled:
          type: boolean
          example: true
        tokenType:
          type: string
          description: The type of the tokens to be used (exchanged or without exchanged).
            Accepted values are EXCHANGED and DIRECT.
          example: EXCHANGED
          default: DIRECT
          enum:
            - EXCHANGED
            - DIRECT
            - BOTH
    KeyManagerConfiguration:
      title: Key Manager Configuration
      type: object
      properties:
        name:
          type: string
          example: consumer_key
        label:
          type: string
          example: Consumer Key
        type:
          type: string
          example: select
        required:
          type: boolean
          example: true
        mask:
          type: boolean
          example: true
        multiple:
          type: boolean
          example: true
        tooltip:
          type: string
          example: Entet username to connect to key manager
        default:
          type: object
          properties: {}
          example: admin
        values:
          type: array
          items:
            type: object
            properties: {}
    KeyManagerList:
      title: Key Manager List
      type: object
      properties:
        count:
          type: integer
          description: |
            Number of Key managers returned.
          example: 1
        list:
          type: array
          items:
            $ref: '#/components/schemas/KeyManagerInfo'
    ClaimMappingEntry:
      title: Claim Mapping Configuration
      type: object
      properties:
        remoteClaim:
          type: string
          example: http://idp.org/username
        localClaim:
          type: string
          example: http://wso2.org/username
    TokenValidation:
      title: Token handling Configuration
      type: object
      properties:
        id:
          type: integer
        enable:
          type: boolean
          example: false
          default: true
        type:
          type: string
          enum:
            - REFERENCE
            - JWT
            - CUSTOM
        value:
          type: object
          properties: {}
    ScopeSettings:
      title: Settings
      type: object
      properties:
        name:
          type: string
          example: apim:subscribe
    AlertTypesList:
      title: Alert Types List
      type: object
      properties:
        count:
          type: integer
          description: The number of alerts
          example: 3
        alerts:
          type: array
          items:
            $ref: '#/components/schemas/AlertType'
    AlertType:
      title: Alert Type
      type: object
      properties:
        id:
          type: string
          description: The alert Id
          example: "1"
        name:
          type: string
          description: The name of the alert.
          example: AbnormalResponseTime
    AlertsSubscription:
      title: Alerts Subscription
      type: object
      properties:
        alerts:
          type: array
          items:
            $ref: '#/components/schemas/AlertType'
        emailList:
          type: array
          items:
            type: string
            format: email
            example: admin@wso2.com
    BotDetectionAlertSubscriptionList:
      title: Bot Detection Alert Subscription List
      type: object
      properties:
        count:
          type: integer
          description: |
            Number of Bot Detection Alert Subscriptions returned.
          example: 3
        list:
          type: array
          items:
            $ref: '#/components/schemas/BotDetectionAlertSubscription'
    BotDetectionAlertSubscription:
      title: Bot Detection Alert Subscription
      required:
        - email
      type: object
      properties:
        uuid:
          type: string
          description: UUID of the subscription
          example: urn:uuid:1ed6d2de-29df-4fed-a96a-46d2329dce65
        email:
          type: string
          description: email
          example: abc@gmail.com
    WorkflowList:
      title: WorkflowList
      type: object
      properties:
        count:
          type: integer
          description: |
            Number of workflow processes returned.
          example: 1
        next:
          type: string
          description: |
            Link to the next subset of resources qualified.
            Empty if no more resources are to be returned.
          example: /workflows?limit=1&offset=2&user=
        previous:
          type: string
          description: |
            Link to the previous subset of resources qualified.
            Empty if current subset is the first subset returned.
          example: /workflows?limit=1&offset=0&user=
        list:
          type: array
          items:
            $ref: '#/components/schemas/WorkflowInfo'
    WorkflowInfo:
      title: Workflow info object with basic workflow details
      type: object
      properties:
        workflowType:
          type: string
          description: |
            Type of the Workflow Request. It shows which type of request is it.
          example: APPLICATION_CREATION
          enum:
            - APPLICATION_CREATION
            - SUBSCRIPTION_CREATION
            - USER_SIGNUP
            - APPLICATION_REGISTRATION_PRODUCTION
            - APPLICATION_REGISTRATION_SANDBOX
            - APPLICATION_DELETION
            - API_STATE
            - SUBSCRIPTION_DELETION
            - SUBSCRIPTION_UPDATE
            - API_PRODUCT_STATE
            - REVISION_DEPLOYMENT
        workflowStatus:
          type: string
          description: |
            Show the Status of the the workflow request whether it is approved or created.
          example: APPROVED
          enum:
            - APPROVED
            - CREATED
        createdTime:
          type: string
          description: |
            Time of the the workflow request created.
          example: 2020-02-10 10:10:19.704
        updatedTime:
          type: string
          description: |
            Time of the the workflow request updated.
          example: 2020-02-10 10:10:19.704
        referenceId:
          type: string
          description: |
            Workflow external reference is used to identify the workflow requests uniquely.
          example: 5871244b-d6f3-466e-8995-8accd1e64303
        properties:
          type: object
          properties: {}
        description:
          type: string
          description: |
            description is a message with basic details about the workflow request.
          example: Approve application [APP1] creation request from application creator
            - admin with throttling tier - 10MinPer
    WorkflowResponse:
      title: workflow Response
      required:
        - workflowStatus
      type: object
      properties:
        workflowStatus:
          type: string
          description: |
            This attribute declares whether this workflow task is approved or rejected.
          example: APPROVED
          enum:
            - CREATED
            - APPROVED
            - REJECTED
            - REGISTERED
        jsonPayload:
          type: string
          description: |
            Attributes that returned after the workflow execution
    BotDetectionDataList:
      title: Bot Detection Data List
      type: object
      properties:
        count:
          type: integer
          description: |
            Number of Bot Detection Data returned.
          example: 1
        list:
          type: array
          items:
            $ref: '#/components/schemas/BotDetectionData'
    BotDetectionData:
      title: Bot Detection Data
      type: object
      properties:
        recordedTime:
          type: integer
          description: The time of detection
          format: int64
          example: 1591734138413
        messageID:
          type: string
          description: The message ID
          example: urn:uuid:1ed6d2de-29df-4fed-a96a-46d2329dce65
        apiMethod:
          type: string
          description: The api method
          example: GET
        headerSet:
          type: string
          description: The header set
          example: '[Accept=*/*, Host=localhost:8243, User-Agent=curl/7.58.0]'
        messageBody:
          type: string
          description: The content of the message body
          example: <soapenv:Body xmlns:soapenv=\"http://www.w3.org/2003/05/soap-envelope\"/>
        clientIp:
          type: string
          description: The IP of the client
          example: 127.0.0.1
    RoleAliasList:
      title: Role alias list
      type: object
      properties:
        count:
          type: integer
          description: The number of role aliases
          example: 1
        list:
          type: array
          items:
            $ref: '#/components/schemas/RoleAlias'
    RoleAlias:
      title: Role alias
      type: object
      properties:
        role:
          type: string
          description: The original role
          example: Internal/subscriber
        aliases:
          type: array
          description: The role mapping for role alias
          example:
            - Subscriber
            - Internal/subscriber
          items:
            type: string
    SearchResultList:
      title: Unified Search Result List
      type: object
      properties:
        apis:
          type: array
          items:
            $ref: '#/components/schemas/ApiResult'
        count:
          type: integer
          description: |
            Number of results returned.
          example: 1
        pagination:
          $ref: '#/components/schemas/Pagination'
    ApiResult:
      type: object
      properties:
        provider:
          type: string
        name:
          type: string
        version:
          type: string
        id:
          type: string
    Pagination:
      title: Pagination
      type: object
      properties:
        offset:
          type: integer
          example: 0
        limit:
          type: integer
          example: 1
        total:
          type: integer
          example: 10
        next:
          type: string
          description: |
            Link to the next subset of resources qualified.
            Empty if no more resources are to be returned.
            example: ""
        previous:
          type: string
          description: |
            Link to the previous subset of resources qualified.
            Empty if current subset is the first subset returned.
            example: ""
  responses:
    BadRequest:
      description: Bad Request. Invalid request or validation error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            code: 400
            message: Bad Request
            description: Invalid request or validation error
            moreInfo: ""
            error: []
    Conflict:
      description: Conflict. Specified resource already exists.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            code: 409
            message: Conflict
            description: Specified resource already exists
            moreInfo: ""
            error: []
    Forbidden:
      description: Forbidden. The request must be conditional but no condition has
        been specified.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            code: 403
            message: Forbidden
            description: The request must be conditional but no condition has been
              specified
            moreInfo: ""
            error: []
    InternalServerError:
      description: Internal Server Error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            code: 500
            message: Internal Server Error
            description: The server encountered an internal error. Please contact
              administrator.
            moreInfo: ""
            error: []
    NotAcceptable:
      description: Not Acceptable. The requested media type is not supported.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            code: 406
            message: Not Acceptable
            description: The requested media type is not supported
            moreInfo: ""
            error: []
    NotFound:
      description: Not Found. The specified resource does not exist.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            code: 404
            message: Not Found
            description: The specified resource does not exist
            moreInfo: ""
            error: []
    PayloadTooLarge:
      description: Payload Too Large. Request entity is larger than limits defined
        by server.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            code: 413
            message: Payload Too Large
            description: Request entity is larger than limits defined by server
            moreInfo: ""
            error: []
    PreconditionFailed:
      description: Precondition Failed. The request has not been performed because
        one of the preconditions is not met.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            code: 412
            message: Precondition Failed
            description: The request has not been performed because one of the preconditions
              is not met
            moreInfo: ""
            error: []
    Unauthorized:
      description: Unauthorized. The user is not authorized.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            code: 401
            message: Unauthorized
            description: The user is not authorized
            moreInfo: ""
            error: []
    UnsupportedMediaType:
      description: Unsupported Media Type. The entity of the request was not in a
        supported format.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            code: 415
            message: Unsupported media type
            description: The entity of the request was not in a supported format
            moreInfo: ""
            error: []
  parameters:
    username:
      name: username
      in: query
      description: |
        username of the new application owner
      required: true
      schema:
        type: string
    scopeName:
      name: scopeName
      in: path
      description: |
        scope name to be validated
      required: true
      schema:
        type: string
    labelId:
      name: labelId
      in: path
      description: |
        Label UUID
      required: true
      schema:
        type: string
    environmentId:
      name: environmentId
      in: path
      description: |
        Environment UUID (or Environment name defined in config)
      required: true
      schema:
        type: string
    policyId:
      name: policyId
      in: path
      description: |
        Thorttle policy UUID
      required: true
      schema:
        type: string
    ruleId:
      name: ruleId
      in: path
      description: |
        Custom rule UUID
      required: true
      schema:
        type: string
    applicationId:
      name: applicationId
      in: path
      description: |
        Application UUID
      required: true
      schema:
        type: string
    conditionId:
      name: conditionId
      in: path
      description: |
        Blocking condition identifier
      required: true
      schema:
        type: string
    Accept:
      name: Accept
      in: header
      description: |
        Media types acceptable for the response. Default is application/json.
      schema:
        type: string
        default: application/json
    Content-Type:
      name: Content-Type
      in: header
      description: |
        Media type of the entity in the body. Default is application/json.
      required: true
      schema:
        type: string
        default: application/json
    If-None-Match:
      name: If-None-Match
      in: header
      description: |
        Validator for conditional requests; based on the ETag of the formerly retrieved
        variant of the resource (Will be supported in future).
      schema:
        type: string
    If-Modified-Since:
      name: If-Modified-Since
      in: header
      description: |
        Validator for conditional requests; based on Last Modified header of the
        formerly retrieved variant of the resource (Will be supported in future).
      schema:
        type: string
    If-Match:
      name: If-Match
      in: header
      description: |
        Validator for conditional requests; based on ETag (Will be supported in future).
      schema:
        type: string
    If-Unmodified-Since:
      name: If-Unmodified-Since
      in: header
      description: |
        Validator for conditional requests; based on Last Modified header (Will be supported in future).
      schema:
        type: string
    limit:
      name: limit
      in: query
      description: |
        Maximum size of resource array to return.
      schema:
        type: integer
        default: 25
    offset:
      name: offset
      in: query
      description: |
        Starting point within the complete list of items qualified.
      schema:
        type: integer
        default: 0
    mediationPolicyId:
      name: mediationPolicyId
      in: path
      description: |
        Mediation policy Id
      required: true
      schema:
        type: string
    user:
      name: user
      in: query
      description: |
        username of the application creator
      schema:
        type: string
    workflowReferenceId-Q:
      name: workflowReferenceId
      in: query
      description: |
        Workflow reference id
      required: true
      schema:
        type: string
    apiCategoryId:
      name: apiCategoryId
      in: path
      description: |
        API Category UUID
      required: true
      schema:
        type: string
    keyManagerId:
      name: keyManagerId
      in: path
      description: |
        Key Manager UUID
      required: true
      schema:
        type: string
    apiId:
      name: apiId
      in: path
      description: |
        **API ID** consisting of the **UUID** of the API.
      required: true
      schema:
        type: string
  securitySchemes:
    OAuth2Security:
      type: oauth2
      flows:
        password:
          tokenUrl: https://localhost:9443/oauth2/token
          scopes:
            openid: Authorize access to user details
            apim:policies_import_export: Export and import policies related operations
            apim:admin: Manage all admin operations
            apim:tier_view: View throttling policies
            apim:tier_manage: Update and delete throttling policies
            apim:bl_view: View deny policies
            apim:bl_manage: Update and delete deny policies
            apim:mediation_policy_view: View mediation policies
            apim:mediation_policy_create: Create and update mediation policies
            apim:app_owner_change: Retrieve and manage applications
            apim:app_import_export: Import and export applications related operations
            apim:api_import_export: Import and export APIs related operations
            apim:api_product_import_export: Import and export API Products related
              operations
            apim:label_manage: Manage microgateway labels
            apim:label_read: Retrieve microgateway labels
            apim:environment_manage: Manage gateway environments
            apim:environment_read: Retrieve gateway environments
            apim:monetization_usage_publish: Retrieve and publish Monetization related
              usage records
            apim:api_workflow_approve: Manage workflows
            apim:bot_data: Retrieve bot detection data
            apim:tenantInfo: Retrieve tenant related information
            apim:tenant_theme_manage: Manage tenant themes
            apim:admin_operations: Manage API categories and Key Managers related
              operations
            apim:admin_settings: Retrieve admin settings
            apim:admin_alert_manage: Manage admin alerts
            apim:api_workflow_view: Retrive workflow requests
            apim:scope_manage: Manage system scopes
