WSO2 Admin Portal API

The WSO2 API Manager Admin Portal API manages users, roles, policies, and system configurations. It provides administrative control over subscription tiers, application policies, advanced throttling policies, and system-wide settings.

OpenAPI Specification

wso2-admin-api.yaml Raw ↑
#   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/master/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
    The Admin REST API is 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.example.com",
      "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.example.com",
    "clientSecret": "a4FwHlq0iCIKVs2MPIIDnepZnYMa",
    "isSaasApplication": true,
    "appOwner": "admin",
    "jsonString": "{\"grant_types\":\"client_credentials password refresh_token\",\"redirect_uris\":\"www.example.com\",\"client_name\":\"rest_api_admin\"}",
    "jsonAppAttribute": "{}",
    "tokenType": null
    }
    ```
    Note that in a distributed deployment or IS as KM separated environment to invoke RESTful APIs (product APIs), users must generate tokens through API-M Control Plane's token endpoint.
    The tokens generated using third party key managers, are to manage end-user authentication when accessing APIs.
    
    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>:<server_port>/oauth2/token
    ```
    **Sample request**
    ```
    curl https://localhost:9443/oauth2/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/32294946-71bea2bc-f808-4208-a4f6-861ede6f0434)
  contact:
    name: WSO2
    url: https://wso2.com/api-manager/
    email: [email protected]
  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:
        - Unified 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 and name 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
            - apim:admin_tier_view
            - 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/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'
      responses:
        200:
          description: |
            OK.
            Policies returned
          headers:
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApplicationThrottlePolicyList'
        406:
          $ref: '#/components/responses/NotAcceptable'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:tier_view
            - apim:admin_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/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:
            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
                type: ApplicationThrottlePolicy
                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
            - apim:admin_tier_manage
      x-code-samples:
        - lang: Curl
          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'
      responses:
        200:
          description: |
            OK.
            Policy returned
          headers:
            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
                type: ApplicationThrottlePolicy
                defaultLimit:
                  type: REQUESTCOUNTLIMIT
                  requestCount:
                    timeUnit: min
                    unitTime: 1
                    requestCount: 20
        404:
          $ref: '#/components/responses/NotFound'
        406:
          $ref: '#/components/responses/NotAcceptable'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:tier_view
            - apim:admin_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/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'
      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:
            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
                type: ApplicationThrottlePolicy
                defaultLimit:
                  type: REQUESTCOUNTLIMIT
                  requestCount:
                    timeUnit: min
                    unitTime: 1
                    requestCount: 20
        400:
          $ref: '#/components/responses/BadRequest'
        404:
          $ref: '#/components/responses/NotFound'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:tier_manage
            - apim:admin_tier_manage
      x-code-samples:
        - lang: Curl
          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'
      responses:
        200:
          description: |
            OK.
            Resource successfully deleted.
          content: {}
        404:
          $ref: '#/components/responses/NotFound'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:tier_manage
            - apim:admin_tier_manage
            - apim:policies_import_export
      x-code-samples:
        - lang: Curl
          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 "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'
      responses:
        200:
          description: |
            OK.
            Policies returned
          headers:
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionThrottlePolicyList'
        406:
          $ref: '#/components/responses/NotAcceptable'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:tier_view
            - apim:admin_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/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:
            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
                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
            - apim:admin_tier_manage
      x-code-samples:
        - lang: Curl
          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'
      responses:
        200:
          description: |
            OK.
            Policy returned
          headers:
            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
                defaultLimit:
                  type: REQUESTCOUNTLIMIT
                  requestCount:
                    timeUnit: min
                    unitTime: 1
                    requestCount: 5000
                rateLimitCount: 0
                customAttributes: []
                stopOnQuotaReach: true
                billingPlan: FREE
        404:
          $ref: '#/components/responses/NotFound'
        406:
          $ref: '#/components/responses/NotAcceptable'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:tier_view
            - apim:admin_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/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'
      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:
            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
                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'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:tier_manage
            - apim:admin_tier_manage
      x-code-samples:
        - lang: Curl
          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'
      responses:
        200:
          description: |
            OK.
            Resource successfully deleted.
          content: {}
        404:
          $ref: '#/components/responses/NotFound'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:tier_manage
            - apim:admin_tier_manage
            - apim:policies_import_export
      x-code-samples:
        - lang: Curl
          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'
      responses:
        200:
          description: |
            OK.
            Policies returned
          headers:
            Content-Type:
              description: |
                The content type of the body.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomRuleList'
        406:
          $ref: '#/components/responses/NotAcceptable'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:tier_view
            - apim:admin_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/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:
            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 == '[email protected]'\
                  \ ) AS isEligible , str:concat('[email protected]','') 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
            - apim:admin_tier_manage
      x-code-samples:
        - lang: Curl
          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'
      responses:
        200:
          description: |
            OK.
            Policy returned
          headers:
            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 == '[email protected]'\
                  \ ) AS isEligible , str:concat('[email protected]','') 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
        404:
          $ref: '#/components/responses/NotFound'
        406:
          $ref: '#/components/responses/NotAcceptable'
      security:
        - OAuth2Security:
            - apim:admin
            - apim:tier_view
            - apim:admin_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/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'
      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:
        

# --- truncated at 32 KB (257 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/wso2/refs/heads/main/openapi/wso2-admin-api.yaml