> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bango.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Cancel An Entitlement

> Cancel an entitlement.



## OpenAPI

````yaml /openapi/current/dvm/reseller-to-dvm/entitlement/openapi.json post /v1/entitlement/cancel/{entitlementId}
openapi: 3.1.0
info:
  title: Reseller to DVM - Entitlement
  summary: Current / DVM / Reseller to DVM / Entitlement
  description: Create, get, update and cancel entitlements.
  version: 1.0.0
servers: []
security: []
tags:
  - name: Entitlements
    description: API methods to manage entitlements
paths:
  /v1/entitlement/cancel/{entitlementId}:
    post:
      tags:
        - Entitlements
      summary: Cancel An Entitlement
      description: Cancel an entitlement.
      operationId: Cancel_an_entitlement_v1_entitlement_cancel__entitlementId__post
      parameters:
        - name: entitlementId
          in: path
          required: true
          schema:
            type: string
            format: uuid
            description: The Bango entitlementId generated when the entitlement is created
            title: Entitlementid
          description: The Bango entitlementId generated when the entitlement is created
        - name: X-RequestIdentifier
          in: header
          required: false
          schema:
            anyOf:
              - type: string
                format: uuid
              - type: 'null'
            description: Optional identifier to support idempotency
            title: X-Requestidentifier
          description: Optional identifier to support idempotency
        - name: X-Request-Id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              Unique request id generated by the reseller. Useful for e2e
              trouble-shooting. While listed as an optional header, some content
              providers consider this to be mandatory.
            title: X-Request-Id
          description: >-
            Unique request id generated by the reseller. Useful for e2e
            trouble-shooting. While listed as an optional header, some content
            providers consider this to be mandatory.
        - name: X-Operation-Id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              Reseller-generated unique id per operation. Used by some content
              providers to identify an idempotent retry. While listed as an
              optional header, some content providers consider this to be
              mandatory.
            title: X-Operation-Id
          description: >-
            Reseller-generated unique id per operation. Used by some content
            providers to identify an idempotent retry. While listed as an
            optional header, some content providers consider this to be
            mandatory.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EntitlementTerminate'
            examples:
              Base request:
                value:
                  cancelReasonCategory: CUSTOMER_CANCELLED
                  cancelReasonCode: NOT_RENEWED
                  cancelReasonDescription: The user did not renew their monthly contract
      responses:
        '200':
          description: Entitlement cancelled successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EntitlementRead'
              examples:
                OK:
                  value:
                    entitlementId: a25100b8-4e0c-4e37-b921-cac9cb1e930f
                    customerIdentifier: '4407123456789'
                    sharedCustomerId: 414b3019-0c28-4d14-9c5f-6217b8bd1e3e
                    bangoUserId: '2147483647'
                    productKey: BangoMusic
                    entitlementDisplayName: 30 days Bango music
                    merchantAccountKey: BANGO
                    dateCreated: '2020-06-22T17:35:38.92Z'
                    dateActivated: '2020-06-22T17:35:59.90Z'
                    dateExpiry: '0001-01-01T00:00:00Z'
                    dateEnded: '0001-01-01T00:00:00Z'
                    dateFailed: '0001-01-01T00:00:00Z'
                    responseCode: OK
                    responseMessage: Success
                    status: ACTIVE-ENDING
                    externalEntitlementId: 124130d2-2cbc-45a1-ab9b-dfa8b67a2e63
                    extensionData:
                      additionalProp1: string
                      additionalProp2: string
                      additionalProp3: string
                    extraInformation:
                      communicationInformation:
                        emailAddress: 123@abc.co.uk
                        msisdn: '441234567890'
                      clientDevice:
                        type: STB
                        id: bc449c9e-406f-4399-a3ff-8671a27ac410
                        typeId: P49AJFND8NFN23NANGAJG
                        modelName: STB Model X7
                        modelNumber: IAH45IAOF/5
                        serialNumber: JHFJHA43JNFA9393GFD
                        osType: Linux
                        osVersion: 10.3.8
                        macAddress: 4A-0F-99-F2-D3-DD
                        browser: Firefox
                      source:
                        channelType: Website
                        campaignRef: SUMMER_PROMO
                        referrer: SEARCH_ENGINE
                        bundleId: BundleABC123
                        country: United Kingdom
                        region: East Anglia
                        brand: BrandABC
          headers:
            X-Idempotent-Record:
              description: >-
                Set when the request includes an `X-RequestIdentifier` header.
                `CREATED` for the first request with that identifier. `EXISTS`
                for a repeat, when the stored response is returned. `FAILED`
                when the request was processed but its idempotency record could
                not be read or saved, so a retry with the same identifier may be
                processed again.
              schema:
                type: string
                enum:
                  - CREATED
                  - EXISTS
                  - FAILED
        '202':
          description: Entitlement cancellation request pending
          content:
            application/json:
              examples:
                Accepted:
                  value:
                    entitlementId: a25100b8-4e0c-4e37-b921-cac9cb1e930f
                    customerIdentifier: '4407123456789'
                    sharedCustomerId: 414b3019-0c28-4d14-9c5f-6217b8bd1e3e
                    bangoUserId: '2147483647'
                    productKey: BangoMusic
                    entitlementDisplayName: 30 days Bango music
                    merchantAccountKey: BANGO
                    dateCreated: '2020-06-22T17:35:38.92Z'
                    dateActivated: '0001-01-01T00:00:00Z'
                    dateExpiry: '0001-01-01T00:00:00Z'
                    dateEnded: '0001-01-01T00:00:00Z'
                    dateFailed: '0001-01-01T00:00:00Z'
                    responseCode: ACCEPTED
                    responseMessage: Termination request accepted by merchant.
                    status: ACTIVE
                    externalEntitlementId: 124130d2-2cbc-45a1-ab9b-dfa8b67a2e63
                    extensionData:
                      additionalProp1: string
                      additionalProp2: string
                      additionalProp3: string
                    extraInformation:
                      communicationInformation:
                        emailAddress: 123@abc.co.uk
                        msisdn: '441234567890'
                      clientDevice:
                        type: STB
                        id: bc449c9e-406f-4399-a3ff-8671a27ac410
                        typeId: P49AJFND8NFN23NANGAJG
                        modelName: STB Model X7
                        modelNumber: IAH45IAOF/5
                        serialNumber: JHFJHA43JNFA9393GFD
                        osType: Linux
                        osVersion: 10.3.8
                        macAddress: 4A-0F-99-F2-D3-DD
                        browser: Firefox
                      source:
                        channelType: Website
                        campaignRef: SUMMER_PROMO
                        referrer: SEARCH_ENGINE
                        bundleId: BundleABC123
                        country: United Kingdom
                        region: East Anglia
                        brand: BrandABC
              schema:
                $ref: '#/components/schemas/EntitlementRead'
          headers:
            X-Idempotent-Record:
              description: >-
                Set when the request includes an `X-RequestIdentifier` header.
                `CREATED` for the first request with that identifier. `EXISTS`
                for a repeat, when the stored response is returned. `FAILED`
                when the request was processed but its idempotency record could
                not be read or saved, so a retry with the same identifier may be
                processed again.
              schema:
                type: string
                enum:
                  - CREATED
                  - EXISTS
                  - FAILED
        '400':
          description: Bad request
          content:
            application/json:
              examples:
                Bad request:
                  value:
                    responseCode: BAD_REQUEST
                    responseMessage: Invalid request.
                    metadata:
                      responseMessageFrom: BANGO
                Operation not supported:
                  value:
                    responseCode: OPERATION_NOT_SUPPORTED
                    responseMessage: Operation not supported for entitlement route.
                    metadata:
                      responseMessageFrom: BANGO
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Invalid credentials (no response body returned)
        '403':
          description: No active entitlement route found
          content:
            application/json:
              examples:
                Not available:
                  value:
                    responseCode: NOT_AVAILABLE
                    responseMessage: No active entitlement routes found.
                    metadata:
                      responseMessageFrom: BANGO
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not found
          content:
            application/json:
              examples:
                Not found:
                  value:
                    responseCode: NOT_FOUND
                    responseMessage: Entitlement Not Found
                    metadata:
                      responseMessageFrom: BANGO
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: >-
            Conflict: the state of the entitlement, or an idempotent request in
            progress
          content:
            application/json:
              examples:
                Conflict:
                  value:
                    responseCode: CONFLICT
                    responseMessage: The requested action has been rejected due to a conflict.
                    metadata:
                      responseMessageFrom: BANGO
                Idempotent request in progress:
                  value:
                    responseCode: IDEMPOTENT_REQUEST_IN_PROGRESS
                    responseMessage: Idempotency request in progress. Please try again later.
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          headers:
            X-Idempotent-Record:
              description: >-
                Set to `IN_PROGRESS` when the conflict is caused by an earlier
                request with the same `X-RequestIdentifier` that is still being
                processed.
              schema:
                type: string
                enum:
                  - IN_PROGRESS
        '429':
          description: Too Many Requests
          content:
            application/json:
              examples:
                Too Many Requests:
                  value:
                    responseCode: TOO_MANY_REQUESTS
                    responseMessage: Request limit reached. Please try again later.
                    metadata:
                      responseMessageFrom: BANGO
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              examples:
                Internal server error:
                  value:
                    responseCode: INTERNAL_ERROR
                    metadata:
                      responseMessageFrom: BANGO
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: Service Unavailable
          content:
            application/json:
              examples:
                Service Unavailable:
                  value:
                    responseCode: SERVICE_UNAVAILABLE
                    metadata:
                      responseMessageFrom: BANGO
                Idempotency service unavailable:
                  value:
                    responseCode: SERVICE_UNAVAILABLE
                    responseMessage: >-
                      The server is undergoing maintenance and is not available.
                      Please, try again later.
                    metadata:
                      responseMessageFrom: BANGO
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          headers:
            X-Idempotent-Record:
              description: Set to `FAILED` when the idempotency service is not available.
              schema:
                type: string
                enum:
                  - FAILED
      security:
        - XApiKey: []
        - BasicAuth: []
        - OAuth2: []
