Optimizely Coupon blocks API

Manage coupon blocks that organize coupon codes

Business capability
Discount & Promotion Management BC-440.30

Operations 11

Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelist overlay

GET /{clientId}/couponblocks List coupon blocks · Get information about all coupon blocks #
Ask an LLM
“Which coupon blocks exist in my email marketing account?”
“Can I list only the coupon blocks that use a particular coupon source?”
Tell an agent
List coupon blocks in client {clientId} with coupon source {couponSource}.
Show up to {limit} {couponSource} coupon blocks for client {clientId}.
POST /{clientId}/couponblocks Create a coupon block · Create a new coupon block #
Ask an LLM
“How do I set up a new coupon block to hand out discount codes in mailings?”
“Can test mailings use real coupon codes from a new coupon block?”
Tell an agent
Create coupon block {name} with coupon source {couponSource} in client {clientId}.
Add a coupon block {name} in client {clientId} and set real codes for test mails to {useRealCodesForTestMails}.
GET /{clientId}/couponblocks/{couponBlockId} Get a coupon block · Get information about a coupon block #
Ask an LLM
“What is the name and coupon source of a specific coupon block?”
“Does a given coupon block use valid codes for test mailings?”
Tell an agent
Get coupon block {couponBlockId} in client {clientId}.
Show the settings of coupon block {couponBlockId} for client {clientId}.
DELETE /{clientId}/couponblocks/{couponBlockId} Delete a coupon block · Delete a coupon block #
Ask an LLM
“Can I remove a whole coupon block I no longer use?”
“What deletes an entire coupon block rather than its individual codes?”
Tell an agent destructive · confirm first
Delete coupon block {couponBlockId} in client {clientId}.
Remove the entire coupon block {couponBlockId} from client {clientId}.
GET /{clientId}/couponblocks/{couponBlockId}/codes List codes in a coupon block · Get information about coupon codes #
Ask an LLM
“How many unassigned coupon codes are left in a coupon block?”
“Can I see which coupon codes went to a given mailing or recipient?”
Tell an agent
List coupon codes in block {couponBlockId} for client {clientId}.
Show codes from block {couponBlockId} in client {clientId} assigned in mailing {mailingId}.
POST /{clientId}/couponblocks/{couponBlockId}/codes Add coupon codes to a block · Create a list of coupon codes #
Ask an LLM
“How do I upload a batch of discount codes into a coupon block?”
“Can I add a list of new coupon codes to an existing coupon block?”
Tell an agent
Add codes {codes} to coupon block {couponBlockId} in client {clientId}.
Load these coupon codes into block {couponBlockId} for client {clientId}: {codes}.
DELETE /{clientId}/couponblocks/{couponBlockId}/codes Delete several coupon codes from a block · Delete coupon codes #
Ask an LLM
“Can I delete a list of coupon codes from a coupon block in one request?”
“Which call removes many coupon codes at once while keeping the block?”
Tell an agent destructive · confirm first
Delete coupon codes {codes} from block {couponBlockId} in client {clientId}.
Remove this set of codes from coupon block {couponBlockId} in client {clientId}: {codes}.
GET /{clientId}/couponblocks/{couponBlockId}/codes/{code} Get a single coupon code · Get information about a coupon code #
Ask an LLM
“Which mailing and recipient was a specific coupon code assigned to?”
“Can I look up the details of one coupon code?”
Tell an agent
Get coupon code {code} from block {couponBlockId} in client {clientId}.
Show who received coupon code {code} in block {couponBlockId}, client {clientId}.
POST /{clientId}/couponblocks/{couponBlockId}/codes/{code} Mark a coupon code as used · Invalidate a coupon code #
Ask an LLM
“How do I invalidate a coupon code once a customer has redeemed it?”
“Can I flag a single coupon code as used so it is not handed out again?”
Tell an agent destructive · confirm first
Mark coupon code {code} in block {couponBlockId} as used for client {clientId}.
Invalidate redeemed code {code} in coupon block {couponBlockId}, client {clientId}.
DELETE /{clientId}/couponblocks/{couponBlockId}/codes/{code} Delete a single coupon code · Delete a coupon code #
Ask an LLM
“Can I delete just one coupon code from a block?”
“What removes a single mistaken coupon code entirely?”
Tell an agent destructive · confirm first
Delete coupon code {code} from block {couponBlockId} in client {clientId}.
Remove only the code {code} from coupon block {couponBlockId}, client {clientId}.
GET /{clientId}/couponblocks/{couponBlockId}/assignedmailings List mailings using a coupon block · Get all mailing IDs a coupon block is assigned to #
Ask an LLM
“Which mailings is a coupon block assigned to?”
“Is a coupon block still used by any mailing before I delete it?”
Tell an agent
List mailing IDs that use coupon block {couponBlockId} in client {clientId}.
Show every mailing assigned to coupon block {couponBlockId} for client {clientId}.

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/optimizely:optimizely-coupon-blocks-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

