swagger: "2.0"
schemes:
  - https
host: api.koomalooma.com
basePath: /api
info:
  contact:
    email: support@koomalooma.com
    x-twitter: koomalooma_biz
  description: This is the koomalooma Partner API. koomalooma is the first Loyalty BPaaS (Business Process as a Service) for mobile and web companies. With koomalooma merchants issue points for actions their customers / users make on your mobile or web store, for example a purchase or a referral. koomalooma takes care of all the rest, from signing up users, keeping track of points and delivering rewards in over 80 countries. koomalooma offers an easy to integrate API and web backend to configure loyalty campaigns and track performance. You can find more at http://support.koomalooma.com
  termsOfService: https://partner.koomalooma.com/terms
  title: koomalooma Partner API
  version: "1.0"
  x-apisguru-categories:
    - ecommerce
  x-logo:
    url: https://twitter.com/koomalooma/profile_image?size=original
  x-origin:
    - format: swagger
      url: https://api.koomalooma.com/oas
      version: "2.0"
  x-providerName: koomalooma.com
externalDocs:
  url: http://support.koomalooma.com
produces:
  - application/json
securityDefinitions:
  api_key:
    description: Authenticate using the JWT token assigned to you by your koomalooma technical support specialist
    in: header
    name: X-KoomaLooma-JWT
    type: apiKey
security:
  - api_key: []
paths:
  /users:
    post:
      responses:
        "201":
          description: Created
          schema:
            $ref: "#/definitions/User"
        "400":
          description: Bad Request
        "403":
          description: Forbidden
      security:
        - api_key: []
      summary: Create a User
  "/users/{user_id}/commitments":
    post:
      parameters:
        - description: user_id of the user to assign points to
          in: path
          name: user_id
          required: true
          type: string
        - in: body
          name: commitmentRequest
          required: true
          schema:
            $ref: "#/definitions/CommitmentRequest"
      responses:
        "201":
          description: Created
          schema:
            $ref: "#/definitions/Commitment"
        "400":
          description: Bad Request
        "403":
          description: Forbidden
      summary: Assign points to a User
definitions:
  Commitment:
    properties:
      confirmation_status:
        enum:
          - pending
          - confirmed
        type: string
      created_at:
        default: 2016-12-31T12:34:56+00:00
        format: date-time
        type: string
      free_loyalty_units:
        format: int32
        type: integer
      goal:
        $ref: "#/definitions/Goal"
      id:
        type: string
      loyalty_accumulation_value:
        type: string
      loyalty_units:
        format: int32
        type: integer
      partner_id:
        type: string
      promotion_goal_category:
        type: string
      promotion_goal_description:
        type: string
      redeemable_loyalty_units:
        format: int32
        type: integer
      redeemed:
        type: boolean
      redeemed_loyalty_units:
        format: int32
        type: integer
      updated_at:
        default: 2016-12-31T12:34:56+00:00
        format: date-time
        type: string
      user_id:
        type: string
    required:
      - id
      - loyalty_units
      - free_loyalty_units
      - loyalty_accumulation_value
      - user_id
      - partner_id
      - goal
      - redeemable_loyalty_units
      - redeemed_loyalty_units
      - redeemed
      - confirmation_status
      - promotion_goal_description
      - promotion_goal_category
      - created_at
      - updated_at
    type: object
  CommitmentRequest:
    properties:
      campaign_id:
        type: string
      promotion_goal_category:
        type: string
      promotion_goal_description:
        type: string
      transaction_value:
        type: string
    required:
      - campaign_id
      - transaction_value
      - promotion_goal_description
      - promotion_goal_category
    type: object
  Goal:
    properties:
      type:
        type: string
      value:
        type: string
    required:
      - type
      - value
    type: object
  User:
    properties:
      partner_id:
        description: Your partner_id. You can use the value of data-partner-id parameter
        type: string
      partner_user_id:
        description: A unique string that identify your customer. !!IMPORTANT!! You should use always the same partner_user_id for the same customer
        type: string
      user_session_id:
        description: A unique string that identify the current user session. !!IMPORTANT!! This value should be the same set in %%sessionId%% of koomalooma javascript
        type: string
    required:
      - partner_id
      - partner_user_id
      - user_session_id
    type: object
