swagger: "2.0"
schemes:
  - https
host: management.azure.com
info:
  description: Use these REST APIs for performing operations on Subscription entity associated with your Azure API Management deployment. The Subscription entity represents the association between a user and a product in API Management. Products contain one or more APIs, and once a product is published, developers can subscribe to the product and begin to use the product’s APIs.
  title: ApiManagementClient
  version: 2019-12-01-preview
  x-apisguru-categories:
    - cloud
  x-logo:
    url: https://api.apis.guru/v2/cache/logo/https_assets.onestore.ms_cdnfiles_onestorerolling-1606-01000_shell_v3_images_logo_microsoft.png
  x-origin:
    - format: swagger
      url: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2019-12-01-preview/apimsubscriptions.json
      version: "2.0"
  x-preferred: true
  x-providerName: azure.com
  x-serviceName: apimanagement-apimsubscriptions
  x-tags:
    - Azure
    - Microsoft
consumes:
  - application/json
produces:
  - application/json
securityDefinitions:
  azure_auth:
    authorizationUrl: https://login.microsoftonline.com/common/oauth2/authorize
    description: Azure Active Directory OAuth2 Flow.
    flow: implicit
    scopes:
      user_impersonation: impersonate your user account
    type: oauth2
security:
  - azure_auth:
      - user_impersonation
