openapi: 3.0.1
info:
  title: Elevate Provisioning API
  description: >
    ### Provisioning

    Provides API access to activate, reactivate, suspend and deactivate mobile
    SIMs
  version: '2.1'
servers:
  - url: https://rest.elevatebilling.com/v2
tags:
  - name: provisioning
    description: >-
      Provisioning requests to activate, reactivate, suspend and deactivate
      mobile SIMs
paths:
  /sim-activation-request:
    post:
      tags:
        - provisioning
      summary: Activate a new mobile SIM
      operationId: activateSim
      x-si-permissions:
        - UPDATE_INVENTORY
      security:
        - bearerAuth: []
      requestBody:
        description: Request to activate mobile SIM
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ActivateSimRequest'
            examples:
              ActivationWithPorting:
                value:
                  rentalProductInventoryId: 1
                  portingRequest:
                    portingPacCode: ABC123456
                    requestedPortingDate: '2023-10-12'
              ActivationOnly:
                value:
                  rentalProductInventoryId: 1
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProvisioningResponse'
        '400':
          description: Bad Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
  /sim-suspension-request:
    post:
      tags:
        - provisioning
      summary: Suspend a mobile SIM
      operationId: suspendSim
      x-si-permissions:
        - UPDATE_INVENTORY
      security:
        - bearerAuth: []
      requestBody:
        description: Request to suspend mobile SIM
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RentalProvisioningRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProvisioningResponse'
        '400':
          description: Bad Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
  /sim-reactivation-request:
    post:
      tags:
        - provisioning
      summary: Reactivate a mobile SIM
      operationId: reactivateSim
      x-si-permissions:
        - UPDATE_INVENTORY
      security:
        - bearerAuth: []
      requestBody:
        description: Request to reactivate mobile SIM
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RentalProvisioningRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProvisioningResponse'
        '400':
          description: Bad Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
  /sim-modification-request:
    post:
      tags:
        - provisioning
      summary: Modify options on this product
      operationId: modifySim
      x-si-permissions:
        - UPDATE_INVENTORY
      security:
        - bearerAuth: []
      requestBody:
        description: Request to modify a product with option(s)
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RentalModifyRequest'
            examples:
              SmartBar:
                value:
                  rentalProductInventoryId: 1
                  options:
                    TSL_SMART_BAR: 'On'
              RemoveSmartBar:
                value:
                  rentalProductInventoryId: 1
                  options:
                    TSL_SMART_BAR: 'Off'
              InternationalBar:
                value:
                  rentalProductInventoryId: 1
                  options:
                    OFFER_UK_PAYM_RTCP_INTERNATIONAL: TSL_INTERNATIONAL_BARRING
              RemoveInternationalBar:
                value:
                  rentalProductInventoryId: 1
                  options:
                    OFFER_UK_PAYM_RTCP_INTERNATIONAL: TSL_INTERNATIONAL_EU_ONLY
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProvisioningResponse'
        '400':
          description: Bad Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
  /sim-subscription-request:
    post:
      tags:
        - provisioning
      summary: Subscribe a feature or event
      description: Subscribe a feature or event to a data bundle or add-on respectively
      operationId: subscribeSim
      x-si-permissions:
        - UPDATE_INVENTORY
      security:
        - bearerAuth: []
      requestBody:
        description: Request to subscribe a FEATURE or EVENT rental product inventory
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RentalProvisioningRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProvisioningResponse'
        '400':
          description: Bad Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
  /port-in-number-request:
    post:
      tags:
        - provisioning
      summary: Port-in for an active subscription
      description: >-
        Port-in of a provided MSISDN on a given porting date for an already
        active subscription
      operationId: portInNumber
      x-si-permissions:
        - UPDATE_INVENTORY
      security:
        - bearerAuth: []
      requestBody:
        description: Request to port in a number
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PortInNumberRequest'
            examples:
              PortInNumberRequest:
                value:
                  rentalProductInventoryId: 1
                  portingRequest:
                    portingPacCode: ABC123456
                    requestedPortingDate: '2023-10-12'
                    portingNumber: '07123456789'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProvisioningResponse'
              example:
                rentalProductInventoryId: 1
                provisioningStatus: SUCCESS
                transactionId: 5e6e9753-977a-4f0a-97fe-10371007e2d2
        '400':
          description: Invalid Request
          content:
            application/json:
              example:
                status: 400
                error: Bad Request
                message: Porting date is in the past
                code: portingRequest.requestedPortingDate
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
components:
  schemas:
    ActivateSimRequest:
      type: object
      required:
        - rentalProductInventoryId
      properties:
        rentalProductInventoryId:
          description: Rental product inventory identifier
          type: integer
          format: int64
          x-si-validation: '@ValidId'
          example: 1
        portingRequest:
          $ref: '#/components/schemas/PortingRequest'
    PortInNumberRequest:
      type: object
      required:
        - rentalProductInventoryId
      properties:
        rentalProductInventoryId:
          description: Rental product inventory identifier
          type: integer
          format: int64
          x-si-validation: '@ValidId'
          example: 1
        portingRequest:
          $ref: '#/components/schemas/PortingRequest'
    PortingRequest:
      type: object
      required:
        - portingPacCode
        - requestedPortingDate
        - portingNumber
      properties:
        portingPacCode:
          description: Porting PAC code
          type: string
          minLength: 1
          maxLength: 255
          pattern: '[\w\p{L}\s%£@&#='':;`’,|!_—–\(\)\\/\-\+\.\?\*\$]*'
        requestedPortingDate:
          description: Requested porting date
          type: string
          format: date
        portingNumber:
          description: MSISDN to be ported
          type: string
          minLength: 8
          maxLength: 16
          pattern: '[0-9]{8,16}'
    RentalProvisioningRequest:
      type: object
      required:
        - rentalProductInventoryId
      properties:
        rentalProductInventoryId:
          description: Rental product inventory identifier
          type: integer
          format: int64
          x-si-validation: '@ValidId'
          example: 1
    Option:
      type: object
      additionalProperties:
        type: string
        description: >-
          A list of requested modify options in key/value format, i.e. "{
          "NAME":"VALUE" }"
        example: TSL_INTERNATIONAL_BARRING
    RentalModifyRequest:
      type: object
      required:
        - rentalProductInventoryId
        - options
      properties:
        rentalProductInventoryId:
          description: Rental product inventory identifier
          type: integer
          format: int64
          x-si-validation: '@ValidId'
          example: 1
        options:
          $ref: '#/components/schemas/Option'
    ProvisioningResponse:
      required:
        - rentalProductInventoryId
        - provisioningStatus
      type: object
      properties:
        rentalProductInventoryId:
          description: Rental product inventory identifier
          type: integer
          readOnly: true
          format: int64
          example: 1
        provisioningStatus:
          $ref: '#/components/schemas/ProvisioningStatus'
        failureReason:
          description: Failure Reason
          type: string
          minLength: 0
          maxLength: 255
          pattern: '[\w\p{L}\s%£@&#='':;`’,|!_—–\(\)\\/\-\+\.\?\*\$]*'
        transactionId:
          description: Provisioning transaction id
          type: string
          minLength: 0
          maxLength: 255
          pattern: '[\w\p{L}\s%£@&#='':;`’,|!_—–\(\)\\/\-\+\.\?\*\$]*'
    ProvisioningStatus:
      description: Indicates the current status of the provisioned rental product inventory
      type: string
      enum:
        - INACTIVE
        - ACTIVE
        - ACTIVE_BUT_PORTING
        - SUSPENDED
        - PENDING
        - PENDING_EXTENDED
        - SUCCESS
        - ERROR
        - TERMINATED
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
