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

# Creates a coupon for the given customer.



## OpenAPI

````yaml https://api.bonifiq.com.br/swagger/Private%20APIs/swagger.json post /v1/pvt/Coupons
openapi: 3.0.0
info:
  title: BonifiQ Private APIs
  description: >-
    # Introduction 

    This is the BonifiQ Private APIs documentation. With these endpoints you can
    interact with BonifiQ systems and enhance your program points.


    # Limitations

    These endpoints are intended to be used in backend communication so they are
    not CORS-compatible and cannot be used by in-browser frontend libraries
    (such as React, Angular, Vue, jQuery, etc)


    If are required to call BonifiQ API from a browser, please refer to our
    [Public APIs](https://api.bonifiq.com.br/apidocs/public)


    # Authentication

    These Private APis use the [Basic
    Authentication](https://en.wikipedia.org/wiki/Basic_access_authentication)
    scheme. You need both an API Token (Username) and API Key (Password) to use
    with it


    You can generate this key pair in BonifiQ admin panel, at the "API Keys"
    menu.


    # How to use this page

    ## Making calls

    You can simulate, test and make calls to API from this Swagger page. To do
    that:

    - Click on the **Authorize** button

    - Inform the Username (API Token) and Passwoird (API Key) and click on
    **Authorize**

    - From the list bellow, choose an API call and click on **Try it out**

    - Inform the required parameters (if any) and click on **Execute**


    ## Verifying requests and responses bodies

    In every API Call there is an explanation of what each field means, theirs
    types and accepted values for all Requests and Responses.


    To view this information, just go to any API Call bellow and in the
    Responses section, click on the Schema.
  version: 1.0.0
servers:
  - url: https://api.bonifiq.com.br
security: []
tags:
  - name: POS
    description: >-
      Flow methods to integrate BonifiQ with a POS system. Check the Flow
      Documentation link on the right
    externalDocs:
      description: Flow Documentation
      url: >-
        https://suporte.bonifiq.com.br/support/solutions/articles/159000319538-integrar-com-pdv
  - name: Checkout
    description: Operations related to checkout cashback redeem, refresh and removal
  - name: Customization
    description: Retrieve customizations for the loyalty program
  - name: Rewards
    description: Interact with rewards already redeemed
paths:
  /v1/pvt/Coupons:
    post:
      tags:
        - Coupons
      summary: Creates a coupon for the given customer.
      operationId: Coupons_CreateCoupon
      requestBody:
        x-name: request
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCouponRequest'
        required: true
        x-position: 1
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/BaseExternalApiListResponseOfCreateCouponResponse
      security:
        - Basic Authentication: []
components:
  schemas:
    CreateCouponRequest:
      type: object
      description: Create Coupon Request model
      additionalProperties: false
      properties:
        OriginalId:
          type: string
          description: Id from the client store.
        CouponCode:
          type: string
          description: Coupon Code.
        CreatedDate:
          type: string
          description: Date of creation of this coupon.
          format: date-time
        CouponType:
          description: >-
            If 0 = Coupon is absolute value (eg R$10.00), 1 = the Coupon has a
            percentage value (Ex: 10%), 2 = its a free shipping Coupon, 3 = its
            a shipping discount Coupon.
          oneOf:
            - $ref: '#/components/schemas/CouponType'
        IsUsed:
          type: boolean
          description: If true, the coupon was already being used in a purchase.
        CouponValue:
          type: number
          description: Coupon Discount Value
          format: decimal
        ValidDateStart:
          type: string
          description: Coupon validity start date
          format: date-time
        ValidDateEnd:
          type: string
          description: Coupon expiration date
          format: date-time
        CustomerId:
          type: string
          description: Id for the customer that this coupon is being given.
        Customer:
          description: Customer Data
          oneOf:
            - $ref: '#/components/schemas/ExternalCreateCustomerRequest'
    BaseExternalApiListResponseOfCreateCouponResponse:
      type: object
      description: Base List response model methods
      additionalProperties: false
      properties:
        Items:
          type: array
          description: Collection with the found entities on the bonifiq DB.
          nullable: true
          xml:
            wrapped: true
          items:
            xml:
              name: CreateCouponResponse
            oneOf:
              - $ref: '#/components/schemas/CreateCouponResponse'
        TotalItemCount:
          type: integer
          description: Total of rewards Configurations founds.
          format: int32
        PageSize:
          type: integer
          description: Pagination size
          format: int32
        PageNumber:
          type: integer
          description: Actual Page Number
          format: int32
        HasNextPage:
          type: boolean
          description: true if there is another page to be load.
        HasError:
          type: boolean
          description: If true the request had an error.
        ErrorMessages:
          type: array
          description: List with the error messages
          xml:
            wrapped: true
          items:
            type: string
            xml:
              name: string
    CouponType:
      type: integer
      description: |-
        0 = FixedValue
        1 = Percent
        2 = FreeShipping
        3 = DiscountShipping
        4 = Others
      x-enumNames:
        - FixedValue
        - Percent
        - FreeShipping
        - DiscountShipping
        - Others
      enum:
        - 0
        - 1
        - 2
        - 3
        - 4
    ExternalCreateCustomerRequest:
      type: object
      description: Creater Customer body Request
      additionalProperties: false
      properties:
        OriginalId:
          type: string
          description: 'This is the Id in the client store. '
        Name:
          type: string
          description: Customer name.
        Email:
          type: string
          description: Customer email.
          nullable: true
        Phone:
          type: string
          description: Customer Contact Phone.
          nullable: true
        BirthdayDate:
          type: string
          description: Customer Birthdate.
          format: date-time
          nullable: true
        SignupDate:
          type: string
          description: Date when the customer made the register on client store.
          format: date-time
          nullable: true
        Document:
          type: string
          description: Some document number from the customer, accepts any string.
          nullable: true
        IsEnrolled:
          type: boolean
          description: >-
            If true the customer is participating on the points plan from the
            store.
        EnrolledDate:
          type: string
          description: >-
            Date when the customer made entered into the program. Use the
            OrderPlacementDate if not informed.
          format: date-time
          nullable: true
    CreateCouponResponse:
      type: object
      description: 'Create Coupon Response Model '
      additionalProperties: false
      properties:
        CouponCode:
          type: string
          description: Coupon Code
        CreatedDate:
          type: string
          description: 'Create Date '
          format: date-time
        IsUsed:
          type: boolean
          description: if true the coupon was already bein use or inactivated.
          nullable: true
        CouponValue:
          type: number
          description: Discount value for the coupon
          format: decimal
        CustomerId:
          type: integer
          description: the customer that the coupon is being given.
          format: int32
        ValidDateStart:
          type: string
          description: Date the coupon is start to being enable for rewards
          format: date-time
          nullable: true
        ValidDateEnd:
          type: string
          description: Date the coupon will not be able for rewards anymore.
          format: date-time
          nullable: true
        CouponType:
          description: >-
            What type of coupons is this.

            0: Cash value Coupon (such as R$10,00). 1: Percent discount (such as
            10%). 4: Imported Coupoun
          oneOf:
            - $ref: '#/components/schemas/CouponType'
  securitySchemes:
    Basic Authentication:
      type: http
      description: Use API Basic Auth Keys
      name: Basic Authentication
      in: header
      scheme: basic

````