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

# Create a points transaction

> Add or remove points from a customer's points balance by creating a points transaction.

export const scope_0 = "points_transaction:write"

<Callout icon="key" iconType="regular">
  This endpoint requires the **{scope_0}** scope.
</Callout>

Points transactions that would result in a negative points balance will be rejected. To issue points as a reward for completing an action, use the [create an activity](/api/resources/activities/create-activity) endpoint instead.


## OpenAPI

````yaml schemas/rest-api.json POST /points_transactions
openapi: 3.1.0
info:
  title: Smile.io REST API
  version: 1.0.0
  description: A RESTful interface for interacting with Smile.io loyalty programs.
servers:
  - url: https://api.smile.io/v1
security:
  - bearerAuth: []
paths:
  /points_transactions:
    post:
      tags:
        - Points Transactions
      summary: Create a points transaction
      description: >-
        Add or remove points from a customer's points balance by creating a
        points transaction.
      operationId: post__points_transactions
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                points_transaction:
                  type: object
                  properties:
                    customer_id:
                      type: integer
                      example: 304169228
                      description: >-
                        The ID of the customer whose balance this points
                        transaction applies to.
                    points_change:
                      type: integer
                      example: 100
                      description: >-
                        The number of points added or removed from the
                        customer's points balance. The value is positive if
                        points were added to the customer's balance and negative
                        if points were deducted.
                    description:
                      type: string
                      example: Points correction
                      description: >-
                        A message visible to the customer that describes the
                        reason for the points change.
                    internal_note:
                      type: string
                      description: >-
                        A note that is visible to the merchant. This note should
                        never be visible to customers.
                      example: 'Due to issue with order #6834'
                  required:
                    - customer_id
                    - points_change
              required:
                - points_transaction
      responses:
        '201':
          description: The points transaction was successfully created.
          content:
            application/json:
              schema:
                type: object
                properties:
                  points_transaction:
                    $ref: '#/components/schemas/PointsTransaction'
components:
  schemas:
    PointsTransaction:
      type: object
      properties:
        id:
          type: integer
          example: 825673452
          description: Unique identifier for the points transaction.
        customer_id:
          type: integer
          example: 304169228
          description: >-
            The ID of the customer whose balance this points transaction applies
            to.
        points_change:
          type: integer
          example: 100
          description: >-
            The number of points added or removed from the customer's points
            balance. The value is positive if points were added to the
            customer's balance and negative if points were deducted.
        description:
          type: string
          example: Points correction
          description: >-
            A message visible to the customer that describes the reason for the
            points change.
        internal_note:
          type:
            - string
            - 'null'
          example: 'Due to issue with order #6834'
          description: >-
            A note that is visible to the merchant. This note should never be
            visible to customers.
        created_at:
          type: string
          format: date-time
          example: '2024-12-07T20:15:27.893Z'
          description: The date and time when the points transaction was created.
        updated_at:
          type: string
          format: date-time
          example: '2024-12-07T20:15:27.893Z'
          description: The date and time when the points transaction was last updated.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````