palbaseDocs

Palbase IAP · API

PUT/iap/customers/{customer_id}/limits/{limit_key}

Set a customer's own limit

Sets what each window of a limit allows one customer — more for a customer support looks after, less for one who abuses it — in place of what their products give, until expires_at or until cleared, saying why. Use already counted in the window stays counted. A customer not seen before is made; a guest merged into an account sets the account's. Answers the limit as it stands for them now. Emits iap.customer.changed.

Called by your server, with the project's secret key.

Path

customer_idstring · requiredThe customer: the user's id (a guest merged into an account names the account).
limit_keystring · requiredThe limit (a key of the catalog's limits).

Headers

Idempotency-Keystring · optionalMakes the write safe to send again (at most 255 characters). A retry with the same key and the same request gets the first answer back, marked `Idempotent-Replayed: true`, and changes nothing; the same key with a different request is refused with 422, and while the first request still runs a retry gets 409 with Retry-After. Answers are kept for 24 hours.

Request body

expires_atstring (date-time) · optionalWhen it ends, in the future; absent: until it is cleared.
maxinteger · requiredWhat a window allows them.
reasonstring · requiredWhy: the record.
curl
curl -X PUT "https://<your-ref>.palbase.studio/iap/customers/<customer_id>/limits/<limit_key>" \
  -H "apikey: $PALBASE_SECRET_KEY" \
  -H "content-type: application/json" \
  -d '{"max":0,"reason":"string"}'

Responses

200The limit, as it stands for them now

400No `max` (`invalid_max`), no reason, or one over 500 characters (`reason_required`), `expires_at` is not in the future (`expires_in_past`), or a field out of its bounds (`invalid_<field>`)

401No key, not a key of this project, or a token that is not valid (the edge's answer)

403Not the project's secret key (`secret_key_required`)

404The catalog defines no such limit (`limit_not_found`), or the customer's id is longer than a customer's (`customer_not_found`)

409A request with this Idempotency-Key is still running (`idempotency_key_in_use`, Retry-After)

410The user was deleted (`customer_erased`): their id is no customer's again

413The request body is too large (`request_too_large`)

422The Idempotency-Key was sent with a different request (`idempotency_key_reused`)

429Over the project's request limit; Retry-After says when to try again

503Another change to this customer is in progress (`customer_busy`), or the platform could not answer now; retrying is safe after Retry-After

defaultAn error: the envelope names it (`error`) and explains it (`error_description`).

Operation SetCustomerLimit of iap's contract.