components:
  schemas:
    EntitlementTerminate:
      properties:
        cancelReasonCategory:
          type: string
          maxLength: 50
          title: Cancelreasoncategory
          description: >-
            High level category for the type of termination. Free text.
            Suggested values: `CUSTOMER_CANCELLED`, `REVOKED`. If not provided,
            it is set to `NOT_PROVIDED`.
        cancelReasonCode:
          type: string
          maxLength: 50
          title: Cancelreasoncode
          description: >-
            Code representing the entitlement cancel or revoke reason. Free
            text. Suggested values: `NOT_RENEWED`, `CHANGED_SERVICE`,
            `SUBSCRIPTION_CANCELLED`, `ADDON_CANCELLED`, `EXPIRED`,
            `ACCOUNT_TERMINATED`, `SUSPEND_TERMINATED`, `ERROR`, `FRAUD`,
            `IMMEDIATE_CANCELLATION`, `OTHER`. More information can be found
            here "https://developer.bango.info/categories-and-codes/". If not
            provided, it is set to `NOT_PROVIDED`.
        cancelReasonDescription:
          type: string
          maxLength: 500
          title: Cancelreasondescription
          description: Additional information for termination reason
      type: object
      title: EntitlementTerminate
      description: >-
        Entitlement cancel / revoke request.


        Reason category, code and description are added to the extensionData
        after

        a successful request to terminate the entitlement.
    EntitlementRead:
      properties:
        entitlementId:
          type: string
          format: uuid
          title: Entitlementid
          description: Unique identifier representing a specific entitlement.
        customerIdentifier:
          type: string
          title: Customeridentifier
          description: Unique, immutable user identifier
        sharedCustomerId:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Sharedcustomerid
          description: >-
            Bango generated id shared between reseller and merchant for this
            customer (contact support for setup)
        bangoUserId:
          type: string
          title: Bangouserid
          description: Bango-generated customer identifier.
        merchantAccountKey:
          type: string
          title: Merchantaccountkey
          description: Unique identifier for the content provider
        productKey:
          type: string
          title: Productkey
          description: Unique identifier for the product/offer
        notificationUrl:
          anyOf:
            - type: string
            - type: 'null'
          title: Notificationurl
          description: >-
            The endpoint where Bango will send all notifications regarding this
            entitlement
        offerKey:
          anyOf:
            - type: string
            - type: 'null'
          title: Offerkey
          description: Entitlement offer identifier
        externalEntitlementId:
          anyOf:
            - type: string
            - type: 'null'
          title: Externalentitlementid
          description: >-
            Unique identifier for the entitlement provided by the reseller. If
            the previous attempt to create an entitlement failed, this value can
            be reused.
        entitlementDisplayName:
          anyOf:
            - type: string
            - type: 'null'
          title: Entitlementdisplayname
          description: Entitlement display name used in reports.
        dateCreated:
          type: string
          format: date-time
          title: Datecreated
          description: Timestamp for the creation of the entitlement
        dateActivated:
          type: string
          format: date-time
          title: Dateactivated
          description: >-
            Timestamp provided by the content provider when the entitlement is
            activated
          default: '0001-01-01T00:00:00Z'
        dateEnded:
          type: string
          format: date-time
          title: Dateended
          description: Timestamp for when the entitlement terminated
          default: '0001-01-01T00:00:00Z'
        dateSuspended:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Datesuspended
          description: Timestamp for when the entitlement was suspended
        dateResumed:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Dateresumed
          description: Timestamp for when the entitlement was last resumed
        dateExpiry:
          type: string
          format: date-time
          title: Dateexpiry
          description: >-
            If set, Bango will schedule a termination request to the content
            provider on this date. Date format must be ISO 8601
          default: '0001-01-01T00:00:00Z'
        dateFailed:
          type: string
          format: date-time
          title: Datefailed
          description: Date when the creation of the entitlement failed
          default: '0001-01-01T00:00:00Z'
        dateAutoSuspend:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Dateautosuspend
          description: >-
            If set, Bango will schedule a suspension request to the content
            provider on this date. Date format must be ISO 8601
        responseCode:
          type: string
          title: Responsecode
          description: Result of entitlement operation. `OK` on success.
          examples:
            - OK
        responseMessage:
          type: string
          title: Responsemessage
          description: >-
            Response message of entitlement operation. `Success` if completed
            successfully.
          examples:
            - Success
        status:
          $ref: '#/components/schemas/EntitlementStatus'
          description: >
            The entitlement status. Possible values are:

            * PENDING: The entitlement has been initiated, but the user has not
            yet completed the activation process.

            * ACTIVE: The entitlement has been successfully activated

            * SUSPENDED: The entitlement has been suspended.

            * ACTIVE-ENDING: The entitlement is ending at the end of the current
            period.

            * CANCELLED: The entitlement has been cancelled.

            * REVOKED: The entitlement has been revoked.

            * FAILED: The entitlement could not be created.
        activationCode:
          anyOf:
            - type: string
            - type: 'null'
          title: Activationcode
          description: Code or token used for the entitlement activation
        extensionData:
          additionalProperties:
            type: string
            maxLength: 250
          type: object
          title: Extensiondata
          description: Custom key value pairs
        extraInformation:
          $ref: '#/components/schemas/ExtraInformation'
          title: Extrainformation
        financeData:
          $ref: '#/components/schemas/FinanceData'
          title: Financedata
          description: Finance Data.
      type: object
      required:
        - entitlementId
        - customerIdentifier
        - bangoUserId
        - merchantAccountKey
        - productKey
        - entitlementDisplayName
        - dateCreated
        - responseCode
        - responseMessage
        - status
      title: EntitlementRead
      description: Entitlement.
    ErrorResponse:
      properties:
        responseCode:
          type: string
          title: Responsecode
          description: >-
            Bango code that identifies the error, for example `BAD_REQUEST`,
            `NOT_AVAILABLE`, `NOT_FOUND`, `INVALID_STATE` or `INTERNAL_ERROR`.
            See the examples on each response for the codes that the operation
            can return.
          examples:
            - BAD_REQUEST
        responseMessage:
          type: string
          title: Responsemessage
          description: Description of the error
        metadata:
          $ref: '#/components/schemas/ErrorMetadata'
          title: Metadata
          description: Error Metadata
      type: object
      required:
        - responseCode
      title: ErrorResponse
      description: Error response for Entitlement API.
    EntitlementStatus:
      type: string
      enum:
        - PENDING
        - ACTIVE
        - SUSPENDED
        - ACTIVE-ENDING
        - CANCELLED
        - REVOKED
        - FAILED
      title: EntitlementStatus
      description: Entitlement status.
    ExtraInformation:
      properties:
        communicationInformation:
          $ref: '#/components/schemas/CommunicationInformation'
          title: Communicationinformation
        clientDevice:
          $ref: '#/components/schemas/ClientDevice'
          title: Clientdevice
          description: Client device information.
        source:
          $ref: '#/components/schemas/Source'
          description: Entitlement creation / activation source.
      type: object
      title: ExtraInformation
      description: Entitlement extra information.
    FinanceData:
      properties:
        source:
          type: string
          title: Source
          description: 'The source of the finance event. Suggested values: `Merchant`.'
          examples:
            - Merchant
        type:
          type: string
          title: Type
          description: >-
            The type of finance event. Suggested values: `order`, `return`,
            `renew`.
          examples:
            - order
        timestamp:
          type: string
          format: date-time
          title: Timestamp
          description: UTC ISO 8601
        retailCurrency:
          type: string
          title: Retailcurrency
          description: ISO 3
        retailPrice:
          type: number
          title: Retailprice
          description: As per standard price element, including tax
        retailPriceTax:
          type: number
          title: Retailpricetax
          description: As per standard price element, tax included in the retailPrice
        offerPrice:
          type: number
          title: Offerprice
          description: As per standard price element, including tax
        offerPriceTax:
          type: number
          title: Offerpricetax
          description: As per standard price element, tax included in the offerPrice
        notes:
          type: string
          maxLength: 255
          title: Notes
          description: Free text field, max 255 characters
      type: object
      required:
        - source
        - type
        - timestamp
      title: FinanceData
      description: Finance data.
    ErrorMetadata:
      properties:
        responseMessageFrom:
          $ref: '#/components/schemas/ErrorOriginator'
          description: |
            The originator of the error (either Bango or the content provider)

            * `BANGO`
            * `MERCHANT`
      type: object
      required:
        - responseMessageFrom
      title: ErrorMetadata
      description: Error metadata.
    CommunicationInformation:
      properties:
        msisdn:
          anyOf:
            - type: string
            - type: 'null'
          title: Msisdn
          description: >-
            A mobile phone number that can be used to contact the consumer, with
            international prefix
        emailAddress:
          anyOf:
            - type: string
            - type: 'null'
          title: Emailaddress
          description: An email address that can be used to contact the consumer.
      type: object
      title: CommunicationInformation
      description: Communication information.
    ClientDevice:
      properties:
        type:
          $ref: '#/components/schemas/DeviceType'
          description: >
            The type of device. This field is mandatory if clientDevice is being
            provided.


            * `STB`

            * `MOBILE`

            * `DESKTOP`

            * `TABLET`
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
          description: The unique id of the device
        typeId:
          anyOf:
            - type: string
            - type: 'null'
          title: Typeid
          description: The common id for the type of device
        modelName:
          anyOf:
            - type: string
            - type: 'null'
          title: Modelname
          description: The model name of the device
        modelNumber:
          anyOf:
            - type: string
            - type: 'null'
          title: Modelnumber
          description: The model number of the device
        serialNumber:
          anyOf:
            - type: string
            - type: 'null'
          title: Serialnumber
          description: The serial number of the device
        osType:
          anyOf:
            - type: string
            - type: 'null'
          title: Ostype
          description: The operating system of the device
        osVersion:
          anyOf:
            - type: string
            - type: 'null'
          title: Osversion
          description: The version of the operating system of the device
        macAddress:
          anyOf:
            - type: string
            - type: 'null'
          title: Macaddress
          description: The MAC address of the device
        browser:
          anyOf:
            - type: string
            - type: 'null'
          title: Browser
          description: The browser being used
      type: object
      required:
        - type
      title: ClientDevice
      description: Client device.
    Source:
      properties:
        channelType:
          $ref: '#/components/schemas/ChannelType'
          title: Channeltype
          description: |
            The channel the customer used to get the offer. Allowed values:

            * `Retail`
            * `SMS`
            * `App`
            * `Website`
            * `Email`
            * `Call Centre`
            * `Mobile`
            * `Set Top Box`
            * `Other`
        campaignRef:
          anyOf:
            - type: string
            - type: 'null'
          title: Campaignref
          description: The reference of the campaign that attracted the customer
        referrer:
          anyOf:
            - type: string
            - type: 'null'
          title: Referrer
          description: The origin of the customer's request
        bundleId:
          anyOf:
            - type: string
            - type: 'null'
          title: Bundleid
          description: Identifies the bundle the entitlement is part of
        country:
          anyOf:
            - type: string
            - type: 'null'
          title: Country
          description: The customer's country
        region:
          anyOf:
            - type: string
            - type: 'null'
          title: Region
          description: The customer's regional area or code
        brand:
          anyOf:
            - type: string
            - type: 'null'
          title: Brand
          description: The brand
      type: object
      title: Source
      description: Entitlement source.
    ErrorOriginator:
      type: string
      enum:
        - BANGO
        - MERCHANT
      title: ErrorOriginator
      description: Error originator.
    DeviceType:
      type: string
      enum:
        - STB
        - MOBILE
        - DESKTOP
        - TABLET
      title: DeviceType
      description: Client device type.
    ChannelType:
      type: string
      enum:
        - Retail
        - SMS
        - App
        - Website
        - Email
        - Call Centre
        - Mobile
        - Set Top Box
        - Other
      title: ChannelType
      description: The channel the customer used to get the offer.
  securitySchemes:
    XApiKey:
      type: apiKey
      in: header
      name: x-api-key
    BasicAuth:
      type: http
      scheme: basic
    OAuth2:
      type: oauth2
      description: >-
        Bango uses
        https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/.
        Please note that when requesting a token, we only support the option to
        send the client secret in the request body. The token URL is for
        production. In the sandbox, use the sandbox authentication service at
        https://sandbox.auth.bango.com.
      flows:
        clientCredentials:
          scopes:
            any: >-
              grants Bango access to the merchant system based on merchant
              defined rules
          tokenUrl: https://auth.bango.com/oauth2/token

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.