openapi: 3.0.1
info:
  title: CCM User Subscription Service
  description: |
    Cloud Core Management Services: User Subscription Service  
    APIs that support Access Token:
      - /v2/userSubscriptions 


    {% admonition type="info" name="" %}
      No whitelisting required.
    {% /admonition %}

    ```plain {% title="ClientID" %}
    76605fa451c74e4ab43ac66411c08f05
    ```    
  version: 1.0.0.0
  x-product-id: CCM-User-Subscription-Service
security:
  - bearer: []
    appkey: []
tags:
  - name: user-subscription-service-v2
    description: >-
      Query user subscription information. In v2, user subscriptions are
      contingent upon user accepting latest terms and conditions.
paths:
  /v2/userSubscriptions:
    get:
      tags:
        - user-subscription-service-v2
      summary: Get the user's active subscriptions.
      description: >
        - The API returns active subscriptions associated with the user
        specified in the provided user token, given that the user has accepted
        the latest SLB Digital T&Cs.

        - At least one of groupId, appCode or billingAccountId is required. 

        - If query parameters are specified, then the results are filtered using
        an AND operation.

        - The user is identified through their user-principal, as indicated by
        the email claim in the JWT token within the authorization header.

        - The API caller is authenticated via the service principal, as
        indicated by the azp (Authorized Party) claim in the JWT token within
        the authorization header.

        - If your application must be scoped to specific billing accounts, the
        client ID needs the `ccm.subscription.read` (e.g., the controlPlaneAdmin
        role) permission. Please raise the request with the CSI team.

        - The API enforces a request rate limit of 10 requests per minute per
        caller.
      operationId: GetUserSubscriptionsWithTerms
      parameters:
        - name: appCode
          in: query
          description: A unique identifier of an application as defined in the catalog.
          schema:
            type: string
          example: apideveloperportal
        - name: groupId
          in: query
          description: >-
            A unique identifier to specify the application's group as defined in
            the catalog.
          schema:
            type: string
          example: Cirrus
        - name: billingAccountId
          in: query
          description: >-
            ID of the billing account representing client's legal entity with
            which a contract was signed.
          schema:
            type: string
          example: DIGITAL2020
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionsResponse'
        '204':
          description: No Content
          content: {}
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimpleResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimpleResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimpleResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimpleResponse'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimpleResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimpleResponse'
        '503':
          description: Service Unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimpleResponse'
      security:
        - bearer: []
          appkey: []
components:
  schemas:
    SubscriptionsResponse:
      type: object
      properties:
        hasAcceptedTerms:
          type: boolean
          description: True if user has accepted latest terms and conditions
        userSubscriptions:
          type: array
          items:
            $ref: '#/components/schemas/Response'
      description: >-
        response for user subscriptions that includes indicator whether latest
        terms and conditions were accepted
    Response:
      type: object
      properties:
        contractId:
          type: string
          description: >-
            ContractId is the CRM ID for the Contract, with which user's
            subscription was approved
        billingAccountId:
          type: string
          description: billingAccountId is the CRM ID for the Billing Account
        billingAccountName:
          type: string
          description: Billing account name
        subscriptions:
          type: array
          items:
            $ref: '#/components/schemas/Subscriptions'
      description: response for user subscription
    Subscriptions:
      type: object
      properties:
        departmentId:
          type: string
          description: departmentId is the CCM Auto-Generated ID for the Department
        departmentName:
          type: string
          description: department name
        subscriptionId:
          type: string
          description: subscriptionId is the CCM Auto-Generated ID for the Subscription
        region:
          type: string
          description: Region of the endpoint registered in Delfi
        endpointID:
          type: string
          description: A unique id issued for the endpoint (instance) registered in Delfi
        endpointLabel:
          type: string
          description: Name/Label registered for the endpointID
        instance:
          type: string
          description: URL of the endpoint registered in Delfi
        userId:
          type: string
          description: userId is the user email retrieved from user token
        durationId:
          type: string
          description: >-
            Commitment duration selected in Delfi Portal at the time of
            approving a subscription request
        createdAt:
          type: string
          format: date-time
          description: Time at which subscription got created
        createdBy:
          type: string
          description: userID of caller
          example: abc@slb.com
        deletedAt:
          type: string
          format: date-time
          x-nullable: true
          description: >-
            Time at which subscription got deleted. It will be empty for active
            subscriptions
        anniversaryDate:
          type: string
          format: date-time
          description: >-
            A monthly anniversary date of a subscription based on the creation
            date
        isConsultantMode:
          type: boolean
          x-nullable: true
          description: >-
            Subscriptions requested by SLB users in this mode are not charged to
            the contract
        icon:
          type: string
          description: An icon representing the product.
          example: https://api.evd.csp.slb.com/ccm/catalog/v1/icons/EISJ-IS-UTL
        deletedBy:
          type: string
          description: userID of person deleting the susbcription.
          example: abc@slb.com
        product:
          $ref: '#/components/schemas/Product'
      description: user subscription
    Product:
      type: object
      properties:
        description:
          type: string
          description: Description of the Product
        partNumber:
          type: string
          description: Unique id of the product
        name:
          type: string
          description: Name of the product
        code:
          type: string
          description: Code assigned for Product
        groupId:
          type: string
          description: Product group id
        featureSets:
          type: array
          items:
            $ref: '#/components/schemas/FeatureSets'
          x-omitempty: true
        productType:
          type: string
          description: Type of Product (e.g. Domain profile, Plugin etc.)
      description: Details of the product associated with the subscription
    FeatureSets:
      type: object
      description: Feature claims grouped together as per product/business requirements
      properties:
        applicationName:
          type: string
          description: Name of application whose access is granted by product subscription
        applicationCode:
          type: string
          description: Unique application code
        name:
          type: string
          description: Name of feature set grouping feature claims of an application
        type:
          type: string
          description: Type of feature set e.g. Base, Add-On
        claims:
          type: array
          description: >-
            Feature claims representing access to various workflows within an
            application
          items:
            type: string
          x-omitempty: true
    SimpleResponse:
      type: object
      properties:
        message:
          type: string
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: User Token from SLB Authenticator Service
    appkey:
      type: apiKey
      description: AppKey/ConsumerKey from your App on Developer Portal
      name: appkey
      in: header
x-google-endpoints:
  - name: user-subscription-service
servers:
  - url: https://api.delfi.slb.com/ccm/userSubscription
    description: US
  - url: https://eu-api.delfi.slb.com/ccm/userSubscription
    description: EU
