openapi: 3.1.0
info:
  title: Cancel consumer offer
  version: 1.0.0
  description: '# Overview

    Use this operation to cancel a consumer offer.'
servers:
- url: https://resale.api.sandbox.bango.com
  description: Integration test environment
- url: https://resale.api.bango.com
  description: Production environment
security:
- basic: []
tags:
- name: Consumer Offers
  description: Manage the lifecycle of your consumer offers
paths:
  /consumerOffers/{consumerOfferId}/cancelation:
    post:
      tags:
      - Consumer Offers
      summary: Cancel Consumer Offer
      description: Cancel a consumer offer and all underlying entitlements.
      operationId: Cancel_consumer_offer_consumerOffers__consumerOfferId__cancelation_post
      parameters:
      - name: consumerOfferId
        in: path
        required: true
        schema:
          type: string
          format: uuid
          description: Identifier of the consumer offer
          title: Consumerofferid
        description: Identifier of the consumer offer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConsumerOfferCancelation'
            examples:
              End of term cancelation:
                value:
                  cancelationType: END_OF_TERM
                  reasonCode: SUBSCRIPTION_CANCELED
                  reasonDescription: Customer has cancelled the subscription
              Immediate cancelation:
                value:
                  cancelationType: IMMEDIATE
                  reasonCode: ACCOUNT_TERMINATED
                  reasonDescription: Customer has closed their account with the reseller
      responses:
        '202':
          description: Accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConsumerOfferReadForCancel'
              examples:
                Accepted:
                  value:
                    consumerOffer:
                      consumerOfferId: 338d31e1-a289-40dd-beff-ab41c1fc5f51
                      offerId: 7560fca0-d8a9-4124-a172-924debec874e
                    consumer:
                      consumerIdentifier: RFBNZ2MU3Y35OA5GNNNGETK6JTEVRYVB
                    status: FULLY_ACTIVE
                    subStatus: PENDING_CANCELS
                    timeline:
                      plannedCancelationTs: '2025-12-21T00:00:00Z'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                Bad Request:
                  value:
                    message: Bad Request
                    statusCode: 400

        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                Not Found:
                  value:
                    message: Not found
                    statusCode: 404
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                Conflict:
                  value:
                    message: Conflict
                    statusCode: 409
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                Internal Server Error:
                  value:
                    message: Internal Server Error
                    statusCode: 500
