← Platform API v1.32.0

POST /tenants/{tenantId}/pos/sessions

tenantPosPostSessions · POS

Human Supabase USER only; permissions sales.create. One open operator-bound session per register. Configuration immutable except archive without an open session. Checkout accepts only a confirmed Sales order matching entity/warehouse/list/currency, checks both versions and cash precision, and atomically delivers Sales, consumes Inventory reservations, inserts one immutable receipt with its payment components and increments the session version. The sale is collected in full with cash, transfer, debit or credit card, cheque or other methods, alone or mixed; components add up to the total exactly, change is given only in cash and is exact, and collections made on an external terminal or bank are recorded: no acquirer is contacted and no card number or security code is accepted. No partial delivery, credit sale, fiscal invoice, taxes, discount, rounding, FX or refunds. Cash entering or leaving the till outside a sale is a cash movement. Closing records expected cash (opening amount, cash portions of sales and cash movements; never cards or transfers), counted cash and signed variance; no reopening. All writes are idempotent and all reads/writes tenant scoped. Events expose IDs only.

Autenticación
SupabaseBearer · http bearer

Ejemplo

Los valores entre <> y {} son marcadores: sustitúyelos por los tuyos antes de ejecutarlo.

curl --request POST \
  --url 'https://api.marky.ec/v1/tenants/{tenantId}/pos/sessions' \
  --header 'Authorization: Bearer <SupabaseBearer>' \
  --header 'Idempotency-Key: <Idempotency-Key>' \
  --header 'Content-Type: application/json' \
  --data @body.json

Parámetros

