---
title: "Activate or deactivate an UCB"
url: "https://developer-qual.migros.ch/apis/coupons-3/versions/b27797a2-ad08-41e0-8429-0f1aeab8826f/operations/toggleUCB"
---

> Full API specification: https://developer-qual.migros.ch/apis/coupons-3/versions/b27797a2-ad08-41e0-8429-0f1aeab8826f.md

# Activate or deactivate an UCB

`POST` `/migros/customers/coupons/v3/users/{cumulus}/ucbs/{ucbid}:{state}`

Operation ID: `toggleUCB`

Only non-redeem UCBs can be activated or deactivated. It's okay to activate an already active UCB as it is okay to deactivate an already inactive UCB. Note that no more than 50 UCBss can be in state 'activated' for a single Cumulus number. Trying to activate more results in a 409 error. **Note**: The parameters can be sent as query parameters in the URL or as application/x-www-form-urlencoded in the request body (or any combination, it just doesn't matter.)

## Path parameters

- `cumulus` (string, required) - Cumulus number.
- `ucbid` (string, required) - ID (barcode) of a UCB. Its a string as it is often longer than what integers can represent (especially in toy languages).
- `state` (string, required) - The action to perform.

## Responses

- `204` - Successful activated/deactivated
- `409` - Maximum number of simultaneous active Coupons was exceeded. No need to retry the operation you get the same result over and over until you deactivate or redeem any other Coupon.
- `default` - Standard HTTP semantics, no machine-interpretable body.

## OpenAPI definition

```yaml
openapi: 3.0.0
info:
  title: Coupons
  version: 3.4.0
servers:
  - description: URL of upstream
    url: https://api-qual.migros.ch
paths:
  /migros/customers/coupons/v3/users/{cumulus}/ucbs/{ucbid}:{state}:
    post:
      description: >-
        Only non-redeem UCBs can be activated or deactivated. It's okay to
        activate an already active UCB as it is okay to deactivate an already
        inactive UCB.


        Note that no more than 50 UCBss can be in state 'activated' for a single
        Cumulus number. Trying to activate more results in a 409 error.


        **Note**: The parameters can be sent as query parameters in the URL or
        as application/x-www-form-urlencoded in the request body (or any
        combination, it just doesn't matter.)
      operationId: toggleUCB
      parameters:
        - $ref: "#/components/parameters/cumulus"
        - $ref: "#/components/parameters/ucbid"
        - description: The action to perform.
          example: activate
          in: path
          name: state
          required: true
          schema:
            enum:
              - activate
              - deactivate
            type: string
      responses:
        "204":
          description: Successful activated/deactivated
        "409":
          $ref: "#/components/responses/409"
        default:
          description: Standard HTTP semantics, no machine-interpretable body.
      summary: Activate or deactivate an UCB
      tags:
        - Customer-Data
security:
  - Kong-Api-Key: []
  - Basic-Auth: []
components:
  parameters:
    cumulus:
      description: Cumulus number.
      example: "2099123456789"
      in: path
      name: cumulus
      required: true
      schema:
        maxLength: 13
        minLength: 13
        pattern: ^\d{13}$
        type: string
    ucbid:
      description: ID (barcode) of a UCB. Its a string as it is often longer than what
        integers can represent (especially in toy languages).
      in: path
      name: ucbid
      required: true
      schema:
        pattern: ^\d+$
        type: string
  responses:
    "409":
      description: Maximum number of simultaneous active Coupons was exceeded. No need
        to retry the operation you get the same result over and over until you
        deactivate or redeem any other Coupon.
  securitySchemes:
    Kong-Api-Key:
      description: Kong key-auth authentication
      in: header
      name: X-Api-Key
      type: apiKey
    Basic-Auth:
      description: Kong basic-auth authentication
      scheme: basic
      type: http
```