parameters: {}
paths:
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions":
    get:
      description: Lists all subscriptions of the API Management service instance.
      operationId: Subscription_List
      parameters:
        - description: The name of the resource group.
          in: path
          name: resourceGroupName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the API Management service.
          in: path
          maxLength: 50
          minLength: 1
          name: serviceName
          pattern: ^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: "|   Field     |     Usage     |     Supported operators     |     Supported functions     |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith | </br>| state | filter | eq |     | </br>| user | expand |     |     | </br>"
          in: query
          name: $filter
          required: false
          type: string
        - description: Number of records to return.
          format: int32
          in: query
          minimum: 1
          name: $top
          required: false
          type: integer
          x-ms-parameter-location: method
        - description: Number of records to skip.
          format: int32
          in: query
          minimum: 0
          name: $skip
          required: false
          type: integer
          x-ms-parameter-location: method
        - description: Version of the API to be used with the client request.
          in: query
          name: api-version
          required: true
          type: string
        - description: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
          in: path
          name: subscriptionId
          required: true
          type: string
      responses:
        "200":
          description: A collection of the Subscription entities for the specified API Management service instance.
          schema:
            description: Paged Subscriptions list representation.
            properties:
              nextLink:
                description: Next page link if any.
                type: string
              value:
                description: Page values.
                items:
                  allOf:
                    - description: The Resource definition.
                      properties:
                        id:
                          description: Resource ID.
                          readOnly: true
                          type: string
                        name:
                          description: Resource name.
                          readOnly: true
                          type: string
                        type:
                          description: Resource type for API Management resource.
                          readOnly: true
                          type: string
                      x-ms-azure-resource: true
                  description: Subscription details.
                  properties:
                    properties:
                      description: Subscription details.
                      properties:
                        allowTracing:
                          description: Determines whether tracing is enabled
                          type: boolean
                          x-apim-code-nillable: true
                        createdDate:
                          description: |
                            Subscription creation date. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
                          format: date-time
                          readOnly: true
                          type: string
                        displayName:
                          description: The name of the subscription, or null if the subscription has no name.
                          maxLength: 100
                          minLength: 0
                          type: string
                        endDate:
                          description: |
                            Date when subscription was cancelled or expired. The setting is for audit purposes only and the subscription is not automatically cancelled. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
                          format: date-time
                          type: string
                        expirationDate:
                          description: |
                            Subscription expiration date. The setting is for audit purposes only and the subscription is not automatically expired. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
                          format: date-time
                          type: string
                        notificationDate:
                          description: |
                            Upcoming subscription expiration notification date. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
                          format: date-time
                          type: string
                        ownerId:
                          description: The user resource identifier of the subscription owner. The value is a valid relative URL in the format of /users/{userId} where {userId} is a user identifier.
                          type: string
                        primaryKey:
                          description: Subscription primary key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value.
                          maxLength: 256
                          minLength: 1
                          type: string
                          x-ms-secret: true
                        scope:
                          description: Scope like /products/{productId} or /apis or /apis/{apiId}.
                          type: string
                        secondaryKey:
                          description: Subscription secondary key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value.
                          maxLength: 256
                          minLength: 1
                          type: string
                          x-ms-secret: true
                        startDate:
                          description: |
                            Subscription activation date. The setting is for audit purposes only and the subscription is not automatically activated. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
                          format: date-time
                          type: string
                        state:
                          description: Subscription state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated.
                          enum:
                            - suspended
                            - active
                            - expired
                            - submitted
                            - rejected
                            - cancelled
                          type: string
                          x-ms-enum:
                            modelAsString: false
                            name: SubscriptionState
                        stateComment:
                          description: Optional subscription comment added by an administrator.
                          type: string
                      required:
                        - scope
                        - state
                type: array
        default:
          description: Error response describing why the operation failed.
          schema:
            description: Error Response.
            properties:
              error:
                description: Error Body contract.
                properties:
                  code:
                    description: Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response.
                    type: string
                  details:
                    description: The list of invalid fields send in request, in case of validation error.
                    items:
                      description: Error Field contract.
                      properties:
                        code:
                          description: Property level error code.
                          type: string
                        message:
                          description: Human-readable representation of property-level error.
                          type: string
                        target:
                          description: Property name.
                          type: string
                    type: array
                  message:
                    description: Human-readable representation of the error.
                    type: string
      tags:
        - Subscription
      x-ms-examples:
        ApiManagementListSubscriptions:
          parameters:
            api-version: 2019-12-01-preview
            resourceGroupName: rg1
            serviceName: apimService1
            subscriptionId: subid
          responses:
            "200":
              body:
                nextLink: ""
                value:
                  - id: /subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/subscriptions/5600b59475ff190048070001
                    name: 5600b59475ff190048070001
                    properties:
                      createdDate: 2015-09-22T01:57:40.3Z
                      ownerId: /subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/1
                      scope: /subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/5600b59475ff190048060001
                      state: active
                    type: Microsoft.ApiManagement/service/subscriptions
                  - id: /subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/subscriptions/56eaed3dbaf08b06e46d27fe
                    name: 56eaed3dbaf08b06e46d27fe
                    properties:
                      createdDate: 2016-03-17T17:45:33.837Z
                      displayName: Starter
                      expirationDate: 2016-04-01T00:00:00Z
                      notificationDate: 2016-03-20T00:00:00Z
                      ownerId: /subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/56eaec62baf08b06e46d27fd
                      scope: /subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/5600b59475ff190048060001
                      startDate: 2016-03-17T00:00:00Z
                      state: active
                    type: Microsoft.ApiManagement/service/subscriptions
                  - id: /subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/subscriptions/5931a769d8d14f0ad8ce13b8
                    name: 5931a769d8d14f0ad8ce13b8
                    properties:
                      createdDate: 2017-06-02T17:59:06.223Z
                      displayName: Unlimited
                      ownerId: /subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/5931a75ae4bbd512a88c680b
                      scope: /subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/5600b59475ff190048060002
                      state: submitted
                    type: Microsoft.ApiManagement/service/subscriptions
      x-ms-odata: ./definitions.json#/definitions/SubscriptionContract
      x-ms-pageable:
        nextLinkName: nextLink
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}":
    delete:
      description: Deletes the specified subscription.
      operationId: Subscription_Delete
      parameters:
        - description: The name of the resource group.
          in: path
          name: resourceGroupName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the API Management service.
          in: path
          maxLength: 50
          minLength: 1
          name: serviceName
          pattern: ^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: Subscription entity Identifier. The entity represents the association between a user and a product in API Management.
          in: path
          maxLength: 256
          name: sid
          pattern: ^[^*#&+:<>?]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update.
          in: header
          name: If-Match
          required: true
          type: string
          x-ms-parameter-location: method
        - description: Version of the API to be used with the client request.
          in: query
          name: api-version
          required: true
          type: string
        - description: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
          in: path
          name: subscriptionId
          required: true
          type: string
      responses:
        "200":
          description: The subscription details were successfully deleted.
        "204":
          description: The subscription details were successfully deleted.
        default:
          description: Error response describing why the operation failed.
          schema:
            description: Error Response.
            properties:
              error:
                description: Error Body contract.
                properties:
                  code:
                    description: Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response.
                    type: string
                  details:
                    description: The list of invalid fields send in request, in case of validation error.
                    items:
                      description: Error Field contract.
                      properties:
                        code:
                          description: Property level error code.
                          type: string
                        message:
                          description: Human-readable representation of property-level error.
                          type: string
                        target:
                          description: Property name.
                          type: string
                    type: array
                  message:
                    description: Human-readable representation of the error.
                    type: string
      tags:
        - Subscription
      x-ms-examples:
        ApiManagementDeleteSubscription:
          parameters:
            If-Match: "*"
            api-version: 2019-12-01-preview
            resourceGroupName: rg1
            serviceName: apimService1
            sid: testsub
            subscriptionId: subid
          responses:
            "200": {}
            "204": {}
    get:
      description: Gets the specified Subscription entity.
      operationId: Subscription_Get
      parameters:
        - description: The name of the resource group.
          in: path
          name: resourceGroupName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the API Management service.
          in: path
          maxLength: 50
          minLength: 1
          name: serviceName
          pattern: ^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: Subscription entity Identifier. The entity represents the association between a user and a product in API Management.
          in: path
          maxLength: 256
          name: sid
          pattern: ^[^*#&+:<>?]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: Version of the API to be used with the client request.
          in: query
          name: api-version
          required: true
          type: string
        - description: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
          in: path
          name: subscriptionId
          required: true
          type: string
      responses:
        "200":
          description: The response body contains the specified Subscription entity.
          headers:
            ETag:
              description: Current entity state version. Should be treated as opaque and used to make conditional HTTP requests.
              type: string
          schema:
            allOf:
              - description: The Resource definition.
                properties:
                  id:
                    description: Resource ID.
                    readOnly: true
                    type: string
                  name:
                    description: Resource name.
                    readOnly: true
                    type: string
                  type:
                    description: Resource type for API Management resource.
                    readOnly: true
                    type: string
                x-ms-azure-resource: true
            description: Subscription details.
            properties:
              properties:
                description: Subscription details.
                properties:
                  allowTracing:
                    description: Determines whether tracing is enabled
                    type: boolean
                    x-apim-code-nillable: true
                  createdDate:
                    description: |
                      Subscription creation date. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
                    format: date-time
                    readOnly: true
                    type: string
                  displayName:
                    description: The name of the subscription, or null if the subscription has no name.
                    maxLength: 100
                    minLength: 0
                    type: string
                  endDate:
                    description: |
                      Date when subscription was cancelled or expired. The setting is for audit purposes only and the subscription is not automatically cancelled. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
                    format: date-time
                    type: string
                  expirationDate:
                    description: |
                      Subscription expiration date. The setting is for audit purposes only and the subscription is not automatically expired. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
                    format: date-time
                    type: string
                  notificationDate:
                    description: |
                      Upcoming subscription expiration notification date. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
                    format: date-time
                    type: string
                  ownerId:
                    description: The user resource identifier of the subscription owner. The value is a valid relative URL in the format of /users/{userId} where {userId} is a user identifier.
                    type: string
                  primaryKey:
                    description: Subscription primary key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value.
                    maxLength: 256
                    minLength: 1
                    type: string
                    x-ms-secret: true
                  scope:
                    description: Scope like /products/{productId} or /apis or /apis/{apiId}.
                    type: string
                  secondaryKey:
                    description: Subscription secondary key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value.
                    maxLength: 256
                    minLength: 1
                    type: string
                    x-ms-secret: true
                  startDate:
                    description: |
                      Subscription activation date. The setting is for audit purposes only and the subscription is not automatically activated. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
                    format: date-time
                    type: string
                  state:
                    description: Subscription state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated.
                    enum:
                      - suspended
                      - active
                      - expired
                      - submitted
                      - rejected
                      - cancelled
                    type: string
                    x-ms-enum:
                      modelAsString: false
                      name: SubscriptionState
                  stateComment:
                    description: Optional subscription comment added by an administrator.
                    type: string
                required:
                  - scope
                  - state
        default:
          description: Error response describing why the operation failed.
          schema:
            description: Error Response.
            properties:
              error:
                description: Error Body contract.
                properties:
                  code:
                    description: Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response.
                    type: string
                  details:
                    description: The list of invalid fields send in request, in case of validation error.
                    items:
                      description: Error Field contract.
                      properties:
                        code:
                          description: Property level error code.
                          type: string
                        message:
                          description: Human-readable representation of property-level error.
                          type: string
                        target:
                          description: Property name.
                          type: string
                    type: array
                  message:
                    description: Human-readable representation of the error.
                    type: string
      tags:
        - Subscription
      x-ms-examples:
        ApiManagementGetSubscription:
          parameters:
            api-version: 2019-12-01-preview
            resourceGroupName: rg1
            serviceName: apimService1
            sid: 5931a769d8d14f0ad8ce13b8
            subscriptionId: subid
          responses:
            "200":
              body:
                id: /subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/subscriptions/5931a769d8d14f0ad8ce13b8
                name: 5931a769d8d14f0ad8ce13b8
                properties:
                  createdDate: 2017-06-02T17:59:06.223Z
                  displayName: Unlimited
                  ownerId: /subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/5931a75ae4bbd512a88c680b
                  scope: /subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/5600b59475ff190048060002
                  state: submitted
                type: Microsoft.ApiManagement/service/subscriptions
    head:
      description: Gets the entity state (Etag) version of the apimanagement subscription specified by its identifier.
      operationId: Subscription_GetEntityTag
      parameters:
        - description: The name of the resource group.
          in: path
          name: resourceGroupName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the API Management service.
          in: path
          maxLength: 50
          minLength: 1
          name: serviceName
          pattern: ^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: Subscription entity Identifier. The entity represents the association between a user and a product in API Management.
          in: path
          maxLength: 256
          name: sid
          pattern: ^[^*#&+:<>?]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: Version of the API to be used with the client request.
          in: query
          name: api-version
          required: true
          type: string
        - description: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
          in: path
          name: subscriptionId
          required: true
          type: string
      responses:
        "200":
          description: Specified apimanagement subscription entity exists and current entity state version is present in the ETag header.
          headers:
            ETag:
              description: Current entity state version. Should be treated as opaque and used to make conditional HTTP requests.
              type: string
        default:
          description: Error response describing why the operation failed.
          schema:
            description: Error Response.
            properties:
              error:
                description: Error Body contract.
                properties:
                  code:
                    description: Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response.
                    type: string
                  details:
                    description: The list of invalid fields send in request, in case of validation error.
                    items:
                      description: Error Field contract.
                      properties:
                        code:
                          description: Property level error code.
                          type: string
                        message:
                          description: Human-readable representation of property-level error.
                          type: string
                        target:
                          description: Property name.
                          type: string
                    type: array
                  message:
                    description: Human-readable representation of the error.
                    type: string
      tags:
        - Subscription
      x-ms-examples:
        ApiManagementHeadSubscription:
          parameters:
            api-version: 2019-12-01-preview
            resourceGroupName: rg1
            serviceName: apimService1
            sid: 5931a769d8d14f0ad8ce13b8
            subscriptionId: subid
          responses:
            "200":
              headers:
                etag: AAAAAAAAAAa=
    patch:
      description: Updates the details of a subscription specified by its identifier.
      operationId: Subscription_Update
      parameters:
        - description: The name of the resource group.
          in: path
          name: resourceGroupName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the API Management service.
          in: path
          maxLength: 50
          minLength: 1
          name: serviceName
          pattern: ^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: Subscription entity Identifier. The entity represents the association between a user and a product in API Management.
          in: path
          maxLength: 256
          name: sid
          pattern: ^[^*#&+:<>?]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: Update parameters.
          in: body
          name: parameters
          required: true
          schema:
            description: Subscription update details.
            properties:
              properties:
                description: Parameters supplied to the Update subscription operation.
                properties:
                  allowTracing:
                    description: Determines whether tracing can be enabled
                    type: boolean
                  displayName:
                    description: Subscription name.
                    type: string
                  expirationDate:
                    description: "Subscription expiration date. The setting is for audit purposes only and the subscription is not automatically expired. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard."
                    format: date-time
                    type: string
                  ownerId:
                    description: "User identifier path: /users/{userId}"
                    type: string
                  primaryKey:
                    description: Primary subscription key.
                    maxLength: 256
                    minLength: 1
                    type: string
                  scope:
                    description: Scope like /products/{productId} or /apis or /apis/{apiId}
                    type: string
                  secondaryKey:
                    description: Secondary subscription key.
                    maxLength: 256
                    minLength: 1
                    type: string
                  state:
                    description: Subscription state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated.
                    enum:
                      - suspended
                      - active
                      - expired
                      - submitted
                      - rejected
                      - cancelled
                    type: string
                    x-ms-enum:
                      modelAsString: false
                      name: SubscriptionState
                  stateComment:
                    description: Comments describing subscription state change by the administrator.
                    type: string
        - description: |-
            Notify change in Subscription State. 
             - If false, do not send any email notification for change of state of subscription 
             - If true, send email notification of change of state of subscription 
          in: query
          name: notify
          required: false
          type: boolean
          x-ms-parameter-location: method
        - description: ETag of the Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update.
          in: header
          name: If-Match
          required: true
          type: string
          x-ms-parameter-location: method
        - description: Version of the API to be used with the client request.
          in: query
          name: api-version
          required: true
          type: string
        - description: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
          in: path
          name: subscriptionId
          required: true
          type: string
      responses:
        "204":
          description: The subscription details were successfully updated.
        default:
          description: Error response describing why the operation failed.
          schema:
            description: Error Response.
            properties:
              error:
                description: Error Body contract.
                properties:
                  code:
                    description: Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response.
                    type: string
                  details:
                    description: The list of invalid fields send in request, in case of validation error.
                    items:
                      description: Error Field contract.
                      properties:
                        code:
                          description: Property level error code.
                          type: string
                        message:
                          description: Human-readable representation of property-level error.
                          type: string
                        target:
                          description: Property name.
                          type: string
                    type: array
                  message:
                    description: Human-readable representation of the error.
                    type: string
      tags:
        - Subscription
      x-ms-examples:
        ApiManagementUpdateSubscription:
          parameters:
            If-Match: "*"
            api-version: 2019-12-01-preview
            parameters:
              properties:
                displayName: testsub
            resourceGroupName: rg1
            serviceName: apimService1
            sid: testsub
            subscriptionId: subid
          responses:
            "204": {}
    put:
      description: Creates or updates the subscription of specified user to the specified product.
      operationId: Subscription_CreateOrUpdate
      parameters:
        - description: The name of the resource group.
          in: path
          name: resourceGroupName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the API Management service.
          in: path
          maxLength: 50
          minLength: 1
          name: serviceName
          pattern: ^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: Subscription entity Identifier. The entity represents the association between a user and a product in API Management.
          in: path
          maxLength: 256
          name: sid
          pattern: ^[^*#&+:<>?]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: Create parameters.
          in: body
          name: parameters
          required: true
          schema:
            description: Subscription create details.
            properties:
              properties:
                description: Parameters supplied to the Create subscription operation.
                properties:
                  allowTracing:
                    description: Determines whether tracing can be enabled
                    type: boolean
                  displayName:
                    description: Subscription name.
                    maxLength: 100
                    minLength: 1
                    type: string
                  ownerId:
                    description: User (user id path) for whom subscription is being created in form /users/{userId}
                    type: string
                  primaryKey:
                    description: Primary subscription key. If not specified during request key will be generated automatically.
                    maxLength: 256
                    minLength: 1
                    type: string
                  scope:
                    description: Scope like /products/{productId} or /apis or /apis/{apiId}.
                    type: string
                  secondaryKey:
                    description: Secondary subscription key. If not specified during request key will be generated automatically.
                    maxLength: 256
                    minLength: 1
                    type: string
                  state:
                    description: Initial subscription state. If no value is specified, subscription is created with Submitted state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated.
                    enum:
                      - suspended
                      - active
                      - expired
                      - submitted
                      - rejected
                      - cancelled
                    type: string
                    x-ms-enum:
                      modelAsString: false
                      name: SubscriptionState
                required:
                  - scope
                  - displayName
        - description: |-
            Notify change in Subscription State. 
             - If false, do not send any email notification for change of state of subscription 
             - If true, send email notification of change of state of subscription 
          in: query
          name: notify
          required: false
          type: boolean
          x-ms-parameter-location: method
        - description: ETag of the Entity. Not required when creating an entity, but required when updating an entity.
          in: header
          name: If-Match
          required: false
          type: string
          x-ms-parameter-location: method
        - description: Version of the API to be used with the client request.
          in: query
          name: api-version
          required: true
          type: string
        - description: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
          in: path
          name: subscriptionId
          required: true
          type: string
      responses:
        "200":
          description: The user already subscribed to the product.
          headers:
            ETag:
              description: Current entity state version. Should be treated as opaque and used to make conditional HTTP requests.
              type: string
          schema:
            allOf:
              - description: The Resource definition.
                properties:
                  id:
                    description: Resource ID.
                    readOnly: true
                    type: string
                  name:
                    description: Resource name.
                    readOnly: true
                    type: string
                  type:
                    description: Resource type for API Management resource.
                    readOnly: true
                    type: string
                x-ms-azure-resource: true
            description: Subscription details.
            properties:
              properties:
                description: Subscription details.
                properties:
                  allowTracing:
                    description: Determines whether tracing is enabled
                    type: boolean
                    x-apim-code-nillable: true
                  createdDate:
                    description: |
                      Subscription creation date. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
                    format: date-time
                    readOnly: true
                    type: string
                  displayName:
                    description: The name of the subscription, or null if the subscription has no name.
                    maxLength: 100
                    minLength: 0
                    type: string
                  endDate:
                    description: |
                      Date when subscription was cancelled or expired. The setting is for audit purposes only and the subscription is not automatically cancelled. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
                    format: date-time
                    type: string
                  expirationDate:
                    description: |
                      Subscription expiration date. The setting is for audit purposes only and the subscription is not automatically expired. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
                    format: date-time
                    type: string
                  notificationDate:
                    description: |
                      Upcoming subscription expiration notification date. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
                    format: date-time
                    type: string
                  ownerId:
                    description: The user resource identifier of the subscription owner. The value is a valid relative URL in the format of /users/{userId} where {userId} is a user identifier.
                    type: string
                  primaryKey:
                    description: Subscription primary key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value.
                    maxLength: 256
                    minLength: 1
                    type: string
                    x-ms-secret: true
                  scope:
                    description: Scope like /products/{productId} or /apis or /apis/{apiId}.
                    type: string
                  secondaryKey:
                    description: Subscription secondary key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value.
                    maxLength: 256
                    minLength: 1
                    type: string
                    x-ms-secret: true
                  startDate:
                    description: |
                      Subscription activation date. The setting is for audit purposes only and the subscription is not automatically activated. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
                    format: date-time
                    type: string
                  state:
                    description: Subscription state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated.
                    enum:
                      - suspended
                      - active
                      - expired
                      - submitted
                      - rejected
                      - cancelled
                    type: string
                    x-ms-enum:
                      modelAsString: false
                      name: SubscriptionState
                  stateComment:
                    description: Optional subscription comment added by an administrator.
                    type: string
                required:
                  - scope
                  - state
        "201":
          description: The user was successfully subscribed to the product.
          headers:
            ETag:
              description: Current entity state version. Should be treated as opaque and used to make conditional HTTP requests.
              type: string
          schema:
            allOf:
              - description: The Resource definition.
                properties:
                  id:
                    description: Resource ID.
                    readOnly: true
                    type: string
                  name:
                    description: Resource name.
                    readOnly: true
                    type: string
                  type:
                    description: Resource type for API Management resource.
                    readOnly: true
                    type: string
                x-ms-azure-resource: true
            description: Subscription details.
            properties:
              properties:
                description: Subscription details.
                properties:
                  allowTracing:
                    description: Determines whether tracing is enabled
                    type: boolean
                    x-apim-code-nillable: true
                  createdDate:
                    description: |
                      Subscription creation date. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
                    format: date-time
                    readOnly: true
                    type: string
                  displayName:
                    description: The name of the subscription, or null if the subscription has no name.
                    maxLength: 100
                    minLength: 0
                    type: string
                  endDate:
                    description: |
                      Date when subscription was cancelled or expired. The setting is for audit purposes only and the subscription is not automatically cancelled. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
                    format: date-time
                    type: string
                  expirationDate:
                    description: |
                      Subscription expiration date. The setting is for audit purposes only and the subscription is not automatically expired. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
                    format: date-time
                    type: string
                  notificationDate:
                    description: |
                      Upcoming subscription expiration notification date. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
                    format: date-time
                    type: string
                  ownerId:
                    description: The user resource identifier of the subscription owner. The value is a valid relative URL in the format of /users/{userId} where {userId} is a user identifier.
                    type: string
                  primaryKey:
                    description: Subscription primary key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value.
                    maxLength: 256
                    minLength: 1
                    type: string
                    x-ms-secret: true
                  scope:
                    description: Scope like /products/{productId} or /apis or /apis/{apiId}.
                    type: string
                  secondaryKey:
                    description: Subscription secondary key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value.
                    maxLength: 256
                    minLength: 1
                    type: string
                    x-ms-secret: true
                  startDate:
                    description: |
                      Subscription activation date. The setting is for audit purposes only and the subscription is not automatically activated. The subscription lifecycle can be managed by using the `state` property. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
                    format: date-time
                    type: string
                  state:
                    description: Subscription state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated.
                    enum:
                      - suspended
                      - active
                      - expired
                      - submitted
                      - rejected
                      - cancelled
                    type: string
                    x-ms-enum:
                      modelAsString: false
                      name: SubscriptionState
                  stateComment:
                    description: Optional subscription comment added by an administrator.
                    type: string
                required:
                  - scope
                  - state
        default:
          description: Error response describing why the operation failed.
          schema:
            description: Error Response.
            properties:
              error:
                description: Error Body contract.
                properties:
                  code:
                    description: Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response.
                    type: string
                  details:
                    description: The list of invalid fields send in request, in case of validation error.
                    items:
                      description: Error Field contract.
                      properties:
                        code:
                          description: Property level error code.
                          type: string
                        message:
                          description: Human-readable representation of property-level error.
                          type: string
                        target:
                          description: Property name.
                          type: string
                    type: array
                  message:
                    description: Human-readable representation of the error.
                    type: string
      tags:
        - Subscription
      x-ms-examples:
        ApiManagementCreateSubscription:
          parameters:
            api-version: 2019-12-01-preview
            parameters:
              properties:
                displayName: testsub
                ownerId: /subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/57127d485157a511ace86ae7
                scope: /subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/5600b59475ff190048060002
            resourceGroupName: rg1
            serviceName: apimService1
            sid: testsub
            subscriptionId: subid
          responses:
            "200":
              body:
                id: /subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/subscriptions/testsub
                name: testsub
                properties:
                  createdDate: 2017-06-02T23:34:03.1055076Z
                  displayName: testsub
                  ownerId: /subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/57127d485157a511ace86ae7
                  scope: /subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/5600b59475ff190048060002
                  state: submitted
                type: Microsoft.ApiManagement/service/subscriptions
            "201":
              body:
                id: /subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/subscriptions/testsub
                name: testsub
                properties:
                  createdDate: 2017-06-02T23:34:03.1055076Z
                  displayName: testsub
                  ownerId: /subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/57127d485157a511ace86ae7
                  scope: /subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/5600b59475ff190048060002
                  state: submitted
                type: Microsoft.ApiManagement/service/subscriptions
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/listSecrets":
    post:
      description: Gets the subscription keys.
      operationId: Subscription_ListSecrets
      parameters:
        - description: The name of the resource group.
          in: path
          name: resourceGroupName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the API Management service.
          in: path
          maxLength: 50
          minLength: 1
          name: serviceName
          pattern: ^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: Subscription entity Identifier. The entity represents the association between a user and a product in API Management.
          in: path
          maxLength: 256
          name: sid
          pattern: ^[^*#&+:<>?]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: Version of the API to be used with the client request.
          in: query
          name: api-version
          required: true
          type: string
        - description: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
          in: path
          name: subscriptionId
          required: true
          type: string
      responses:
        "200":
          description: The response body contains subscription keys.
          schema:
            description: Subscription keys.
            properties:
              primaryKey:
                description: Subscription primary key.
                maxLength: 256
                minLength: 1
                type: string
              secondaryKey:
                description: Subscription secondary key.
                maxLength: 256
                minLength: 1
                type: string
        default:
          description: Error response describing why the operation failed.
          schema:
            description: Error Response.
            properties:
              error:
                description: Error Body contract.
                properties:
                  code:
                    description: Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response.
                    type: string
                  details:
                    description: The list of invalid fields send in request, in case of validation error.
                    items:
                      description: Error Field contract.
                      properties:
                        code:
                          description: Property level error code.
                          type: string
                        message:
                          description: Human-readable representation of property-level error.
                          type: string
                        target:
                          description: Property name.
                          type: string
                    type: array
                  message:
                    description: Human-readable representation of the error.
                    type: string
      tags:
        - Subscription
      x-ms-examples:
        ApiManagementListSecretsSubscription:
          parameters:
            api-version: 2019-12-01-preview
            resourceGroupName: rg1
            serviceName: apimService1
            sid: 5931a769d8d14f0ad8ce13b8
            subscriptionId: subid
          responses:
            "200":
              body:
                primaryKey: 6de0a3b2da204e459148d2f6785873f0
                secondaryKey: c6de00b451f64ea780db1eb8dcf30b62
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/regeneratePrimaryKey":
    post:
      description: Regenerates primary key of existing subscription of the API Management service instance.
      operationId: Subscription_RegeneratePrimaryKey
      parameters:
        - description: The name of the resource group.
          in: path
          name: resourceGroupName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the API Management service.
          in: path
          maxLength: 50
          minLength: 1
          name: serviceName
          pattern: ^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: Subscription entity Identifier. The entity represents the association between a user and a product in API Management.
          in: path
          maxLength: 256
          name: sid
          pattern: ^[^*#&+:<>?]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: Version of the API to be used with the client request.
          in: query
          name: api-version
          required: true
          type: string
        - description: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
          in: path
          name: subscriptionId
          required: true
          type: string
      responses:
        "204":
          description: The primary key was successfully regenerated.
        default:
          description: Error response describing why the operation failed.
          schema:
            description: Error Response.
            properties:
              error:
                description: Error Body contract.
                properties:
                  code:
                    description: Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response.
                    type: string
                  details:
                    description: The list of invalid fields send in request, in case of validation error.
                    items:
                      description: Error Field contract.
                      properties:
                        code:
                          description: Property level error code.
                          type: string
                        message:
                          description: Human-readable representation of property-level error.
                          type: string
                        target:
                          description: Property name.
                          type: string
                    type: array
                  message:
                    description: Human-readable representation of the error.
                    type: string
      tags:
        - Subscription
      x-ms-examples:
        ApiManagementSubscriptionRegeneratePrimaryKey:
          parameters:
            api-version: 2019-12-01-preview
            resourceGroupName: rg1
            serviceName: apimService1
            sid: testsub
            subscriptionId: subid
          responses:
            "204": {}
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/regenerateSecondaryKey":
    post:
      description: Regenerates secondary key of existing subscription of the API Management service instance.
      operationId: Subscription_RegenerateSecondaryKey
      parameters:
        - description: The name of the resource group.
          in: path
          name: resourceGroupName
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The name of the API Management service.
          in: path
          maxLength: 50
          minLength: 1
          name: serviceName
          pattern: ^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: Subscription entity Identifier. The entity represents the association between a user and a product in API Management.
          in: path
          maxLength: 256
          name: sid
          pattern: ^[^*#&+:<>?]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: Version of the API to be used with the client request.
          in: query
          name: api-version
          required: true
          type: string
        - description: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
          in: path
          name: subscriptionId
          required: true
          type: string
      responses:
        "204":
          description: The secondary key was successfully regenerated.
        default:
          description: Error response describing why the operation failed.
          schema:
            description: Error Response.
            properties:
              error:
                description: Error Body contract.
                properties:
                  code:
                    description: Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response.
                    type: string
                  details:
                    description: The list of invalid fields send in request, in case of validation error.
                    items:
                      description: Error Field contract.
                      properties:
                        code:
                          description: Property level error code.
                          type: string
                        message:
                          description: Human-readable representation of property-level error.
                          type: string
                        target:
                          description: Property name.
                          type: string
                    type: array
                  message:
                    description: Human-readable representation of the error.
                    type: string
      tags:
        - Subscription
      x-ms-examples:
        ApiManagementSubscriptionRegenerateSecondaryKey:
          parameters:
            api-version: 2019-12-01-preview
            resourceGroupName: rg1
            serviceName: apimService1
            sid: testsub
            subscriptionId: subid
          responses:
            "204": {}
definitions: {}
