openapi: 3.0.3
info:
  version: 2.2.0
  title: Subscription Search API
  description: >
    API used to search the subscription inventory for IoT subscriptions and their related resources, such as eUICCs, profiles, and connectivity subscriptions.
    The API supports filtering, sorting, and pagination of results.
  contact:
    name: Telenor Connexion Support
    email: it-operations@telenorconnexion.com
    url: 'www.telenorconnexion.com'
servers:
  - url: https://api.iot.telenor.com

x-amazon-apigateway-request-validators:
  none:
    validateRequestBody: false
    validateRequestParameters: false
x-amazon-apigateway-request-validator: none

x-amazon-apigateway-gateway-responses:
  DEFAULT_4XX:
    responseParameters: &base-gateway-response
      gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
      gatewayresponse.header.Access-Control-Allow-Headers: "'Authorization,Content-Type,Content-Language,Accept,Accept-Language,Origin,X-Requested-With,X-Amz-Date,X-Api-Key,X-Amz-Security-Token,Cache-Control'"
      gatewayresponse.header.Access-Control-Allow-Methods: "'GET,HEAD,POST,PUT,DELETE,CONNECT,OPTIONS,TRACE,PATCH'"
  DEFAULT_5XX:
    responseParameters: *base-gateway-response
  UNAUTHORIZED:
    responseParameters: *base-gateway-response
    responseTemplates: 
      "application/json": |
        {
          "message": "Unauthorized. The Authorization token in the header is not valid. Please renew the token and try again."
        }

x-amazon-apigateway-api-key-source: HEADER

tags:
  - name: Search API
    description: Resources for query search data.
  - name: Health
    description: Service health check

paths:
  /iot-connect/subscription-inventory/v1/search:
    post:
      deprecated: true
      x-amazon-apigateway-integration: &aws-gateway
        uri:
          Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${PublicInventoryFunc.Arn}:current/invocations
        passthroughBehavior: when_no_match
        httpMethod: POST
        type: aws_proxy
      security: &aws-authorizer
        - TokenAuthorizer: []
      tags:
        - Search API
      summary: Fetch search data (v1)
      description: Fetch filtered search data result.
      operationId: postSearch
      requestBody:
        description: Describes requested filter options and search text.
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/searchRequestBody'
      responses:
        200:
          $ref: '#/components/responses/searchResponse200'
        400:
          $ref: '#/components/responses/badRequest'
        401:
          $ref: '#/components/responses/unauthorized'
        403:
          $ref: '#/components/responses/forbidden'
        404:
          $ref: '#/components/responses/notFound'
        500:
          $ref: '#/components/responses/internalServerError'

  /iot-connect/subscription-inventory/v2/search:
    post:
      x-amazon-apigateway-integration: *aws-gateway
      security: *aws-authorizer
      tags:
        - Search API
      summary: Fetch search data (v2)
      description: Fetch filtered search data result.
      operationId: postSearchV2
      requestBody:
        description: Describes requested filter options and search text.
        required: true
        content: 
          application/json:
            schema:
              $ref: '#/components/schemas/searchRequestBodyV2'
      responses:
        200:
          $ref: '#/components/responses/searchResponse200V2'
        400:
          $ref: '#/components/responses/badRequest'
        401:
          $ref: '#/components/responses/unauthorized'
        403:
          $ref: '#/components/responses/forbidden'
        404:
          $ref: '#/components/responses/notFound'
        500:
          $ref: '#/components/responses/internalServerError'

  /{proxy+}:
    options:
      tags:
        - CORS
      summary: Handle CORS OPTIONS requests
      description: Used for returning CORS headers for OPTIONS requests.
      parameters:
        - $ref: '#/components/parameters/proxyInPath'
      responses:
        200:
          description: CORS response
      x-amazon-apigateway-integration: *aws-gateway
 
