---
title: "POST /api/public/purchases"
method: POST
path: "/api/public/purchases"
tags: ["Purchases"]
---

# POST /api/public/purchases

`POST /api/public/purchases`

Record a product purchase for a trainee. Credits, expiration and membership dates are derived from the product when omitted: a punch card opens with the product credits and a one-year expiration, a membership starts immediately for the product duration.

## Headers

- `Idempotency-Key` string

## Request body

- object
  - `traineeId` string, required — Trainee buying the product
  - `productId` string, required — Product to purchase. Must be active.
  - `purchaseAmount` number — Amount actually charged. Defaults to the product price.
  - `currency` 'ILS' | 'USD' | 'EUR' | 'GBP' — Defaults to ILS
  - `status` 'ACTIVE' | 'EXPIRED' | 'CANCELLED' | 'PENDING' | 'WAITING_FOR_PAYMENT' — Defaults to ACTIVE. Use WAITING_FOR_PAYMENT to record a purchase before payment clears.
  - `purchaseDate` string — Purchase date as YYYY-MM-DD or a full ISO-8601 date-time. Defaults to now. Use it to backdate an imported purchase.
  - `expirationDate` string — Expiration as YYYY-MM-DD or a full ISO-8601 date-time, and never before purchaseDate. Defaults to one year from now for punch cards. A date in the past is accepted for history imports; the purchase flips to EXPIRED the first time its credits are used.
  - `initialCredits` number — Punch card credits granted. PUNCH_CARD products only. Defaults to the product credits.
  - `remainingCredits` number — Credits still available, and never more than initialCredits. PUNCH_CARD products only. Defaults to initialCredits; set it lower to import a partly used card.

## Response `201`

Created

- object — Created
  - `data` object
    - `id` string
    - `coachId` string
    - `traineeId` string
    - `productId` string
    - `purchaseDate` string, date-time
    - `expirationDate` string, date-time
    - `purchaseAmount` number
    - `currency` 'ILS' | 'USD' | 'EUR' | 'GBP'
    - `status` 'ACTIVE' | 'EXPIRED' | 'CANCELLED' | 'PENDING' | 'WAITING_FOR_PAYMENT'
    - `initialCredits` number
    - `remainingCredits` number
    - `membershipStartDate` string, date-time
    - `membershipEndDate` string, date-time
    - `currentPeriodUsages` number
    - `periodResetDate` string, date-time
    - `createdAt` string, date-time
    - `updatedAt` string, date-time
  - `warnings` object[] — Non-fatal problems with follow-up writes. The resource was created, but each listed field was not applied.
    - `field` string
    - `message` string

## Other responses

- `400` — Default Response
- `401` — Default Response
- `403` — Default Response
- `404` — Default Response
- `409` — Default Response
- `429` — Default Response
- `500` — Default Response

---

[API](https://skmtc.dev/coach-platform/apis/coach-platform-api.md) · [All operations](https://skmtc.dev/coach-platform/apis/coach-platform-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/coach-platform/coach-platform-api/revisions/3d18b514ae8c/schema)