components:
  schemas:
    ActionSchedule:
      type: string
      enum:
      - END_OF_TERM
      - IMMEDIATE
      title: ActionSchedule
      description: Scheduling type for an action.
    CancelationReasonCode:
      type: string
      enum:
      - NOT_RENEWED
      - CHANGED_SERVICE
      - SUBSCRIPTION_CANCELED
      - ADDON_CANCELED
      - EXPIRED
      - ACCOUNT_TERMINATED
      - SUSPEND_TERMINATED
      - ERROR
      - FRAUD
      - IMMEDIATE_CANCELATION
      - CUSTOMER_CANCELED
      - OTHER
      title: CancelationReasonCode
      description: Reason code for the cancelation.
    CommunicationInformation:
      properties:
        emailAddress:
          type: string
          title: Emailaddress
          description: An email address that can be used to contact the consumer.
        msisdn:
          type: string
          title: Msisdn
          description: A mobile phone number that can be used to contact the consumer, with international prefix
      type: object
      title: CommunicationInformation
      description: Communication channel with the consumer.
    Consumer:
      properties:
        consumerIdentifier:
          type: string
          maxLength: 400
          title: Consumeridentifier
          description: Consumer identifier
        billingIdentifier:
          type: string
          title: Billingidentifier
          description: Billing identifier
        communicationInformation:
          $ref: '#/components/schemas/CommunicationInformation'
          title: Communicationinformation
          description: Communication channel with the consumer. May be used to send reminders or important information.
      type: object
      required:
      - consumerIdentifier
      title: Consumer
      description: Consumer.
    ConsumerOfferCancelation:
      properties:
        cancelationType:
          required: true
          $ref: '#/components/schemas/ActionSchedule'
          description: 'Cancelation type


            * `END_OF_TERM`: consumer retains access to the service until the end of the current term

            * `IMMEDIATE`: consumer immediately loses access to the service

            '
          default: IMMEDIATE
        reasonCode:
          required: true
          $ref: '#/components/schemas/CancelationReasonCode'
          title: Reasoncode
          description: 'Cancelation reason


            * `NOT_RENEWED`: Customer has not renewed their entitlement

            * `CHANGED_SERVICE`: Customer has changed content provider/service

            * `SUBSCRIPTION_CANCELED`: Customer has canceled the subscription

            * `ADDON_CANCELED`: Customer has canceled the add-on

            * `EXPIRED`: Scheduled cancelation by Bango (based on dateExpiry set during entitlement creation by the reseller)

            * `OTHER`: Canceled for any other reason

            * `ACCOUNT_TERMINATED`: Consumer has closed their account with the reseller

            * `SUSPEND_TERMINATED`: Suspended entitlement has been canceled based on suspension terms

            * `ERROR`: Consumer offer/subscription created by mistake

            * `FRAUD`: Fraud detected or suspected

            * `IMMEDIATE_CANCELATION`: Cancelation for fraud or suspected fraud reasons

            '
        reasonDescription:
          type: string
          maxLength: 500
          title: Reasondescription
          description: Human readable description of the reason for canceling
      type: object
      required:
      - cancelationType
      - reasonCode
      title: ConsumerOfferCancelation
      description: Consumer offer cancelation action.
    ConsumerOfferCancelationDetail:
      properties:
        consumerOfferId:
          type: string
          format: uuid
          title: Consumerofferid
          description: A globally unique and immutable identifier of the Consumer Offer
          examples:
          - 338d31e1-a289-40dd-beff-ab41c1fc5f51
        offerId:
          type: string
          format: uuid
          title: Offer ID
          description: A globally unique and immutable identifier of the offer the consumer has subcribed to.
          examples:
          - 7560fca0-d8a9-4124-a172-924debec874e
        consumer:
          $ref: '#/components/schemas/Consumer'
          description: Consumer data.
        status:
          $ref: '#/components/schemas/ConsumerOfferStatus'
          description: 'Consumer offer status:


            * `REQUESTED`: creation of the consumer offer was requested

            * `PARTIALLY_CREATED`: some entitlement were created, but others failed

            * `FULLY_CREATED`: all entitlements have been created

            * `CREATES_FAILED`: all entitlements failed to be created

            * `FULLY_ACTIVE`: all entitlements are active

            * `FULLY_TERMINATED`: all entitlements have been terminated

            * `PARTIALLY_TERMINATED`: some entitlement terminated succesfully, some terminations failed

            '
        subStatus:
          $ref: '#/components/schemas/ConsumerOfferSubStatus'
          title: Substatus
          description: 'Consumer offer sub-status:


            * `PENDING_CREATES`: entitlement creation is pending

            * `PENDING_ACTIVATES`: entitlement activation is pending

            * `PENDING_TERMINATES`: entitlement termination is pending

            * `PENDING_CANCELS`: entitlement cancelation is pending

            '
        timeline:
          $ref: '#/components/schemas/ConsumerOfferCancelationTimeline'
          description: Timeline of changes made to the consumer offer
      type: object
      required:
      - consumerOfferId
      - offerId
      - consumer
      - status
      - timeline
      title: ConsumerOfferCancelationDetail
      description: Consumer offer detail.
    ConsumerOfferCancelationTimeline:
      properties:
        plannedCancelationTs:
          type: string
          format: date-time
          title: Plannedcancelationts
          description: Scheduled date and time for cancel
      type: object
      required:
      - plannedCancelationTs
      title: ConsumerOfferCancelationTimeline
      description: Consumer Offer timeline.
    ConsumerOfferReadForCancel:
      properties:
        consumerOffer:
          $ref: '#/components/schemas/ConsumerOfferCancelationDetail'
          description: Consumer offer detail
      type: object
      required:
      - consumerOffer
      title: ConsumerOfferReadForCancel
      description: Consumer offer in a get response.
    ConsumerOfferStatus:
      type: string
      enum:
      - REQUESTED
      - PARTIALLY_CREATED
      - FULLY_CREATED
      - CREATES_FAILED
      - FULLY_ACTIVE
      - FULLY_TERMINATED
      - PARTIALLY_TERMINATED
      title: ConsumerOfferStatus
      description: Consumer offer status.
    ConsumerOfferSubStatus:
      type: string
      enum:
      - PENDING_CREATES
      - PENDING_ACTIVATES
      - PENDING_TERMINATES
      - PENDING_CANCELS
      title: ConsumerOfferSubStatus
      description: Consumer Offer sub-status.
    ErrorResponse:
      properties:
        statusCode:
          type: integer
          title: Statuscode
          description: HTTP Status Code
        message:
          type: string
          title: Message
          description: Description of the error
      type: object
      title: ErrorResponse
      description: Error response for Consumer Offer API.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
            - type: string
            - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
      - loc
      - msg
      - type
      title: ValidationError
  securitySchemes:
    basic:
      type: http
      scheme: basic