components:
  responses:
    searchResponse200:
      description: Returns up to 100 IoT subscriptions.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/responseSchema'

    searchResponse200V2:
      description: Returns up to 10k IoT subscriptions.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/responseSchemaV2'

    badRequest: # 400
      description: BadRequest
      headers: &response-cors-headers
        Access-Control-Allow-Origin:
          schema:
            type: string
        Access-Control-Allow-Methods:
          schema:
            type: string
        Access-Control-Allow-Headers:
          schema:
            type: string
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error'

    notFound: # 404
      description: The specified resource was not found
      headers: *response-cors-headers
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error'

    unauthorized: # 401
      description: Unauthorized. Your token is not valid.
      headers: *response-cors-headers
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error'
    
    forbidden: # 403
      description: Forbidden. You are not allowed to access the requested resource.
      headers: *response-cors-headers
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error'

    internalServerError: # 500
      description: Internal Server Error
      headers: *response-cors-headers
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error'
  
  schemas:
    responseSchema:
      type: object
      description: GET response schemas.
      additionalProperties: false
      properties:
        pagination:
          type: object
          properties:
            totalHits:
              type: integer
              description: Total number of hits with these filter options. Maximum 10000 hits can be counted, so there are at least 10000 hits or more at that point.
              example: 100
              maximum: 10000
              minimum: 0
            next:
              type: integer
              description: Used for pagination based on `limit` and `after` parameter in request. Shows what `after` parameter should be set to get next items.
              example: 10
            previous:
              type: integer
              description: Used for pagination based on `limit` and `after` parameter in request. Shows what `after` parameter should be set to get previous items. 
              example: 0
        items:
          type: array
          description: Items array containing filtered requested data.
          items:
            $ref: '#/components/schemas/responseItemsSchema'
        filterMatches:
          type: object
          description: Matched fields and hits from filter search. This is only visible if `includeFilterMatches` is set to true in request.
          example: 
            iotSubscription.iotSubscriptionId: [
              {
                value: '9746U5LX6B24P3AZ8X',
                hits: 1
              }
            ]
          additionalProperties:
            type: array
            description: Array as field name containing objects with matched values and hits. Returns empty array if no value was matched.
            items: 
              $ref: '#/components/schemas/filterMatchSchema'         

    responseSchemaV2:
      type: object
      description: GET response schemas.
      additionalProperties: false
      properties:
        pagination:
          type: object
          properties:
            totalHits:
              type: integer
              description: Total number of hits with these filter options.
              example: 150569
              minimum: 0
            next:
              type: string
              description: Used for pagination based on `limit` and `after` parameter in request. Shows what `after` parameter should be set to get next items.
              example: "eyJwaXRJZCI6Ijg4al9RQUZMYVc5MExXTnZibTVsWTNRdFpHVjJaV3h2Y0cxbGJuUXRhVzUyWlc1MGIzSjVMWEJ2Y0hWc1lYUnBiMjVmYVc1MlpXNTBiM0o1TFhObFlYSmphQzFoY0drdFltRmpheTEwWlhOMEZtUk9hbE5MVGkwMFVVVkxjRzlxZEhsbmRtRjRSbEVBRm05VVMxcFNXRFJrVVVsUFYyNUNYM3B0V2swMFpYY0FBQUFBQUFBQUFIQVdkemxvVWtoR01YRlVVbWxhUTIwMFZsSkNibE4zWndFV1pFNXFVMHRPTFRSUlJVdHdiMnAwZVdkMllYaEdVUUFBIiwic2VhcmNoQWZ0ZXIiOlsiOTcyNXNoOXNmaHVlYjNhdm44Il19"
        items:
          type: array
          description: Items array containing filtered requested data.
          items:
            $ref: '#/components/schemas/responseItemsSchema'
        filterMatches:
          type: object
          description: Matched fields and hits from filter search. This is only visible if `includeFilterMatches` is set to true in request.
          example:
            iotSubscription.iotSubscriptionId: [
              {
                value: '9746U5LX6B24P3AZ8X',
                hits: 1
              }
            ]
          additionalProperties:
            type: array
            description: Array as field name containing objects with matched values and hits. Returns empty array if no value was matched.
            items:
              $ref: '#/components/schemas/filterMatchSchema'


    responseItemsSchema:
      type: object
      description: Requested inventory data.
      properties:
        iotSubscription:
          type: object
          description: Properties for an IoT Subscription. The IoT Subscription is the resource which contains other resources, such as eUICCs and profiles.
          properties:
            iotSubscriptionId:
                $ref: '#/components/schemas/iotSubscriptionId'
            domainId:
                $ref: '#/components/schemas/domainId'
            subscriptionType:
              type: string
              enum: [IOT_CONNECT]
            inServiceDate:
              type: string
              format: date
              description: Specifies when the IoT subscription was provisioned.
            metadata:
              type: object
            lastModifiedAt:
              type: string
              format: date-time
            simSoldBy:
              type: string
              enum: [SIM_NOT_ASSIGNED, TELENOR_IOT, EXTERNAL]
              description: Indicates by whom the SIM card is sold.
        connectivitySubscriptions:
          type: array
          description: All connectivity subscriptions belonging to this IoT subscription.
          items:
            type: object
            description: Properties for connectivity subscription.
            properties:
              imsi:
                $ref: '#/components/schemas/imsi'
              iccid:
                $ref: '#/components/schemas/iccid'
              msisdn:
                $ref: '#/components/schemas/msisdn'
              servicePolicyId:
                $ref: '#/components/schemas/servicePolicyId'
              mode:
                type: string
                enum: [ACTIVE, ACTIVE_NO_BILLING, DEACTIVATED, PAUSED, TERMINATED]
                description: The mode of the connectivity subscription.
              firstActivationDate:
                type: string
                format: date-time
                description: Date and time when the connectivity subscription was first set to ACTIVE mode in the underlying Connectivity Management Platform (CMP).
                nullable: true
              trmExitedAt:
                type: string
                format: date-time
                nullable: true
                description: Date and time when the connectivity subscription exited Test Ready Mode (TRM). Null value means that TRM has not been exited. This can mean that the connectivity subscription is still in TRM but it will also be null if the connectivity has never been in TRM. This means that this value cannot be used to determine whether a connectivity subscription is in TRM, only if it has exited TRM.
        euiccs:
          type: array
          description: An eUICC always belongs to one IoT subscription. The eUICC can have one or more profiles and connectivity subscriptions.
          items:
            type: object
            properties:
              eid:
                $ref: '#/components/schemas/eid'
              enabledProfile:
                $ref: '#/components/schemas/enabledProfile'
              bootstrapProfile:
                $ref: '#/components/schemas/bootstrapProfile'
              eim: 
                type: string
                enum: [EXTERNAL, TELENOR_IOT]
                description: The electronic international mobile subscriber identity.
        profiles:
          type: array
          description: All profiles belonging to this IoT subscription.
          items:
            type: object
            properties:
              iccid:
                $ref: '#/components/schemas/iccid'
              profileType:
                type: string
                description: Specifies the type of profile. `SIM_PROFILE` means the profile resides on a UICC. For values starting with `VIRTUAL_PROFILE` the profile resides on an eUICC. Value `VIRTUAL_PROFILE` means the profile is of type SGP.02.
                enum: [SIM_PROFILE, VIRTUAL_PROFILE, VIRTUAL_PROFILE_SGP_22, VIRTUAL_PROFILE_SGP_32]
              isEnabled:
                type: boolean
                description: True if this is the currently enabled profile on an eUICC or if this a UICC. False if this is a disabled profile on an eUICC.
              cmp:
                type: string
                description: The profile's CMP (Connectivity Management Platform) determines which underlying connectivity platform the profile belongs to and determines what kind of data is available for the profile and its connectivity subscription.
                enum: [IOTA_EU, DATORA_BR]
              connectivityProfile:
                type: object
                properties:
                  id:
                    type: string
                    example: GLOBAL_SUBSCRIPTION
                  name:
                    type: string
                    example: Global subscription
              simProfileId:
                type: string
                description: The SIM profile indentifier.
                example: 1002        
        servicePolicies:
          type: array
          description: Array of objects containing service policy properties.
          items:
            type: object
            properties:
              id:
                $ref: '#/components/schemas/servicePolicyId'
              name:
                type: string
                description: Name of the service policy.
                maxLength: 256
                example: 5MB Europe
              type:
                type: string
                description: Specifies the underlying service policy type in the Connectivity Management Platform (CMP).
                enum: [IOTA_SERVICE_POLICY, ARQIA_SERVICE_POLICY]
              cmpServicePolicyId:
                type: string
                description: Specifies the underlying service policy id in the Connectivity Management Platform (CMP).

    searchRequestBody:
      type: object
      additionalProperties: false
      properties:
        limit:
          $ref: '#/components/schemas/limit'
        after:
          $ref: '#/components/schemas/after'
        includeFilterMatches:
          type: boolean
          description: Shows which fields matched with which search values. This is listed in `matches` in response body. Defaults to false if not specified.
        sortBy:
          $ref: '#/components/schemas/sortSchema'
        returnFields:
          $ref: '#/components/schemas/returnFields'
        filters:
          type: array
          description: It is possible to add any number of filters. All filter objects are joined by AND relationships to each other.
          items:
            anyOf:
            - $ref: '#/components/schemas/filtersEqual'
            - $ref: '#/components/schemas/filtersNotEqual'
            - $ref: '#/components/schemas/filtersStartsWith'
            - $ref: '#/components/schemas/filtersEndsWith'
            - $ref: '#/components/schemas/filtersBetween'
            - $ref: '#/components/schemas/filtersContains'

    searchRequestBodyV2:
      type: object
      additionalProperties: false
      properties:
        limit:
          $ref: '#/components/schemas/limitV2'
        after:
          $ref: '#/components/schemas/afterString'
        includeFilterMatches:
          type: boolean
          description: Shows which fields matched with which search values. This is listed in `matches` in response body. Defaults to false if not specified.
        sortBy:
          $ref: '#/components/schemas/sortSchema'
        returnFields:
          $ref: '#/components/schemas/returnFields'
        filters:
          type: array
          description: It is possible to add any number of filters. All filter objects are joined by AND relationships to each other.
          items:
            anyOf:
            - $ref: '#/components/schemas/filtersV2Equals'
            - $ref: '#/components/schemas/filtersV2NotEquals'
            - $ref: '#/components/schemas/filtersStartsWith'
            - $ref: '#/components/schemas/filtersEndsWith'
            - $ref: '#/components/schemas/filtersBetween'
            - $ref: '#/components/schemas/filtersContains'

    filterMatchSchema:
      type: object
      description: Object containing matched value and number of hits.
      additionalProperties: false
      properties:
        value:
          type: string
          example: 'ACTIVE'
        hits:
          type: integer
          example: 10

    filtersEqual:
        type: object
        description: Filter on exact match.
        additionalProperties: false
        required:
          - fields
          - type
          - values
        properties:
          fields:
            minItems: 1
            type: array
            items:
              anyOf:
              - $ref: '#/components/schemas/fieldEnum'
              - $ref: '#/components/schemas/iotSubscriptionMetadataRegex'
            example: ['iotSubscription.iotSubscriptionId']
          type:
            type: string
            enum: [equal]
          values:
            type: array
            items:
              type: string
              example: 9746U5LX6B24P3AZ8X
      
    filtersNotEqual:
      type: object
      description: Filter out all requested values.
      additionalProperties: false
      required:
        - fields
        - type
        - values
      properties:
        fields:
          minItems: 1
          type: array
          items:
            anyOf:
            - $ref: '#/components/schemas/fieldEnum'
            - $ref: '#/components/schemas/iotSubscriptionMetadataRegex'
          example: ['iotSubscription.iotSubscriptionId']
        type:
          type: string
          enum: [notEqual]
        values:
          type: array
          items:
            type: string
            example: 8546U5LX6B24P3AZ8X

    filtersV2Equals:
        type: object
        description: Filter on exact match.
        additionalProperties: false
        required:
          - fields
          - type
          - values
        properties:
          fields:
            minItems: 1
            type: array
            items:
              anyOf:
              - $ref: '#/components/schemas/fieldEnum'
              - $ref: '#/components/schemas/iotSubscriptionMetadataRegex'
            example: ['iotSubscription.iotSubscriptionId']
          type:
            type: string
            enum: [equals]
          values:
            type: array
            items:
              type: string
              example: 9746U5LX6B24P3AZ8X

    filtersV2NotEquals:
      type: object
      description: Filter out all requested values.
      additionalProperties: false
      required:
        - fields
        - type
        - values
      properties:
        fields:
          minItems: 1
          type: array
          items:
            anyOf:
            - $ref: '#/components/schemas/fieldEnum'
            - $ref: '#/components/schemas/iotSubscriptionMetadataRegex'
          example: ['iotSubscription.iotSubscriptionId']
        type:
          type: string
          enum: [notEquals]
        values:
          type: array
          items:
            type: string
            example: 8546U5LX6B24P3AZ8X

    filtersStartsWith:
      type: object
      description: Wildcard search with wildcard after value.
      additionalProperties: false
      required:
        - fields
        - type
        - values
      properties:
        fields:
          minItems: 1
          type: array
          items:
            anyOf:
            - $ref: '#/components/schemas/fieldEnum'
            - $ref: '#/components/schemas/iotSubscriptionMetadataRegex'
          example: ['iotSubscription.iotSubscriptionId']
        type:
          type: string
          enum: [startsWith]
        values:
          type: array
          items:
            $ref: '#/components/schemas/iotSubscriptionIdStartsWith'
          
    filtersEndsWith:
      type: object
      description: Wildcard search with wildcard before value.
      additionalProperties: false
      required:
        - fields
        - type
        - values
      properties:
        fields:
          minItems: 1
          type: array
          items:
            anyOf:
            - $ref: '#/components/schemas/fieldEnum'
            - $ref: '#/components/schemas/iotSubscriptionMetadataRegex'
          example: ['iotSubscription.iotSubscriptionId']
        type:
          type: string
          enum: [endsWith]
        values:
          type: array
          items:
            $ref: '#/components/schemas/iotSubscriptionIdEndsWith'
    
    filtersBetween:
      type: object
      description: Match numbers between min and max span.
      additionalProperties: false
      required:
        - fields
        - type
        - values
      properties:
        fields:
          minItems: 1
          type: array
          items:
            anyOf:
            - $ref: '#/components/schemas/fieldEnum'
            - $ref: '#/components/schemas/iotSubscriptionMetadataRegex'
          example: ['iotSubscription.lastModifiedAt']
        type:
          type: string
          enum: [between]
        values:
          type: object
          properties:
            min:
              $ref: '#/components/schemas/betweenMin'
            max:
              $ref: '#/components/schemas/betweenMax'
          
    filtersContains:
      type: object
      description: Wildcard search with wildcard before and after value. Can be used for suggestions.
      additionalProperties: false
      required:
        - fields
        - type
        - values
      properties:
        fields:
          minItems: 1
          type: array
          items:
            anyOf:
            - $ref: '#/components/schemas/fieldEnum'
            - $ref: '#/components/schemas/iotSubscriptionMetadataRegex'
          example: ['iotSubscription.iotSubscriptionId']
        type:
          type: string
          enum: [contains]
        values:
          type: array
          items:
            type: string
            description: Part of string that should be matched.
            example: U5LX6B24P

    servicePolicyId:
      type: string
      description: Identifies the service policy.
      pattern: '^22[A-HJ-NP-Z2-9]{6}$'
      example: 22B8BC22

    iotSubscriptionId:
      type: string
      description: IoT Subscription ID.
      pattern: "^97[23456789ABCDEFGHJKLMNPQRSTUVWXYZ]{16}$"
      example: 9746U5LX6B24P3AZ8X
    
    iotSubscriptionIdStartsWith:
      type: string
      description: IoT Subscription ID with wildcard at the end.
      example: 9746U5LX

    iotSubscriptionIdEndsWith:
      type: string
      description: IoT Subscription ID with wildcard at the start.
      example: 24P3AZ8X

    betweenMin:
      type: string
      description: Lower bound eg. the earliest date or the start of an IMSI range.
      example: 2025-01-01T00:00:00.000Z
    betweenMax:
      type: string
      description: Upper bound eg. the latest date or the end of an IMSI range.
      example: 2025-01-31T23:59:59.000Z

    limit:
      type: integer
      description: Number of documents to return, up to 100 is allowed.
      example: 10
      minimum: 1
      maximum: 100

    limitV2:
      type: integer
      description: Number of documents to return, up to 10 000 is allowed.
      example: 10000
      minimum: 1
      maximum: 10000
      
    after:
      type: integer
      description: Cursor pagination. Values of `next` and `previous` in response body shows which values to enter here.
      example: 10
      minimum: 0

    afterString:
      type: string
      description: Token for pagination
      example: "eyJwaXRJZCI6Ijg4al9RQUZMYVc5MExXTnZibTVsWTNRdFpHVjJaV3h2Y0cxbGJuUXRhVzUyWlc1MGIzSjVMWEJ2Y0hWc1lYUnBiMjVmYVc1MlpXNTBiM0o1TFhObFlYSmphQzFoY0drdFltRmpheTEwWlhOMEZtUk9hbE5MVGkwMFVVVkxjRzlxZEhsbmRtRjRSbEVBRm05VVMxcFNXRFJrVVVsUFYyNUNYM3B0V2swMFpYY0FBQUFBQUFBQUFIQVdkemxvVWtoR01YRlVVbWxhUTIwMFZsSkNibE4zWndFV1pFNXFVMHRPTFRSUlJVdHdiMnAwZVdkMllYaEdVUUFBIiwic2VhcmNoQWZ0ZXIiOlsiOTcyM2w4N2FiZnc4eHY1cG1oIl19"

    sortSchema:
      description: Sort array containing direction and field. Sort order is done following the order in the array, i.e. the first object in the array will be sorted first.
      type: array
      items:
        type: object
        additionalProperties: false
        required:
        - direction
        - field
        properties:
          direction:
            $ref: '#/components/schemas/sortDirectionEnum'
          field:
            anyOf:
            - $ref: '#/components/schemas/fieldEnum'
            - $ref: '#/components/schemas/iotSubscriptionMetadataRegex'

    returnFields:
      description: Fields in document that should be returned. If not specified entire document will be returned.
      type: array
      items:
        anyOf:
        - $ref: '#/components/schemas/returnFieldEnum'
        - $ref: '#/components/schemas/namespaceEnum'
        - $ref: '#/components/schemas/iotSubscriptionMetadataRegex'
      example: [
        iotSubscription.iotSubscriptionId,
        connectivitySubscriptions,
        connectivitySubscriptions.servicePolicyId
      ]

    sortDirectionEnum:
      type: string
      description: All available sort directions. 
      enum: [asc, desc, ascending, descending]

    fieldEnum:
      type: string
      description: All available searchable fields. 
      enum:
        - iotSubscription.iotSubscriptionId
        - iotSubscription.subscriptionType
        - iotSubscription.domainId
        - iotSubscription.inServiceDate
        - iotSubscription.lastModifiedAt
        - iotSubscription.simSoldBy
        - euiccs.eid
        - euiccs.enabledProfile
        - euiccs.bootstrapProfile
        - euiccs.eim
        - profiles.iccid
        - profiles.servicePolicyId
        - profiles.profileType
        - profiles.cmp
        - profiles.isEnabled
        - profiles.connectivityProfile.id
        - profiles.connectivityProfile.name
        - profiles.simProfileId
        - servicePolicies.id
        - servicePolicies.name
        - servicePolicies.type
        - connectivitySubscriptions.imsi
        - connectivitySubscriptions.iccid
        - connectivitySubscriptions.msisdn
        - connectivitySubscriptions.mode
        - connectivitySubscriptions.firstActivationDate
        - connectivitySubscriptions.trmExitedAt
        - connectivitySubscriptions.servicePolicyId
        - enabledProfile.imsi
        - enabledProfile.iccid
        - enabledProfile.msisdn
        - enabledProfile.mode
        - enabledProfile.firstActivationDate
        - enabledProfile.trmExitedAt
        - enabledProfile.profileType
        - enabledProfile.cmp
        - enabledProfile.connectivityProfile.id
        - enabledProfile.connectivityProfile.name
        - enabledProfile.servicePolicyId
        - enabledProfile.simProfileId

    returnFieldEnum:
      type: string
      description: Fields that can be part of the response. 
      enum:
        - iotSubscription.iotSubscriptionId
        - iotSubscription.subscriptionType
        - iotSubscription.domainId
        - iotSubscription.inServiceDate
        - iotSubscription.lastModifiedAt
        - iotSubscription.simSoldBy
        - euiccs.eid
        - euiccs.enabledProfile
        - euiccs.bootstrapProfile
        - euiccs.eim
        - profiles.iccid
        - profiles.servicePolicyId
        - profiles.profileType
        - profiles.cmp
        - profiles.isEnabled
        - profiles.connectivityProfile.id
        - profiles.connectivityProfile.name
        - profiles.simProfileId
        - servicePolicies.id
        - servicePolicies.cmpServicePolicyId
        - servicePolicies.name
        - servicePolicies.type
        - connectivitySubscriptions.imsi
        - connectivitySubscriptions.iccid
        - connectivitySubscriptions.msisdn
        - connectivitySubscriptions.mode
        - connectivitySubscriptions.firstActivationDate
        - connectivitySubscriptions.trmExitedAt
        - connectivitySubscriptions.servicePolicyId

    namespaceEnum:
      type: string
      description: All namespaces. 
      enum: 
        - iotSubscription
        - iotSubscription.metadata
        - connectivitySubscriptions
        - servicePolicies
        - euiccs
        - profiles
        - profiles.connectivityProfile
    
    iotSubscriptionMetadataRegex:
      type: string
      description: Iot subscription metadata field with customizable key. 
      maxLength: 50
      pattern: 'iotSubscription\.metadata\.(key|value)'

    domainId:
      type: string
      description: Domain the resource belongs to. Used to determine which users have access to the resource.
      pattern: ^([A-Za-z0-9]{8}-){0,6}[A-Za-z0-9]{8}$
      example: a1ce25s2-c23edcs9

    imsi:
      type: string
      description: International Mobile Subscriber Identity. Uniquely identifies a subscriber in the mobile network.
      pattern: ^[0-9]{6,15}$
      example: "230000000000001"

    iccid:
      type: string
      description: Integrated Circuit Card ID. Uniquely identifies a UICC (SIM card) or an eUICC profile.
      pattern: ^89[0-9]{16,18}$
      example: "89000000000000000001"

    msisdn:
      type: string
      description: Mobile Station International Subscriber Directory Number. This is equivalent to the phone number, including the country code.
      pattern: ^[0-9]{5,15}$
      example: "46000000001"

    eid:
      type: string
      description: Uniquely identifies an eUICC (eSIM).
      pattern: ^[0-9]{32}$
      example: "89000000000000000000000000000001"

    enabledProfile:
      description: ICCID of the currently enabled profile.
      type: string
      pattern: ^89[0-9]{16,18}$
      example: "89000000000000000001"

    bootstrapProfile:
      description: ICCID of the bootstrap profile, i.e. the profile that was first enabled on this eUICC.
      type: string
      pattern: ^89[0-9]{16,18}$
      example: "89000000000000000001"

    error:
      type: object
      properties:
        name:
          type: string
        message:
          type: string
        errors:
          type: array
          items:
            type: object
            properties:
              message:
                type: string
              errorCode:
                type: string
              path:
                type: string
                description: Optional path, usually used to describe which incoming parameters are not valid.
            required:
              - message
              - errorCode
      required:
        - message

  parameters:
    proxyInPath:
        in: path
        required: true
        name: proxy+
        description: >
          Matches all OPTIONS request for all endpoints and returns CORS headers to allow cross domain requests.
        schema:
          type: string
        
  headers:
    Location:
      description: URL to the created resource.
      schema:
        type: string
        format: url

  securitySchemes:
    TokenAuthorizer:
      type: http
      scheme: bearer
      bearerFormat: JWT