optimizely-coupon-blocks-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Optimizely Campaign REST Coupon blocks API
  description: This documentation lists all available resources and endpoints of the Optimizely Campaign REST API.
  version: '1'
servers:
- url: https://api.campaign.episerver.net/rest
tags:
- name: Coupon blocks
  description: Manage coupon blocks that organize coupon codes
paths:
  /{clientId}/couponblocks:
    get:
      tags:
      - Coupon blocks
      summary: Get information about all coupon blocks
      description: Get detailed information about all coupon blocks, such as name, coupon source or if valid coupon codes are used for testing.
      operationId: selectCouponBlocks
      parameters:
      - name: clientId
        in: path
        description: Client ID
        required: true
        schema:
          type: integer
          format: int64
      - name: limit
        in: query
        description: 'Maximum number of retrieved coupon blocks <p><i>Default value</i> : 100</p>'
        schema:
          type: integer
          format: int32
      - name: couponSource
        in: query
        description: Coupon source of the coupon block
        required: true
        schema:
          type: string
          enum:
          - static
          - generated
          - ean13barcode
          - twooffivebarcode
          - code128barcode
          - code128abarcode
          - code128bbarcode
          - code128cbarcode
      responses:
        '200':
          description: The coupon blocks were retrieved successfully (empty result if none was found).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestCouponBlockStreamingCollection'
            application/vnd.optivo.broadmail.v1+json:
              schema:
                $ref: '#/components/schemas/RestCouponBlockStreamingCollection'
        '400':
          description: Invalid limit request. Change the limit to less than 10000.
      security:
      - Authorization: []
    post:
      tags:
      - Coupon blocks
      summary: Create a new coupon block
      description: Create a new coupon block and specify type, internal name and if it should use valid coupon codes.
      operationId: createCouponBlock
      parameters:
      - name: clientId
        in: path
        description: Client ID
        required: true
        schema:
          type: integer
          format: int64
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/CouponBlockRequestData'
      responses:
        '201':
          description: The coupon block was created successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestCouponBlock'
            application/vnd.optivo.broadmail.v1+json:
              schema:
                $ref: '#/components/schemas/RestCouponBlock'
      security:
      - Authorization: []
  /{clientId}/couponblocks/{couponBlockId}:
    get:
      tags:
      - Coupon blocks
      summary: Get information about a coupon block
      description: Get detailed information about a coupon block, such as name, coupon source or if valid coupon codes are used for testing.
      operationId: getCouponBlock
      parameters:
      - name: clientId
        in: path
        description: Client ID
        required: true
        schema:
          type: integer
          format: int64
      - name: couponBlockId
        in: path
        description: Coupon block ID
        required: true
        schema:
          type: integer
          format: int64
      responses:
        '200':
          description: The coupon block was retrieved successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestCouponBlock'
            application/vnd.optivo.broadmail.v1+json:
              schema:
                $ref: '#/components/schemas/RestCouponBlock'
        '404':
          description: The coupon block could not be found. Ensure that the required parameters such as "couponBlockId" are correct and the coupon block exists.
        '409':
          description: The coupon block is not assigned to the indicated client. Ensure that "clientId" and "couponBlockId" are correct and that the "couponBlockId" is assigned to the indicated client.
      security:
      - Authorization: []
    delete:
      tags:
      - Coupon blocks
      summary: Delete a coupon block
      operationId: deleteCouponBlock
      parameters:
      - name: clientId
        in: path
        description: Client ID
        required: true
        schema:
          type: integer
          format: int64
      - name: couponBlockId
        in: path
        description: Coupon block ID
        required: true
        schema:
          type: integer
          format: int64
      responses:
        '204':
          description: The coupon block was deleted successfully.
        '404':
          description: The coupon block could not be found. Ensure that the required parameters such as "couponBlockId" are correct and the coupon block exists.
        '409':
          description: The coupon block is not assigned to the indicated client. Ensure that "clientId" and "couponBlockId" are correct and that the "couponBlockId" is assigned to the indicated client.
      security:
      - Authorization: []
  /{clientId}/couponblocks/{couponBlockId}/codes:
    get:
      tags:
      - Coupon blocks
      summary: Get information about coupon codes
      description: Get detailed information about all unassigned coupon codes. You can limit the maximum number of retrieved coupon codes and sort the result by specific criteria. To get information about all assigned and/or used coupon codes, filter by recipient ID or mailing ID.
      operationId: selectCouponCodes
      parameters:
      - name: clientId
        in: path
        description: Client ID
        required: true
        schema:
          type: integer
          format: int64
      - name: offset
        in: query
        description: 'Starting point of the result list <p><i>Default value</i> : 0</p>'
        schema:
          type: integer
          format: int32
      - name: limit
        in: query
        description: 'Maximum number of retrieved coupon codes <p><i>Default value</i> : 100</p>'
        schema:
          type: integer
          format: int32
      - name: codeAssignment
        in: query
        description: 'The status of the coupon codes to be filtered. Possible values are: assigned, unassigned, all'
        schema:
          type: string
          enum:
          - ASSIGNED
          - UNASSIGNED
          - ALL
      - name: mailingId
        in: query
        description: Mailing IDs to which the coupon codes are assigned
        schema:
          type: integer
          format: int64
      - name: recipientId
        in: query
        description: Recipient IDs to which the coupon codes are assigned
        schema:
          type: string
      - name: sort
        in: query
        description: Sort result by specific criteria
        schema:
          type: string
          enum:
          - CODE
      - name: direction
        in: query
        description: Sort order
        schema:
          type: string
          enum:
          - ASC
          - DESC
      - name: couponBlockId
        in: path
        description: Coupon block ID
        required: true
        schema:
          type: integer
          format: int64
      responses:
        '200':
          description: The coupon codes were retrieved successfully (empty result if none was found).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestCouponCodeStreamingCollection'
            application/vnd.optivo.broadmail.v1+json:
              schema:
                $ref: '#/components/schemas/RestCouponCodeStreamingCollection'
        '400':
          description: The "codeAssignment" parameter is provided simultaneously with the "mailingId" or the "recipientId", or the limit parameter is invalid. Change the limit to less than 10000.
        '404':
          description: The coupon block could not be found. Ensure that the required parameters such as "couponBlockId" are correct and the coupon block exists.
        '409':
          description: The coupon block is not assigned to the indicated client. Ensure that "clientId" and "couponBlockId" are correct and that the "couponBlockId" is assigned to the indicated client.
      security:
      - Authorization: []
    post:
      tags:
      - Coupon blocks
      summary: Create a list of coupon codes
      operationId: createCouponCodes
      parameters:
      - name: clientId
        in: path
        description: Client ID
        required: true
        schema:
          type: integer
          format: int64
      - name: couponBlockId
        in: path
        description: Coupon block ID
        required: true
        schema:
          type: integer
          format: int64
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/CouponCodeRequestData'
      responses:
        '201':
          description: The coupon codes were created successfully.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RestCouponCode'
            application/vnd.optivo.broadmail.v1+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RestCouponCode'
        '400':
          description: The request parameters are invalid.
        '404':
          description: The coupon block could not be found. Ensure that the required parameters such as "couponBlockId" are correct and the coupon block exists.
        '409':
          description: The coupon block is not assigned to the indicated client. Ensure that "clientId" and "couponBlockId" are correct and that the "couponBlockId" is assigned to the indicated client.
      security:
      - Authorization: []
    delete:
      tags:
      - Coupon blocks
      summary: Delete coupon codes
      operationId: deleteAllCouponCodes
      parameters:
      - name: clientId
        in: path
        description: Client ID
        required: true
        schema:
          type: integer
          format: int64
      - name: codes
        in: query
        description: Coupon codes to be deleted
        required: true
        explode: false
        schema:
          type: array
          items:
            type: string
      - name: couponBlockId
        in: path
        description: Coupon block ID
        required: true
        schema:
          type: integer
          format: int64
      responses:
        '204':
          description: The coupon codes were deleted successfully.
        '404':
          description: The coupon block could not be found. Ensure that the required parameters such as "couponBlockId" are correct and the coupon block exists.
        '409':
          description: The coupon block is not assigned to the indicated client. Ensure that "clientId" and "couponBlockId" are correct and that the "couponBlockId" is assigned to the indicated client.
      security:
      - Authorization: []
  /{clientId}/couponblocks/{couponBlockId}/codes/{code}:
    get:
      tags:
      - Coupon blocks
      summary: Get information about a coupon code
      description: Get detailed information about a coupon code, such as code, mailing assignment or recipient assignment.
      operationId: getCouponCode
      parameters:
      - name: clientId
        in: path
        description: Client ID
        required: true
        schema:
          type: integer
          format: int64
      - name: code
        in: path
        description: Coupon code
        required: true
        schema:
          type: string
      - name: couponBlockId
        in: path
        description: Coupon block ID
        required: true
        schema:
          type: integer
          format: int64
      responses:
        '200':
          description: The coupon code was retrieved successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestCouponCode'
            application/vnd.optivo.broadmail.v1+json:
              schema:
                $ref: '#/components/schemas/RestCouponCode'
        '404':
          description: The coupon code could not be found. Ensure that the required parameters such as "couponBlockId" are correct and the coupon code exists.
        '409':
          description: The coupon code is not assigned to the indicated client. Ensure that "clientId" and the coupon code are correct and that the "couponBlockId" is assigned to the indicated client.
      security:
      - Authorization: []
    post:
      tags:
      - Coupon blocks
      summary: Invalidate a coupon code
      description: Mark a coupon code as used.
      operationId: markAsUsed
      parameters:
      - name: clientId
        in: path
        description: Client ID
        required: true
        schema:
          type: integer
          format: int64
      - name: code
        in: path
        description: Coupon code
        required: true
        schema:
          type: string
      - name: couponBlockId
        in: path
        description: Coupon block ID
        required: true
        schema:
          type: integer
          format: int64
      responses:
        '200':
          description: The coupon code was invalidated successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestCouponCode'
            application/vnd.optivo.broadmail.v1+json:
              schema:
                $ref: '#/components/schemas/RestCouponCode'
        '404':
          description: The coupon code could not be found. Ensure that the required parameters such as "couponBlockId" are correct and the coupon code exists.
        '409':
          description: The coupon code is not assigned to the indicated client. Ensure that "clientId" and the coupon code are correct and that the "couponBlockId" is assigned to the indicated client.
      security:
      - Authorization: []
    delete:
      tags:
      - Coupon blocks
      summary: Delete a coupon code
      operationId: deleteCouponCode
      parameters:
      - name: clientId
        in: path
        description: Client ID
        required: true
        schema:
          type: integer
          format: int64
      - name: code
        in: path
        description: Coupon code
        required: true
        schema:
          type: string
      - name: couponBlockId
        in: path
        description: Coupon block ID
        required: true
        schema:
          type: integer
          format: int64
      responses:
        '204':
          description: The coupon code was deleted successfully.
        '404':
          description: The coupon code could not be found. Ensure that the required parameters such as "couponBlockId" are correct and the coupon code exists.
        '409':
          description: The coupon code is not assigned to the indicated client. Ensure that "clientId" and the coupon code are correct and that the "couponBlockId" is assigned to the indicated client.
      security:
      - Authorization: []
  /{clientId}/couponblocks/{couponBlockId}/assignedmailings:
    get:
      tags:
      - Coupon blocks
      summary: Get all mailing IDs a coupon block is assigned to
      description: Get all mailing IDs to which a specified coupon block is assigned.
      operationId: getAllAssignedMailings
      parameters:
      - name: clientId
        in: path
        description: Client ID
        required: true
        schema:
          type: integer
          format: int64
      - name: couponBlockId
        in: path
        description: Coupon block ID
        required: true
        schema:
          type: integer
          format: int64
      responses:
        '200':
          description: The mailing IDs were retrieved successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestAssignedMailings'
            application/vnd.optivo.broadmail.v1+json:
              schema:
                $ref: '#/components/schemas/RestAssignedMailings'
        '404':
          description: The coupon block could not be found. Ensure that the required parameters such as "couponBlockId" are correct and the coupon block exists.
        '409':
          description: The coupon block is not assigned to the indicated client. Ensure that "clientId" and "couponBlockId" are correct and that the "couponBlockId" is assigned to the indicated client.
      security:
      - Authorization: []
