> ## 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 custom objective.

> The objective is created for the store of the API key and is listed by the objectives list endpoints.
Use the returned Guid to reward customers through POST v1/pvt/Objectives/{guid}/importpoints.
            
This endpoint is not idempotent: each successful call creates a new objective.



## OpenAPI

````yaml https://api.bonifiq.com.br/swagger/Private%20APIs/swagger.json post /v1/pvt/Objectives/custom
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
    description: Production
  - url: https://backend--homolog.previewqa.bonifique.com.br
    description: Sandbox
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/Objectives/custom:
    post:
      tags:
        - Objectives
      summary: Creates a custom objective.
      description: >-
        The objective is created for the store of the API key and is listed by
        the objectives list endpoints.

        Use the returned Guid to reward customers through POST
        v1/pvt/Objectives/{guid}/importpoints.
                    
        This endpoint is not idempotent: each successful call creates a new
        objective.
      operationId: Objectives_CreateCustomObjective
      requestBody:
        x-name: request
        description: Custom objective data.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCustomObjectiveRequest'
        required: true
        x-position: 1
      responses:
        '200':
          description: The created custom objective, including its Guid.
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/BaseExternalApiResponseOfCreateCustomObjectiveResponse
      security:
        - Basic Authentication: []
components:
  schemas:
    CreateCustomObjectiveRequest:
      type: object
      description: >-
        Request to create a custom objective. Customers are rewarded later
        through the import points endpoint

        (POST v1/pvt/Objectives/{guid}/importpoints), using the Guid returned on
        creation.
      additionalProperties: false
      properties:
        Name:
          type: string
          description: Name of the objective. Required, up to 100 characters.
          nullable: true
        AmountOfPoints:
          type: integer
          description: >-
            Amount of points granted each time a customer completes the
            objective. Must be greater than zero.
          format: int32
        Active:
          type: boolean
          description: >-
            If false, the objective is created inactive and does not grant
            points. Defaults to true.
        CustomerMaxCompletion:
          type: integer
          description: >-
            Maximum number of times each customer can be rewarded by this
            objective.

            Null (default) means no limit; when informed it must be greater than
            zero.
          format: int32
          nullable: true
        ShowOnWidgetAndLandingPage:
          type: boolean
          description: >-
            If true, the objective card is shown on the widget and on the
            landing page. Defaults to false.
        IconUrl:
          type: string
          description: >-
            Optional icon shown on the objective card. Must be an absolute HTTPS
            URL with up to 2048 characters.
          nullable: true
        CardTitle:
          type: string
          description: >-
            Optional card title, up to 20 characters. The widget and the landing
            page show the card without a title when it is empty.
          nullable: true
        CardDescription:
          type: string
          description: >-
            Optional card description, up to 4000 characters. Accepts basic HTML
            (p, br, strong, b, em, i, u, ul, ol, li, a, img);

            any other tag, attribute or unsafe link is removed.
          nullable: true
        ActionButtonText:
          type: string
          description: >-
            Optional action button text, up to 10 characters. Must be informed
            together with ActionButtonUrl.
          nullable: true
        ActionButtonUrl:
          type: string
          description: >-
            Optional action button URL. Must be an absolute HTTP or HTTPS URL
            with up to 2048 characters and informed together with
            ActionButtonText.
          nullable: true
        NotifyCustomerWhenPointIsGiven:
          type: boolean
          description: >-
            If true, the customer is notified when points are granted by this
            objective. Defaults to false.
    BaseExternalApiResponseOfCreateCustomObjectiveResponse:
      type: object
      description: Standard response envelope used by the External API.
      additionalProperties: false
      properties:
        ErrorMessage:
          type: string
          description: >-
            Error message returned when the request fails validation or
            processing.

            For warnings and successful responses, consumers should usually
            inspect `Result`, `Code` and `Severity` first.
          nullable: true
        ErrorCode:
          type: integer
          description: >-
            Legacy numeric error code derived from internal API errors when
            available.

            This field is relevant only for error flows that use
            `ApiResponseErrorDescription`.
          format: int32
          nullable: true
        Result:
          description: Business payload returned by the endpoint.
          nullable: true
          oneOf:
            - $ref: '#/components/schemas/CreateCustomObjectiveResponse'
        Code:
          type: string
          description: >-
            Endpoint-specific business code formatted as a two-digit string,
            such as `03` or `07`.

            This field is available for success, warning and error outcomes.
          nullable: true
        CodeName:
          type: string
          description: >-
            Symbolic enum name associated with `Code`, such as
            `CheckoutNotFound`.
          nullable: true
        Severity:
          description: >-
            Final severity of the response.

            `Success` means the action completed as expected, `Warning` means
            the request was valid but the business outcome is informational or
            non-ideal, and `Error` means the request should be treated as a
            failure.
          oneOf:
            - $ref: '#/components/schemas/ExternalApiResponseSeverity'
        HasWarning:
          type: boolean
          description: >-
            Convenience flag that is `true` when `Severity` is `Warning`.

            Warnings are valid `200 OK` business outcomes and should not be
            handled as transport or validation errors.
        HasError:
          type: boolean
          description: >-
            Indicates whether the request failed and should be handled as an
            error response.

            This flag is reserved for real API errors; warnings must keep this
            property as `false`.
    CreateCustomObjectiveResponse:
      type: object
      description: Custom objective created through the External API.
      additionalProperties: false
      properties:
        Id:
          type: integer
          description: >-
            Identifier of the objective, the same returned as Id by the
            objectives list endpoints.
          format: int32
        Guid:
          type: string
          description: >-
            Identifier used to reward customers through POST
            v1/pvt/Objectives/{guid}/importpoints.
          format: guid
        Name:
          type: string
          description: Name of the objective.
        AmountOfPoints:
          type: integer
          description: >-
            Amount of points granted each time a customer completes the
            objective.
          format: int32
        Active:
          type: boolean
          description: If true, the objective is active and grants points.
        CustomerMaxCompletion:
          type: integer
          description: >-
            Maximum number of times each customer can be rewarded. Null means no
            limit.
          format: int32
          nullable: true
        ShowOnWidgetAndLandingPage:
          type: boolean
          description: >-
            If true, the objective card is shown on the widget and on the
            landing page.
        IconUrl:
          type: string
          description: Icon shown on the objective card.
          nullable: true
        CardTitle:
          type: string
          description: Card title.
          nullable: true
        CardDescription:
          type: string
          description: Card description, after HTML sanitization.
          nullable: true
        ActionButtonText:
          type: string
          description: Action button text.
          nullable: true
        ActionButtonUrl:
          type: string
          description: Action button URL.
          nullable: true
        NotifyCustomerWhenPointIsGiven:
          type: boolean
          description: >-
            If true, the customer is notified when points are granted by this
            objective.
        CreatedAt:
          type: string
          description: Creation date (UTC).
          format: date-time
          nullable: true
    ExternalApiResponseSeverity:
      type: integer
      description: |-
        0 = Success
        1 = Warning
        2 = Error
      x-enumNames:
        - Success
        - Warning
        - Error
      enum:
        - 0
        - 1
        - 2
  securitySchemes:
    Basic Authentication:
      type: http
      description: Use API Basic Auth Keys
      scheme: basic

````

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