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

# Create Post Purchase Popup



## OpenAPI

````yaml openapi-post-purchase-popup_v1.json POST /offering/offer/popup
openapi: 3.0.0
info:
  title: Offering API
  description: Offering API for enabling publishers to push new assets
  version: '1.0'
  contact: {}
servers:
  - url: https://api-sandbox.appcharge.com
security: []
tags: []
paths:
  /offering/offer/popup:
    post:
      tags:
        - Popups
      operationId: create-post-purchase-popup
      parameters:
        - name: x-publisher-token
          required: true
          in: header
          description: The publisher token
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePopupDto'
      responses:
        '201':
          description: Create a new Offer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PopupDtoResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  requestUrl:
                    type: string
                  body:
                    type: string
        '401':
          description: Not Authorized
components:
  schemas:
    CreatePopupDto:
      type: object
      properties:
        publisherOfferId:
          type: string
          description: The publisher offer Id.
          example: offer1
        name:
          type: string
          description: The name of the offer. At least 3 letters.
          example: Test_PopUp
        displayName:
          type: string
          description: >-
            The display name of the offer. If not specified, the offer name will
            be used.
        description:
          type: string
          description: The description of the offer. Conditionally returned.
          example: Best offer ever.
        type:
          type: string
          description: The type of the offer, in this case 'PopUp'
          example: PopUp
        subType:
          type: string
          description: The type of popup. In this case 'PostPurchase'
        priority:
          type: number
          description: >-
            Choose the priority of the order in which the popups will be
            displayed, 1 being first
        offerUiId:
          type: string
          description: >-
            The Internal ID for the Offer UI. The Offer UI is responsible to add
            UI elements to the offers such as background image and title. Once
            you create the Offer UI using the dashboard, you will get the
            internal ID.
          example: 64a55b82e06998282d3d9b59
        offerExternalUiId:
          type: string
          description: >-
            The offer UI ID as configured by the publisher. If offerExternalUiId
            is provided, then offerUiId will not be required.
          example: b9c1e7a3d1f8b2a4c6e5d8f3
        active:
          type: boolean
          description: Is the offer active? true/false.
          example: 'true'
        startOver:
          type: boolean
          description: Whether the popup will repeat itself.
        triggers:
          type: array
          description: >-
            An array of objects specifying the conditions under which the popup
            should be triggered.
          items:
            type: object
            properties:
              type:
                type: string
                description: Type of trigger.
                enum:
                  - event
              eventName:
                type: string
                description: Name of the event that triggers the popup.
                enum:
                  - purchase
              every:
                type: integer
                description: Number of purchases required to present the popup.
              rules:
                type: array
                description: >-
                  Rules to specify conditions under which the popup appears. If
                  it can apply to any offers, leave the array empty.
                items:
                  type: object
                  properties:
                    fieldName:
                      type: string
                      description: Name of the field to evaluate.
                      enum:
                        - publisherOfferId
                    operator:
                      type: string
                      description: Operator to compare the field value.
                      enum:
                        - in
                    value:
                      type: array
                      description: Array of 'publisherOfferId'(s)
                      items:
                        type: string
        segments:
          type: array
          items:
            type: string
          description: >-
            The Ids of the player segments to be used in the segmentation
            algorithm. for example: [“NewUser”, “BigSpender”]. This param is
            required but can be left empty.
          example: NewUser
        productsSequence:
          type: array
          items:
            $ref: '#/components/schemas/ProductsSequence'
          description: An array of product sequences. Only one product sequence is allowed.
      required:
        - publisherOfferId
        - name
        - type
        - offerUiId
        - active
        - segments
        - productsSequence
        - subType
        - triggers
    PopupDtoResponse:
      type: object
      properties:
        offerId:
          type: string
          description: The Id of the offer.
          example: 655dc8a546822b3e7586b7b7
        publisherOfferId:
          type: string
          description: The offer publisher Id.
          example: offer1
        name:
          type: string
          description: The name of the offer.
          example: Test_PopUp
        displayName:
          type: string
          description: >-
            The display name of the offer. If not specified, the offer name will
            be used. Conditonally returned.
        description:
          type: string
          description: The description of the offer. Conditionally returned.
          example: N/A
        type:
          type: string
          description: 'The type of the offer. In this case: PopUp.'
          example: PopUp
        subType:
          type: string
          description: >-
            Price of the products set in cents. Will be returned as 0 if subtype
            is daily bonus.
        createdBy:
          type: string
          description: The platform which the offer was created from (Dashboard, API)
          example: API
        offerUi:
          $ref: '#/components/schemas/OfferUiDto'
        active:
          type: boolean
          description: Is the offer active? true/false.
          example: 'true'
        coolDownInHours:
          type: number
          description: >-
            Used for cooldown between orders. **DEPRECATION WARNING**: This
            field will be removed in future releases.
          example: '1'
        segments:
          type: array
          items:
            type: string
          description: >-
            The Ids of the player segments to be used in the segmentation
            algorithm. for example: [“NewUser”, “BigSpender”].
          example: '[NewUser]'
        productsSequence:
          type: array
          items:
            $ref: '#/components/schemas/ProductsSequenceResponse'
          description: An array of product sequences. Only one product sequence is allowed.
        startOver:
          type: boolean
          description: Whether the popup will repeat itself.
        priority:
          type: number
          description: Defines the order of priority of for displaying popup.
        showAfter:
          type: string
          description: Event for which only after the popup appear.
        triggers:
          type: array
          description: >-
            An array of objects specifying the conditions under which the popup
            should be triggered.
          items:
            type: object
            properties:
              type:
                type: string
                description: Type of trigger.
                enum:
                  - event
              eventName:
                type: string
                description: Name of the event that triggers the popup.
                enum:
                  - purchase
              every:
                type: integer
                description: Number of purchases required to present the popup.
              rules:
                type: array
                description: >-
                  Rules to specify conditions under which the popup appears. If
                  it can apply to any offers, leave the array empty.
                items:
                  type: object
                  properties:
                    fieldName:
                      type: string
                      description: Name of the field to evaluate.
                      enum:
                        - publisherOfferId
                    operator:
                      type: string
                      description: Operator to compare the field value.
                      enum:
                        - in
                    value:
                      type: array
                      description: Array of 'publisherOfferId'(s)
                      items:
                        type: string
        createdAt:
          format: date-time
          type: string
          description: the time when the offer was created, in UTC.
          example: '2023-07-05T12:01:06.113Z'
        updatedAt:
          format: date-time
          type: string
          description: the time when the offer was updated, in UTC.
          example: '2023-07-05T12:01:06.113Z'
    ProductsSequence:
      type: object
      properties:
        id:
          type: string
          description: Internal MongoDB id.
        index:
          type: number
          description: Position of the offered products. Starts with 1.
          example: 1
        playerAvailability:
          type: number
          description: How many available for a player.
          example: 2
          minimum: 1
          maximum: 99
        priceInUsdCents:
          type: number
          description: >-
            Price of the products set in cents. Will be returned as 0 if subtype
            is daily bonus.
          example: 300
        products:
          type: array
          items:
            $ref: '#/components/schemas/ProductsSet'
          description: The products in the set that the offer contains.
      required:
        - id
        - index
        - priceInUsdCents
        - products
    OfferUiDto:
      type: object
      properties:
        offerUiId:
          type: string
          description: The Id of the offer UI in Mongo DB format.
          example: 6548afb2ed7ec741ac8dee3a
        externalId:
          type: string
          description: the publisher offer Offer design ID
        active:
          type: boolean
          description: Is the offer UI active? true/false.
          example: 'true'
        offerUiType:
          type: string
          description: >-
            The type of offer associated with the UI you configured. In this
            case it will be 'PopUp'.
          example: PopUp
        name:
          type: string
          description: The name of the offer UI
          example: test_offerUi
        description:
          type: string
          description: The description of the offer UI
          example: Best Offer UI
        backgroundImage:
          type: string
          description: The background Image URL of the offer UI
          example: https://media.appcharge.com/defaults/background.png
        specialOffer:
          type: object
          description: Additional design fields for the type of Offer UI you configured.
          properties:
            templateType:
              type: string
              description: 'The template type: Single/Multiple.'
              example: Single
            presentOfferEndTimer:
              type: boolean
              description: Should an end timer be presented for the offer? true/false.
              example: 'false'
            title:
              type: string
              example: ''
            fontSize:
              type: number
              example: 18
            fontWeight:
              type: string
              example: normal
            fontColor:
              type: object
              properties:
                colorOne:
                  type: string
                  example: black
                colorTwo:
                  type: string
                  description: Conditionally returned
                  example: black
                direction:
                  type: string
                  description: Conditionally returned
                  example: to right
            backgroundColor:
              type: object
              properties:
                colorOne:
                  type: string
                  example: black
                colorTwo:
                  type: string
                  description: Conditionally returned
                  example: black
                direction:
                  type: string
                  description: Conditionally returned
                  example: to right
    ProductsSequenceResponse:
      type: object
      properties:
        index:
          type: number
          description: Position of the offered products. Starts with 1.
          example: 1
        playerAvailability:
          type: number
          description: How many available for a player. Conditionally returned.
          example: 2
        priceInUsdCents:
          type: number
          description: >-
            Price of the products set in cents. Must be greater than or equal to
            0.
          example: 300
        products:
          type: array
          items:
            $ref: '#/components/schemas/ProductsSetResponse'
          description: The products in the set that the offer contains.
    ProductsSet:
      type: object
      properties:
        quantity:
          type: number
          description: The quantity of the product.
          example: 500
        publisherProductId:
          type: string
          description: The publisher product Id as configured in the Appcharge dashboard.
          example: product1
      required:
        - quantity
        - publisherProductId
    ProductsSetResponse:
      type: object
      properties:
        quantity:
          type: number
          description: The quantity of the product.
          example: 500
        product:
          $ref: '#/components/schemas/ProductDto'
    ProductDto:
      type: object
      properties:
        publisherProductId:
          type: string
          description: The publisher product Id.
          example: product1
        name:
          type: string
          description: The name of the product.
          example: test_product
        textFontColorHex:
          type: string
          description: The color of the text in Hex.
          example: '#FFFF'
        type:
          type: string
          description: 'The type of the product: Time/Quantity.'
          example: Time
        prefix:
          type: string
          description: The prefix of the product.
          example: '100'
        suffix:
          type: string
          description: The suffix of the product.
          example: '500'
        priority:
          type: string
          description: 'The priority of the product: Main/Sub.'
          example: Main
        images:
          type: array
          items:
            type: object
            properties:
              type:
                type: string
              url:
                type: string
        createdAt:
          format: date-time
          type: string
          description: the time when the product was created, in UTC.
          example: '2023-07-05T12:01:06.113Z'
        updatedAt:
          format: date-time
          type: string
          description: the time when the product was updated, in UTC.
          example: '2023-07-05T12:01:06.113Z'
        productId:
          type: string
          description: The Id of the product.
          example: 655dc8a546822b3e7586b7b7

````