components:
  schemas:
    RestAssignedMailings:
      type: object
      properties:
        mailingIds:
          type: array
          items:
            type: integer
            format: int64
    CouponBlockRequestData:
      required:
      - couponSource
      - name
      type: object
      properties:
        couponSource:
          type: string
          description: Coupon source of the coupon block
          enum:
          - static
          - generated
          - ean13barcode
          - twooffivebarcode
          - code128barcode
          - code128abarcode
          - code128bbarcode
          - code128cbarcode
        useRealCodesForTestMails:
          type: boolean
          description: If true, valid codes for test mails are used
        name:
          type: string
          description: Internal name of the coupon block
    RestApiLink:
      type: object
      properties:
        href:
          type: string
        rel:
          type: string
    RestCouponCode:
      type: object
      properties:
        code:
          type: string
          description: Coupon code
        assignedMailing:
          type: integer
          description: Mailing assigned to the coupon code
          format: int64
        assignedRecipient:
          type: string
          description: Recipient assigned to the coupon code
        assigned:
          type: boolean
          description: If true, the code of the coupon block is assigned to a mailing
        used:
          type: boolean
          description: If true, the code of the coupon block was used
        created:
          type: string
          description: Creation date
          format: date-time
        modified:
          type: string
          description: Modification date
          format: date-time
        links:
          type: array
          description: Restful links
          items:
            type: object
            properties:
              uriBuilder:
                type: object
              rels:
                type: array
                items:
                  type: string
              rel:
                type: string
              type:
                type: string
              params:
                type: object
                additionalProperties:
                  type: string
              title:
                type: string
              uri:
                type: string
                format: uri
            description: Restful links
    RestCouponBlock:
      type: object
      properties:
        id:
          type: integer
          description: Coupon block ID
          format: int64
        name:
          type: string
          description: Coupon block name
        couponSource:
          type: string
          description: Coupon source of the coupon block
        useRealCodesForTestMails:
          type: boolean
          description: If true, valid codes for test mails are used
        counter:
          $ref: '#/components/schemas/RestCouponBlockCounter'
        created:
          type: string
          description: Creation date
          format: date-time
        modified:
          type: string
          description: Modification date
          format: date-time
        links:
          type: array
          description: Restful links
          items:
            type: object
            properties:
              uriBuilder:
                type: object
              rels:
                type: array
                items:
                  type: string
              rel:
                type: string
              type:
                type: string
              params:
                type: object
                additionalProperties:
                  type: string
              title:
                type: string
              uri:
                type: string
                format: uri
            description: Restful links
    RestCouponBlockStreamingCollection:
      type: object
      properties:
        elements:
          type: array
          items:
            $ref: '#/components/schemas/RestCouponBlock'
        links:
          type: array
          writeOnly: true
          items:
            $ref: '#/components/schemas/RestApiLink'
        count:
          type: integer
          format: int32
        offset:
          type: integer
          format: int32
        limit:
          type: integer
          format: int32
    RestCouponBlockCounter:
      type: object
      properties:
        codeCount:
          type: integer
          description: Number of all coupon codes
          format: int64
        assigned:
          type: integer
          description: Number of all assigned coupon codes
          format: int64
        unassigned:
          type: integer
          description: Number of all available coupon codes
          format: int64
      description: Counter of coupon codes
    RestCouponCodeStreamingCollection:
      type: object
      properties:
        elements:
          type: array
          items:
            $ref: '#/components/schemas/RestCouponCode'
        links:
          type: array
          writeOnly: true
          items:
            $ref: '#/components/schemas/RestApiLink'
        count:
          type: integer
          format: int32
        offset:
          type: integer
          format: int32
        limit:
          type: integer
          format: int32
    CouponCodeRequestData:
      required:
      - codes
      type: object
      properties:
        codes:
          type: array
          description: List of coupon codes
          items:
            type: string
            description: List of coupon codes
  securitySchemes:
    Authorization:
      type: apiKey
      name: Authorization
      in: header
x-readme:
  explorer-enabled: true
  proxy-enabled: true