Open Loyalty Points API

Points transfers - the loyalty points ledger.

OpenAPI Specification

open-loyalty-points-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Open Loyalty REST Authorization Points API
  version: '1.0'
  description: API-first, headless loyalty and gamification platform. This document models a representative, grounded subset of the Open Loyalty REST API across members (customers), transactions, points transfers, reward campaigns, levels (tiers), and earning rules. Endpoints are scoped per store using a storeCode path segment. Open Loyalty is delivered as managed cloud SaaS on a per-tenant instance, so the server host below is a template - substitute your own Open Loyalty instance host. Requests and responses are JSON over HTTPS, authenticated with a JWT bearer token or a permanent API token.
  contact:
    name: Open Loyalty
    url: https://www.openloyalty.io
  license:
    name: Open Loyalty (Open Source Edition Apache-2.0 / Enterprise SaaS)
    url: https://github.com/OpenLoyalty
servers:
- url: https://{instance}.openloyalty.io/api
  description: Per-tenant Open Loyalty instance (substitute your own host).
  variables:
    instance:
      default: your-instance
      description: Your Open Loyalty tenant subdomain.
security:
- bearerAuth: []
- permanentToken: []
tags:
- name: Points
  description: Points transfers - the loyalty points ledger.
paths:
  /{storeCode}/points/transfer:
    get:
      operationId: listPointsTransfers
      tags:
      - Points
      summary: List points transfers
      parameters:
      - $ref: '#/components/parameters/StoreCode'
      - $ref: '#/components/parameters/Page'
      - $ref: '#/components/parameters/PerPage'
      responses:
        '200':
          description: A paginated list of points transfers.
  /{storeCode}/points/transfer/add:
    post:
      operationId: addPoints
      tags:
      - Points
      summary: Add (award) points to a member
      parameters:
      - $ref: '#/components/parameters/StoreCode'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PointsTransfer'
      responses:
        '200':
          description: Points awarded.
  /{storeCode}/points/transfer/spend:
    post:
      operationId: spendPoints
      tags:
      - Points
      summary: Spend (deduct) points from a member
      parameters:
      - $ref: '#/components/parameters/StoreCode'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PointsTransfer'
      responses:
        '200':
          description: Points spent.
  /{storeCode}/customer/points/p2p-transfer:
    post:
      operationId: p2pTransferPoints
      tags:
      - Points
      summary: Transfer points peer-to-peer between members
      parameters:
      - $ref: '#/components/parameters/StoreCode'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                receiver:
                  type: string
                points:
                  type: number
      responses:
        '200':
          description: Points transferred.
  /{storeCode}/points/transfer/{transfer}/cancel:
    post:
      operationId: cancelPointsTransfer
      tags:
      - Points
      summary: Cancel a points transfer
      parameters:
      - $ref: '#/components/parameters/StoreCode'
      - name: transfer
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Points transfer cancelled.
components:
  parameters:
    PerPage:
      name: perPage
      in: query
      schema:
        type: integer
        default: 10
    Page:
      name: page
      in: query
      schema:
        type: integer
        default: 1
    StoreCode:
      name: storeCode
      in: path
      required: true
      description: The store the request is scoped to.
      schema:
        type: string
        default: DEFAULT
  schemas:
    PointsTransfer:
      type: object
      properties:
        customer:
          type: string
        points:
          type: number
        comment:
          type: string
        validityDuration:
          type: integer
      required:
      - customer
      - points
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 'JWT obtained from POST /admin/login_check (admin) or POST /{storeCode}/customer/login_check (member), sent as Authorization: Bearer <token>.'
    permanentToken:
      type: apiKey
      in: header
      name: X-AUTH-TOKEN
      description: Permanent API token issued to an admin account.
externalDocs:
  description: Open Loyalty REST API reference
  url: https://docs.openloyalty.io/en/latest/api/