Nombre En Tipo Descripción
tenantIdobligatorio path stringformato uuidpatrón ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-7[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$
Idempotency-Keyobligatorio header stringformato uuid UUIDv4/v7. Fresh user/membership/permissions before replay.

Cuerpo (obligatorio)

application/json
PosOpenInput
objectsin otras propiedades
  • registerIdobligatorio
    stringformato uuidpatrón ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-7[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$
  • openingAmountobligatorio
    stringpatrón ^[0-9]{1,12}(\.[0-9]{1,6})?$

    Exact nonnegative cash amount. At most12 integer digits and6 decimals; precision must be representable under register cashScale. No rounding or FX.

Respuestas

201 Success
application/json
PosSession
objectsin otras propiedades
  • idobligatorio
    stringformato uuidpatrón ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-7[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$
  • tenantIdobligatorio
    stringformato uuidpatrón ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-7[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$
  • registerIdobligatorio
    stringformato uuidpatrón ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-7[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$
  • operatorIdobligatorio
    stringformato uuidpatrón ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-7[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$
  • statusobligatorio
    uno de "OPEN", "CLOSED"
  • versionobligatorio
    integermín. 1
  • openingAmountobligatorio
    stringpatrón ^[0-9]{1,12}(\.[0-9]{1,6})?$

    Exact nonnegative cash amount. At most12 integer digits and6 decimals; precision must be representable under register cashScale. No rounding or FX.

  • expectedAmountobligatorio
    stringpatrón ^[0-9]{1,12}(\.[0-9]{1,6})?$

    Exact nonnegative cash amount. At most12 integer digits and6 decimals; precision must be representable under register cashScale. No rounding or FX.

  • countedAmountobligatorio
    string | null
  • varianceobligatorio
    string | null

    Signed countedAmount minus expectedAmount; closed snapshot.

  • closedAtobligatorio
    string | nullformato date-time
  • createdAtobligatorio
    stringformato date-time
  • updatedAtobligatorio
    stringformato date-time
  • collectedobligatorio
    objectsin otras propiedades

    Collected in the session with each method. Only cash counts for `expectedAmount`: cards and transfers are shown apart.

    • CASHobligatorio
      stringpatrón ^(0|[1-9][0-9]{0,11})(\.[0-9]{1,6})?$

      Exact amount: at most 12 integer digits and 6 decimals. No rounding, tax or FX.

    • TRANSFERobligatorio
      stringpatrón ^(0|[1-9][0-9]{0,11})(\.[0-9]{1,6})?$

      Exact amount: at most 12 integer digits and 6 decimals. No rounding, tax or FX.

    • CARDobligatorio
      stringpatrón ^(0|[1-9][0-9]{0,11})(\.[0-9]{1,6})?$

      Exact amount: at most 12 integer digits and 6 decimals. No rounding, tax or FX.

    • CHECKobligatorio
      stringpatrón ^(0|[1-9][0-9]{0,11})(\.[0-9]{1,6})?$

      Exact amount: at most 12 integer digits and 6 decimals. No rounding, tax or FX.

    • OTHERobligatorio
      stringpatrón ^(0|[1-9][0-9]{0,11})(\.[0-9]{1,6})?$

      Exact amount: at most 12 integer digits and 6 decimals. No rounding, tax or FX.

  • cashInobligatorio
    stringpatrón ^(0|[1-9][0-9]{0,11})(\.[0-9]{1,6})?$

    Cash that entered the till outside a sale.

  • cashOutobligatorio
    stringpatrón ^(0|[1-9][0-9]{0,11})(\.[0-9]{1,6})?$

    Cash that left the till outside a sale.

400 Invalid request/idempotency key
application/problem+json
ProblemDetails
objectsin otras propiedades
  • typeobligatorio
    valor fijo "about:blank"
  • statusobligatorio
    integer
  • codeobligatorio
    string
  • titleobligatorio
    string
  • detailobligatorio
    string
  • requestIdobligatorio
    stringformato uuid
  • errors
    arrayelementos máx. 200

    Where each problem is, for the codes that can say it: a JSON pointer into the request or the record (`/items/0/devices/1/imei1`) and the reason. A line of a serialized article that is short of units also says how many it bills and how many are identified. Never a value typed by the user, and never an identifier of a unit.

    Cada elemento
    objectsin otras propiedades
    • pointerobligatorio
      string
    • codeobligatorio
      string
    • required
      integermín. 0máx. 1000

      For a line short of units (UNITS_DIFFER_FROM_QUANTITY, RECEIPT_REQUIRED, DELIVERY_REQUIRED): how many units the line bills.

    • identified
      integermín. 0máx. 1000

      For the same line: how many units are identified and linked to it. Given to every reader of the document; no IMEI or serial number is.

401 Missing/invalid Supabase JWT
application/problem+json
ProblemDetails
objectsin otras propiedades
  • typeobligatorio
    valor fijo "about:blank"
  • statusobligatorio
    integer
  • codeobligatorio
    string
  • titleobligatorio
    string
  • detailobligatorio
    string
  • requestIdobligatorio
    stringformato uuid
  • errors
    arrayelementos máx. 200

    Where each problem is, for the codes that can say it: a JSON pointer into the request or the record (`/items/0/devices/1/imei1`) and the reason. A line of a serialized article that is short of units also says how many it bills and how many are identified. Never a value typed by the user, and never an identifier of a unit.

    Cada elemento
    objectsin otras propiedades
    • pointerobligatorio
      string
    • codeobligatorio
      string
    • required
      integermín. 0máx. 1000

      For a line short of units (UNITS_DIFFER_FROM_QUANTITY, RECEIPT_REQUIRED, DELIVERY_REQUIRED): how many units the line bills.

    • identified
      integermín. 0máx. 1000

      For the same line: how many units are identified and linked to it. Given to every reader of the document; no IMEI or serial number is.

403 Wrong identity family, permissions or session operator
application/problem+json
ProblemDetails
objectsin otras propiedades
  • typeobligatorio
    valor fijo "about:blank"
  • statusobligatorio
    integer
  • codeobligatorio
    string
  • titleobligatorio
    string
  • detailobligatorio
    string
  • requestIdobligatorio
    stringformato uuid
  • errors
    arrayelementos máx. 200

    Where each problem is, for the codes that can say it: a JSON pointer into the request or the record (`/items/0/devices/1/imei1`) and the reason. A line of a serialized article that is short of units also says how many it bills and how many are identified. Never a value typed by the user, and never an identifier of a unit.

    Cada elemento
    objectsin otras propiedades
    • pointerobligatorio
      string
    • codeobligatorio
      string
    • required
      integermín. 0máx. 1000

      For a line short of units (UNITS_DIFFER_FROM_QUANTITY, RECEIPT_REQUIRED, DELIVERY_REQUIRED): how many units the line bills.

    • identified
      integermín. 0máx. 1000

      For the same line: how many units are identified and linked to it. Given to every reader of the document; no IMEI or serial number is.

404 Unknown tenant resource
application/problem+json
ProblemDetails
objectsin otras propiedades
  • typeobligatorio
    valor fijo "about:blank"
  • statusobligatorio
    integer
  • codeobligatorio
    string
  • titleobligatorio
    string
  • detailobligatorio
    string
  • requestIdobligatorio
    stringformato uuid
  • errors
    arrayelementos máx. 200

    Where each problem is, for the codes that can say it: a JSON pointer into the request or the record (`/items/0/devices/1/imei1`) and the reason. A line of a serialized article that is short of units also says how many it bills and how many are identified. Never a value typed by the user, and never an identifier of a unit.

    Cada elemento
    objectsin otras propiedades
    • pointerobligatorio
      string
    • codeobligatorio
      string
    • required
      integermín. 0máx. 1000

      For a line short of units (UNITS_DIFFER_FROM_QUANTITY, RECEIPT_REQUIRED, DELIVERY_REQUIRED): how many units the line bills.

    • identified
      integermín. 0máx. 1000

      For the same line: how many units are identified and linked to it. Given to every reader of the document; no IMEI or serial number is.

409 Version, state, cash, precision, inventory or duplicate receipt conflict
application/problem+json
ProblemDetails
objectsin otras propiedades
  • typeobligatorio
    valor fijo "about:blank"
  • statusobligatorio
    integer
  • codeobligatorio
    string
  • titleobligatorio
    string
  • detailobligatorio
    string
  • requestIdobligatorio
    stringformato uuid
  • errors
    arrayelementos máx. 200

    Where each problem is, for the codes that can say it: a JSON pointer into the request or the record (`/items/0/devices/1/imei1`) and the reason. A line of a serialized article that is short of units also says how many it bills and how many are identified. Never a value typed by the user, and never an identifier of a unit.

    Cada elemento
    objectsin otras propiedades
    • pointerobligatorio
      string
    • codeobligatorio
      string
    • required
      integermín. 0máx. 1000

      For a line short of units (UNITS_DIFFER_FROM_QUANTITY, RECEIPT_REQUIRED, DELIVERY_REQUIRED): how many units the line bills.

    • identified
      integermín. 0máx. 1000

      For the same line: how many units are identified and linked to it. Given to every reader of the document; no IMEI or serial number is.

429 Rate/quota exceeded
application/problem+json
ProblemDetails
objectsin otras propiedades
  • typeobligatorio
    valor fijo "about:blank"
  • statusobligatorio
    integer
  • codeobligatorio
    string
  • titleobligatorio
    string
  • detailobligatorio
    string
  • requestIdobligatorio
    stringformato uuid
  • errors
    arrayelementos máx. 200

    Where each problem is, for the codes that can say it: a JSON pointer into the request or the record (`/items/0/devices/1/imei1`) and the reason. A line of a serialized article that is short of units also says how many it bills and how many are identified. Never a value typed by the user, and never an identifier of a unit.

    Cada elemento
    objectsin otras propiedades
    • pointerobligatorio
      string
    • codeobligatorio
      string
    • required
      integermín. 0máx. 1000

      For a line short of units (UNITS_DIFFER_FROM_QUANTITY, RECEIPT_REQUIRED, DELIVERY_REQUIRED): how many units the line bills.

    • identified
      integermín. 0máx. 1000

      For the same line: how many units are identified and linked to it. Given to every reader of the document; no IMEI or serial number is.

503 Runtime/auth/governance unavailable
application/problem+json
ProblemDetails
objectsin otras propiedades
  • typeobligatorio
    valor fijo "about:blank"
  • statusobligatorio
    integer
  • codeobligatorio
    string
  • titleobligatorio
    string
  • detailobligatorio
    string
  • requestIdobligatorio
    stringformato uuid
  • errors
    arrayelementos máx. 200

    Where each problem is, for the codes that can say it: a JSON pointer into the request or the record (`/items/0/devices/1/imei1`) and the reason. A line of a serialized article that is short of units also says how many it bills and how many are identified. Never a value typed by the user, and never an identifier of a unit.

    Cada elemento
    objectsin otras propiedades
    • pointerobligatorio
      string
    • codeobligatorio
      string
    • required
      integermín. 0máx. 1000

      For a line short of units (UNITS_DIFFER_FROM_QUANTITY, RECEIPT_REQUIRED, DELIVERY_REQUIRED): how many units the line bills.

    • identified
      integermín. 0máx. 1000

      For the same line: how many units are identified and linked to it. Given to every reader of the document; no IMEI or serial number is.