LuckyFit API ## Sections • [LuckyFit Public Integration API](https://app.theneo.io/luckysoft/luckyfit-api/luckyfit-public-integration-api.md): LuckyFit public integration API. All endpoints are mounted under the `/api` prefix and require organization network-key authentication (`Api-Key` header). The key identifies the "network" (root organization) and may optionally restrict access to specific branches. Without a valid key the API returns `401 Unauthorized` with a body of `{ "success": false, "session_expired": true, ... }`. ### Response format Endpoints do not use HTTP status codes for business logic: on a validation error they typically return `200 OK` with `success: false` and a message in `error`. There are two envelopes: - **data envelope** (`send_data_response`): `{ success, data, error, total }`. - **crud envelope** (`send_crud_response`): `{ success, data, error, error_code, total, summary }`. ### Branch resolution (organization_id) For create/update operations, if `organization_id` is omitted the branch is resolved automatically: if the Api-Key is restricted to exactly one branch, that branch is used; if the network has exactly one branch, that branch is used; otherwise an explicit `organization_id` is required. • [Leads](https://app.theneo.io/luckysoft/luckyfit-api/leads.md): CRM leads / inquiries • [Create a lead (inquiry)](https://app.theneo.io/luckysoft/luckyfit-api/leads/create-a-lead-inquiry.md): Creates a new lead. The `name` field is required. The branch is resolved from `organization_id` or automatically (see the API description). • [Info sources](https://app.theneo.io/luckysoft/luckyfit-api/info-sources.md): Information sources • [List information sources](https://app.theneo.io/luckysoft/luckyfit-api/info-sources/list-information-sources.md) • [Memberships](https://app.theneo.io/luckysoft/luckyfit-api/memberships.md): Membership catalog (assortment) • [Membership catalog (assortment available for sale)](https://app.theneo.io/luckysoft/luckyfit-api/memberships/membership-catalog-assortment-available-for-sale.md): Returns the network's memberships available for sale. Supports filtering by sale/access branch, kind, subscription flag, and segment. With `detalization=true`, each membership also includes a `detalization` object with addons, step payments, and service payments. • [List access segments](https://app.theneo.io/luckysoft/luckyfit-api/memberships/list-access-segments.md) • [Addons](https://app.theneo.io/luckysoft/luckyfit-api/addons.md): Membership addons (available catalog and client purchases) • [Addons available for a membership](https://app.theneo.io/luckysoft/luckyfit-api/addons/addons-available-for-a-membership.md): Returns the addons offered for the given catalog membership (assortment plan), each with its price and a list of conditions (the addon's composition). • [Addons purchased on a client's membership](https://app.theneo.io/luckysoft/luckyfit-api/addons/addons-purchased-on-a-client-s-membership.md) • [Purchase an addon for a client's membership](https://app.theneo.io/luckysoft/luckyfit-api/addons/purchase-an-addon-for-a-client-s-membership.md): Registers an addon purchase for the client's membership. `addon_id` is required and must be one of the addons offered for the membership's plan. If `price` is omitted, the plan's addon price is used. • [Clients](https://app.theneo.io/luckysoft/luckyfit-api/clients.md): Clients • [Search clients](https://app.theneo.io/luckysoft/luckyfit-api/clients/search-clients.md): Returns up to 200 clients of the network, sorted by `id` descending. All filters are optional and combined with AND. `surname`/`name` match by prefix, `phone` is a partial match. • [Create a client](https://app.theneo.io/luckysoft/luckyfit-api/clients/create-a-client.md): `surname`, `name`, and `sex` are required. • [Update a client](https://app.theneo.io/luckysoft/luckyfit-api/clients/update-a-client.md) • [Delete a client](https://app.theneo.io/luckysoft/luckyfit-api/clients/delete-a-client.md) • [Client memberships](https://app.theneo.io/luckysoft/luckyfit-api/client-memberships.md): Memberships of a specific client • [Client's memberships](https://app.theneo.io/luckysoft/luckyfit-api/client-memberships/client-s-memberships.md) • [Sell a membership to a client](https://app.theneo.io/luckysoft/luckyfit-api/client-memberships/sell-a-membership-to-a-client.md): `membership_id` (a catalog membership ID) is required. • [Create a client and sell a membership](https://app.theneo.io/luckysoft/luckyfit-api/client-memberships/create-a-client-and-sell-a-membership.md): Creates a new client and sells a membership in a single atomic operation. If any step fails (client validation, membership sale, etc.), the entire operation is rolled back and nothing is persisted. Client fields can be sent at the top level or nested inside a `client` object (same as `POST /clients`). `surname`, `name`, and `sex` are required. Branch (`organization_id`) can be taken from the client block or from `sale_organization_id`. • [Validate a promocode / promo-action code](https://app.theneo.io/luckysoft/luckyfit-api/client-memberships/validate-a-promocode-promo-action-code.md): Checks whether `code` is a currently valid promocode or promo-action code for the given client and membership plan. The lookup applies the same rules used when selling a membership: - the code must be active (current time within the action's `start`/`finish` window); - per-client / one-time codes (`code_kind = 1`) are rejected if the client has already used them; - if the action restricts to membership segments, the plan (`ticket_id`) must match one of those segments; - codes tied to goods (`goods` set) are not valid for memberships. On success the `data` field holds the matching promo-action (with the resolved `code`); when the code is invalid `data` is `null` while `success` stays `true`. The returned `promoaction_id` / `code` can then be passed to `POST /clients/{client_id}/memberships`. • [Pay off membership debt](https://app.theneo.io/luckysoft/luckyfit-api/client-memberships/pay-off-membership-debt.md): If there is outstanding debt, redirects (302) to the payment page. If there is no debt or no account, returns `200` with `{ success: false, error }`. • [Organizations](https://app.theneo.io/luckysoft/luckyfit-api/organizations.md): Network organizations / branches • [List network branches](https://app.theneo.io/luckysoft/luckyfit-api/organizations/list-network-branches.md): Returns the child organizations (branches) of the current network. • [Terminal](https://app.theneo.io/luckysoft/luckyfit-api/terminal.md): Terminal operations (phone lookup, deposit top-up) • [Look up clients by phone number](https://app.theneo.io/luckysoft/luckyfit-api/terminal/look-up-clients-by-phone-number.md): The phone number must be longer than 10 digits. • [Top up a client's deposit](https://app.theneo.io/luckysoft/luckyfit-api/terminal/top-up-a-client-s-deposit.md) • [Accounting](https://app.theneo.io/luckysoft/luckyfit-api/accounting.md): Transaction export for accounting systems (1C) • [Export transactions for a period](https://app.theneo.io/luckysoft/luckyfit-api/accounting/export-transactions-for-a-period.md): Returns signed (`signed = 1`) transactions for the `[lodate, hidate]` period, with line-item details for membership payments, membership fees, and invoices.