# Create membership type

Creates a membership type at the chain level. Membership types define reusable packages
(e.g., "10 visits", "Monthly unlimited") that can be sold at the chain's Locations.
Omitted optional fields take their defaults.
**Covered services.** At least one service or service category is required. Which fields
the backend reads depends on whether the chain has the unlimited memberships feature:
- Without it:
`services`
 and
`service_categories`
, objects that map an ID to a number of visits,

e.g.
`{"13160808": 5}`
.
- With it:
`service_links`
, an array of
`{service_id, service_category_id, is_unlimited, count}`
 items.

The form that does not match the chain is silently ignored. A request that sends both
`service_links` and `services` or `service_categories` is rejected with `422`.
**Note:** Requires chain-level permissions.

Endpoint: POST /chains/{chain_id}/loyalty/membership_types
Version: 1.0.0
Security: BearerPartnerUser

## Security:

  - `BearerPartnerUser` (unknown)
    http bearer Bearer {PartnerToken}, User {UserToken}

## Path parameters:

  - `chain_id` (integer, required)
    Chain ID

## Header parameters:

  - `Accept` (string, required)

  - `Content-Type` (string, required)

  - `Authorization` (string, required)
    Bearer {partner_token}, User {user_token}

## Request fields (application/json):

  - `title` (string, required)
    Membership type name
    Example: Fitness 10-pack

  - `chain_id` (integer, required)
    Chain ID
    Example: 706028

  - `category_id` (integer | null)
    ID of the membership type category the type is grouped under; `null` leaves it uncategorized.
    Example: null

  - `cost` (number, required)
    Membership price. Must be greater than 0.
    Example: 500

  - `location_ids` (array)
    IDs of the chain Locations where this membership type is sold
    Example: [4564,703092]

  - `period` (integer)
    Validity period length in `period_unit_id` units; `0` = no expiry
    Example: 30

  - `period_unit_id` (integer)
    Period unit: 1 = day, 2 = week, 3 = month, 4 = year
    Enum: "1", "2", "3", "4"

  - `allow_freeze` (boolean)
    Whether memberships of this type can be frozen. Not allowed when `period` is `0`.
    Example: true

  - `freeze_limit` (integer)
    Maximum total freeze period in `freeze_limit_unit_id` units
    Example: 14

  - `freeze_limit_unit_id` (integer)
    Freeze period unit: 1 = day, 2 = week, 3 = month, 4 = year
    Enum: "1", "2", "3", "4"

  - `is_booking_when_frozen_allowed` (boolean)
    Whether a Booking User can book online while their membership is frozen
    Example: false

  - `service_price_correction` (boolean)
    Whether the service price is recalculated when paying with the membership. Not allowed for unlimited memberships.
    Example: false

  - `expiration_type_id` (integer)
    When the validity period starts:
- `1`
 = at the first visit (default)
- `2`
 = at the sale

A type with `category` = `auto_renewal` requires `2`.
    Enum: "1", "2"

  - `is_allow_empty_code` (boolean)
    Whether the membership is personal:
- `true`
 = only the Booking User who bought it, matched by phone number, can use it, and no membership number is needed
- `false`
 = paying with the membership requires its number
    Example: false

  - `is_united_balance` (boolean)
    Balance model: true = one shared balance for all covered services, false = a separate balance per service or category
    Example: false

  - `united_balance_services_count` (integer)
    Number of visits in the shared balance. Required above `0` when `is_united_balance` is `true`, unless `is_united_balance_unlimited` is `true`; ignored for a separate balance.
    Example: 10

  - `is_united_balance_unlimited` (boolean)
    Whether the shared balance is unlimited. Needs the chain's unlimited memberships feature, `is_united_balance` = `true`, `united_balance_services_count` = `0` and a non-zero `period`.
    Example: false

  - `balance_edit_type_id` (integer)
    Where a membership balance can be edited manually:
- `0`
 = balance edits are not allowed (default)
- `1`
 = only at the Location that sold the membership
- `2`
 = at every Location of the chain
    Enum: "0", "1", "2"

  - `is_online_sale_enabled` (boolean)
    Whether the type is sold online. When `true`, `online_sale_price` must be greater than 0.
    Example: false

  - `online_sale_title` (string)
    Membership type title for online sale
    Example: Fitness Pack - 10 sessions

  - `online_sale_description` (string)
    Membership type description for online sale
    Example: Perfect for beginners. Valid for 3 months.

  - `online_sale_price` (number)
    Price for online sale
    Example: 450

  - `online_image` (string)
    Image for online sale as a base64 data URI (`data:image/png;base64,...`). Empty or omitted keeps the current image.
    Example: data:image/png;base64,iVBORw0KGgo=

  - `delete_online_image` (boolean)
    Whether to delete the current online sale image
    Example: false

  - `autoactivation_period` (integer)
    For a type whose validity starts at the first visit, activates an unused membership after this period in `autoactivation_time_unit_id` units; `0` = never. Returned as `autoactivation_time`.
    Example: 10

  - `autoactivation_time_unit_id` (integer)
    Autoactivation period unit: 1 = day, 2 = week, 3 = month, 4 = year
    Enum: "1", "2", "3", "4"

  - `is_archived` (boolean)
    Whether the membership type is archived
    Example: false

  - `category` (string)
    Membership type kind: `standard` or `auto_renewal`
    Enum: "standard", "auto_renewal"

  - `services` (object)
    Covered services for a chain without the unlimited memberships feature: service ID mapped to the number of visits.
For a shared balance the counts are ignored (set them to `0`).
Ignored for a chain with the feature; cannot be sent together with `service_links`.
    Example: {"13160808":5,"13160809":3}

  - `service_categories` (object)
    Covered service categories for a chain without the unlimited memberships feature: category ID mapped to the number of visits.
For a shared balance the counts are ignored (set them to `0`).
Ignored for a chain with the feature; cannot be sent together with `service_links`.
    Example: {"13160806":10}

  - `service_links` (array)
    Covered services and categories for a chain with the unlimited memberships feature.
Ignored for a chain without the feature; cannot be sent together with `services` or `service_categories`.
Each item sets either `service_id` or `service_category_id` and leaves the other `null`.
For a shared balance, every item has `count` = `0` and `is_unlimited` = `false`;
for a separate balance, every item is either unlimited or has `count` above `0`.
    Example: [{"service_id":13160808,"service_category_id":null,"is_unlimited":false,"count":5},{"service_id":null,"service_category_id":13160806,"is_unlimited":true,"count":0}]

  - `service_links.service_id` (integer | null, required)
    Service ID, or `null` for a category link
    Example: 13160808

  - `service_links.service_category_id` (integer | null, required)
    Service category ID, or `null` for a service link
    Example: null

  - `service_links.is_unlimited` (boolean, required)
    Whether visits to this service or category are unlimited. Requires a non-zero `period`.
    Example: false

  - `service_links.count` (integer, required)
    Number of visits to this service or category
    Example: 5

  - `availability` (array)
    When the membership can be used. Each rule lists week days and time intervals. An empty array removes all rules (usable any time); omitting the field keeps the current rules.
    Example: [{"week_days":[1,2,3,4,5],"intervals":[{"from":28800,"to":64800}]}]

  - `availability.week_days` (array, required)
    Days of the week the rule applies to: 1 = Monday … 7 = Sunday
    Example: [1,2,3]

  - `availability.intervals` (array, required)
    Time intervals on those days

  - `availability.intervals.from` (integer, required)
    Interval start in seconds from midnight, a multiple of 300
    Example: 28800

  - `availability.intervals.to` (integer, required)
    Interval end in seconds from midnight, a multiple of 300
    Example: 64800

## Response 200:

  - `200` (unknown)
    Membership type created successfully

## Response 200 fields (application/json):

  - `success` (boolean)
    Example: true

  - `data` (object)
    Chain-level membership type object

  - `data.id` (integer)
    Membership type ID
    Example: 777

  - `data.salon_group_id` (integer)
    Chain ID where membership type is available
    Example: 333

  - `data.category_id` (integer | null)
    ID of the membership type category the type is grouped under (null if uncategorized)
    Example: null

  - `data.title` (string)
    Membership type name
    Example: 10-visit membership

  - `data.period` (integer)
    Validity period (0 if not set)
    Example: 10

  - `data.period_unit_id` (integer)
    Period unit: 1 = day, 2 = week, 3 = month, 4 = year, 0 = not set
    Example: 3

  - `data.allow_freeze` (boolean)
    Whether freezing is allowed
    Example: true

  - `data.freeze_limit` (integer)
    Maximum total freeze period
    Example: 30

  - `data.freeze_limit_unit_id` (integer)
    Freeze period unit: 1 = day, 2 = week, 3 = month, 4 = year
    Example: 1

  - `data.is_booking_when_frozen_allowed` (boolean)
    Whether a Booking User can book online while their membership is frozen
    Example: false

  - `data.is_allow_empty_code` (boolean)
    Personal membership: true = only the Booking User who bought it, matched by phone number, uses it without a number; false = paying with it requires the membership number
    Example: false

  - `data.is_united_balance` (boolean)
    Balance type: true = unified, false = separate
    Example: true

  - `data.is_united_balance_unlimited` (boolean)
    Whether unified balance is unlimited
    Example: false

  - `data.is_code_required` (boolean)
    Whether paying with the membership requires its number; the opposite of `is_allow_empty_code`
    Example: true

  - `data.balance_edit_type_id` (integer)
    Where a membership balance can be edited manually: 0 = not allowed, 1 = only at the Location that sold the membership, 2 = at every Location of the chain
    Enum: "0", "1", "2"

  - `data.cost` (number)
    Membership price
    Example: 1000

  - `data.chain_price_min` (number)
    Minimum price across chain locations
    Example: 1000

  - `data.chain_price_max` (number)
    Maximum price across chain locations
    Example: 1500

  - `data.is_chain` (boolean)
    Whether this is a chain-level membership type
    Example: true

  - `data.expiration_type_id` (integer)
    When the validity period starts: 1 = at the first visit, 2 = at the sale
    Example: 1

  - `data.expiration_type_title` (string)
    Human-readable name of `expiration_type_id`
    Example: During the first visit

  - `data.category` (object | null | string)
    Membership type kind: `standard` or `auto_renewal`
    Example: standard

  - `data.weight` (integer)
    Sort order weight
    Example: 0

  - `data.abonements_count` (integer)
    Number of active memberships of this type
    Example: 0

  - `data.is_online_sale_enabled` (boolean)
    Online sale: true = enabled, false = disabled
    Example: false

  - `data.online_sale_title` (string)
    Title for online sale
    Example: 10-visit membership

  - `data.online_sale_description` (string)
    Description for online sale
    Example: Sold online with discount

  - `data.online_sale_price` (number)
    Price for online sale
    Example: 550

  - `data.service_price_correction` (boolean)
    Whether service price can be adjusted when applying membership
    Example: true

  - `data.united_balance_services_count` (integer)
    Number of visits for unified balance
    Example: 10

  - `data.autoactivation_time` (integer)
    Period after which an unused membership is activated automatically, in `autoactivation_time_unit_id` units; `0` = never. Set with `autoactivation_period` in the request.
    Example: 10

  - `data.autoactivation_time_unit_id` (integer)
    Autoactivation period unit: 1 = day, 2 = week, 3 = month, 4 = year
    Example: 1

  - `data.attached_location_ids` (array)
    List of location IDs attached to this membership type
    Example: [1,2,3]

  - `data.attached_salon_ids` (array)
    Alternative name for attached_location_ids
    Example: [1,2,3]

  - `data.online_sale_image` (string | null)
    Image URL for online sale
    Example: https://example.com/images/subscription_type.png

  - `data.is_archived` (boolean)
    Whether membership type is archived
    Example: false

  - `data.date_archived` (string | null)
    Date when membership type was archived
    Example: null

  - `data.availability` (array)
    Time-based availability rules
    Example: [{"week_days":[1,2,3],"intervals":[{"from":3600,"to":7200},{"from":10800,"to":14400}]},{"week_days":[6,7],"intervals":[{"from":36000,"to":72000}]}]

  - `data.availability.week_days` (array)
    Days of week: 1 = Monday, 7 = Sunday
    Example: [1,2,3]

  - `data.availability.intervals` (array)
    Time intervals (seconds from midnight)

  - `data.availability.intervals.from` (integer)
    Interval start
    Example: 3600

  - `data.availability.intervals.to` (integer)
    Interval end
    Example: 7200

  - `data.balance_container` (object)
    Container with attached services and/or categories and their balance

  - `data.balance_container.links` (array)

  - `data.balance_container.links.count` (integer)
    Number of visits for this service/category
    Example: 10

  - `data.balance_container.links.is_unlimited` (boolean)
    Whether count is unlimited
    Example: false

  - `data.balance_container.links.service` (object)
    Service details (if link is to a service)

  - `data.balance_container.links.service.id` (integer)
    Example: 45

  - `data.balance_container.links.service.is_category` (boolean)
    Example: false

  - `data.balance_container.links.service.category_id` (integer)
    Example: 90

  - `data.balance_container.links.service.title` (string)
    Example: Service in location

  - `data.balance_container.links.service.online_sale_title` (string)
    Online sale title for service

  - `data.balance_container.links.service.is_chain` (boolean)
    Whether service belongs to chain
    Example: false

  - `data.balance_container.links.service.chain_price_min` (number)
    Minimum service price across chain
    Example: 0

  - `data.balance_container.links.service.chain_price_max` (number)
    Maximum service price across chain
    Example: 0

  - `data.balance_container.links.service.category` (object)

  - `data.balance_container.links.service.category.id` (integer)
    Example: 90

  - `data.balance_container.links.service.category.is_category` (boolean)
    Example: true

  - `data.balance_container.links.service.category.category_id` (integer)
    Example: 1

  - `data.balance_container.links.service.category.title` (string)
    Example: First service category in location

  - `data.balance_container.links.service.category.online_sale_title` (string)
    Online sale title for category

  - `data.balance_container.links.service.category.is_chain` (boolean)
    Whether category belongs to chain
    Example: false

  - `data.balance_container.links.service.category.chain_price_min` (number)
    Minimum price across chain
    Example: 0

  - `data.balance_container.links.service.category.chain_price_max` (number)
    Maximum price across chain
    Example: 0

  - `data.balance_container.links.service.category.category` (any)

  - `data.balance_container.links.service.category.category.id` (integer)

  - `data.balance_container.links.service.category.category.category_id` (integer)

  - `data.balance_container.links.service.category.category.is_category` (boolean)

  - `data.balance_container.links.service.category.category.title` (string)

  - `data.balance_container.links.service.category.category.online_sale_title` (string)

  - `data.balance_container.links.category` (object)
    Category details (if link is to a category)

  - `data.balance_container.links.category.id` (integer)
    Example: 91

  - `data.balance_container.links.category.is_category` (boolean)
    Example: true

  - `data.balance_container.links.category.category_id` (integer)
    Example: 1

  - `data.balance_container.links.category.title` (string)
    Example: Second service category in location

  - `data.balance_container.links.category.online_sale_title` (string)
    Online sale title for category

  - `data.balance_container.links.category.is_chain` (boolean)
    Whether category belongs to chain
    Example: false

  - `data.balance_container.links.category.chain_price_min` (number)
    Minimum price across chain
    Example: 0

  - `data.balance_container.links.category.chain_price_max` (number)
    Maximum price across chain
    Example: 0

  - `data.balance_container.links.category.category` (any)

  - `data.balance_container.links.category.category.id` (integer)

  - `data.balance_container.links.category.category.category_id` (integer)

  - `data.balance_container.links.category.category.is_category` (boolean)

  - `data.balance_container.links.category.category.title` (string)

  - `data.balance_container.links.category.category.online_sale_title` (string)

  - `meta` (array)
    Example: []

## Response 201:

  - `201` (unknown)
    Membership type created successfully (alternate code)

## Response 201 fields (application/json):

  - `success` (boolean)
    Example: true

  - `data` (object)
    Chain-level membership type object

  - `data.id` (integer)
    Membership type ID
    Example: 777

  - `data.salon_group_id` (integer)
    Chain ID where membership type is available
    Example: 333

  - `data.category_id` (integer | null)
    ID of the membership type category the type is grouped under (null if uncategorized)
    Example: null

  - `data.title` (string)
    Membership type name
    Example: 10-visit membership

  - `data.period` (integer)
    Validity period (0 if not set)
    Example: 10

  - `data.period_unit_id` (integer)
    Period unit: 1 = day, 2 = week, 3 = month, 4 = year, 0 = not set
    Example: 3

  - `data.allow_freeze` (boolean)
    Whether freezing is allowed
    Example: true

  - `data.freeze_limit` (integer)
    Maximum total freeze period
    Example: 30

  - `data.freeze_limit_unit_id` (integer)
    Freeze period unit: 1 = day, 2 = week, 3 = month, 4 = year
    Example: 1

  - `data.is_booking_when_frozen_allowed` (boolean)
    Whether a Booking User can book online while their membership is frozen
    Example: false

  - `data.is_allow_empty_code` (boolean)
    Personal membership: true = only the Booking User who bought it, matched by phone number, uses it without a number; false = paying with it requires the membership number
    Example: false

  - `data.is_united_balance` (boolean)
    Balance type: true = unified, false = separate
    Example: true

  - `data.is_united_balance_unlimited` (boolean)
    Whether unified balance is unlimited
    Example: false

  - `data.is_code_required` (boolean)
    Whether paying with the membership requires its number; the opposite of `is_allow_empty_code`
    Example: true

  - `data.balance_edit_type_id` (integer)
    Where a membership balance can be edited manually: 0 = not allowed, 1 = only at the Location that sold the membership, 2 = at every Location of the chain
    Enum: "0", "1", "2"

  - `data.cost` (number)
    Membership price
    Example: 1000

  - `data.chain_price_min` (number)
    Minimum price across chain locations
    Example: 1000

  - `data.chain_price_max` (number)
    Maximum price across chain locations
    Example: 1500

  - `data.is_chain` (boolean)
    Whether this is a chain-level membership type
    Example: true

  - `data.expiration_type_id` (integer)
    When the validity period starts: 1 = at the first visit, 2 = at the sale
    Example: 1

  - `data.expiration_type_title` (string)
    Human-readable name of `expiration_type_id`
    Example: During the first visit

  - `data.category` (object | null | string)
    Membership type kind: `standard` or `auto_renewal`
    Example: standard

  - `data.weight` (integer)
    Sort order weight
    Example: 0

  - `data.abonements_count` (integer)
    Number of active memberships of this type
    Example: 0

  - `data.is_online_sale_enabled` (boolean)
    Online sale: true = enabled, false = disabled
    Example: false

  - `data.online_sale_title` (string)
    Title for online sale
    Example: 10-visit membership

  - `data.online_sale_description` (string)
    Description for online sale
    Example: Sold online with discount

  - `data.online_sale_price` (number)
    Price for online sale
    Example: 550

  - `data.service_price_correction` (boolean)
    Whether service price can be adjusted when applying membership
    Example: true

  - `data.united_balance_services_count` (integer)
    Number of visits for unified balance
    Example: 10

  - `data.autoactivation_time` (integer)
    Period after which an unused membership is activated automatically, in `autoactivation_time_unit_id` units; `0` = never. Set with `autoactivation_period` in the request.
    Example: 10

  - `data.autoactivation_time_unit_id` (integer)
    Autoactivation period unit: 1 = day, 2 = week, 3 = month, 4 = year
    Example: 1

  - `data.attached_location_ids` (array)
    List of location IDs attached to this membership type
    Example: [1,2,3]

  - `data.attached_salon_ids` (array)
    Alternative name for attached_location_ids
    Example: [1,2,3]

  - `data.online_sale_image` (string | null)
    Image URL for online sale
    Example: https://example.com/images/subscription_type.png

  - `data.is_archived` (boolean)
    Whether membership type is archived
    Example: false

  - `data.date_archived` (string | null)
    Date when membership type was archived
    Example: null

  - `data.availability` (array)
    Time-based availability rules
    Example: [{"week_days":[1,2,3],"intervals":[{"from":3600,"to":7200},{"from":10800,"to":14400}]},{"week_days":[6,7],"intervals":[{"from":36000,"to":72000}]}]

  - `data.availability.week_days` (array)
    Days of week: 1 = Monday, 7 = Sunday
    Example: [1,2,3]

  - `data.availability.intervals` (array)
    Time intervals (seconds from midnight)

  - `data.availability.intervals.from` (integer)
    Interval start
    Example: 3600

  - `data.availability.intervals.to` (integer)
    Interval end
    Example: 7200

  - `data.balance_container` (object)
    Container with attached services and/or categories and their balance

  - `data.balance_container.links` (array)

  - `data.balance_container.links.count` (integer)
    Number of visits for this service/category
    Example: 10

  - `data.balance_container.links.is_unlimited` (boolean)
    Whether count is unlimited
    Example: false

  - `data.balance_container.links.service` (object)
    Service details (if link is to a service)

  - `data.balance_container.links.service.id` (integer)
    Example: 45

  - `data.balance_container.links.service.is_category` (boolean)
    Example: false

  - `data.balance_container.links.service.category_id` (integer)
    Example: 90

  - `data.balance_container.links.service.title` (string)
    Example: Service in location

  - `data.balance_container.links.service.online_sale_title` (string)
    Online sale title for service

  - `data.balance_container.links.service.is_chain` (boolean)
    Whether service belongs to chain
    Example: false

  - `data.balance_container.links.service.chain_price_min` (number)
    Minimum service price across chain
    Example: 0

  - `data.balance_container.links.service.chain_price_max` (number)
    Maximum service price across chain
    Example: 0

  - `data.balance_container.links.service.category` (object)

  - `data.balance_container.links.service.category.id` (integer)
    Example: 90

  - `data.balance_container.links.service.category.is_category` (boolean)
    Example: true

  - `data.balance_container.links.service.category.category_id` (integer)
    Example: 1

  - `data.balance_container.links.service.category.title` (string)
    Example: First service category in location

  - `data.balance_container.links.service.category.online_sale_title` (string)
    Online sale title for category

  - `data.balance_container.links.service.category.is_chain` (boolean)
    Whether category belongs to chain
    Example: false

  - `data.balance_container.links.service.category.chain_price_min` (number)
    Minimum price across chain
    Example: 0

  - `data.balance_container.links.service.category.chain_price_max` (number)
    Maximum price across chain
    Example: 0

  - `data.balance_container.links.service.category.category` (any)

  - `data.balance_container.links.service.category.category.id` (integer)

  - `data.balance_container.links.service.category.category.category_id` (integer)

  - `data.balance_container.links.service.category.category.is_category` (boolean)

  - `data.balance_container.links.service.category.category.title` (string)

  - `data.balance_container.links.service.category.category.online_sale_title` (string)

  - `data.balance_container.links.category` (object)
    Category details (if link is to a category)

  - `data.balance_container.links.category.id` (integer)
    Example: 91

  - `data.balance_container.links.category.is_category` (boolean)
    Example: true

  - `data.balance_container.links.category.category_id` (integer)
    Example: 1

  - `data.balance_container.links.category.title` (string)
    Example: Second service category in location

  - `data.balance_container.links.category.online_sale_title` (string)
    Online sale title for category

  - `data.balance_container.links.category.is_chain` (boolean)
    Whether category belongs to chain
    Example: false

  - `data.balance_container.links.category.chain_price_min` (number)
    Minimum price across chain
    Example: 0

  - `data.balance_container.links.category.chain_price_max` (number)
    Maximum price across chain
    Example: 0

  - `data.balance_container.links.category.category` (any)

  - `data.balance_container.links.category.category.id` (integer)

  - `data.balance_container.links.category.category.category_id` (integer)

  - `data.balance_container.links.category.category.is_category` (boolean)

  - `data.balance_container.links.category.category.title` (string)

  - `data.balance_container.links.category.category.online_sale_title` (string)

  - `meta` (array)
    Example: []

## Response 400:

  - `400` (unknown)
    The type settings are rejected, for example a zero `cost` or no covered services; `meta.message` explains why

## Response 400 fields (application/json):

  - `success` (boolean)
    Example: false

  - `data` (null)

  - `meta` (object)

## Response 401:

  - `401` (unknown)
    Unauthorized

## Response 401 fields (application/json):

  - `success` (boolean)
    Example: false

  - `data` (null)

  - `meta` (object)

## Response 403:

  - `403` (unknown)
    Forbidden - insufficient permissions

## Response 403 fields (application/json):

  - `success` (boolean)
    Example: false

  - `data` (null)

  - `meta` (object)

## Response 404:

  - `404` (unknown)
    Chain not found

## Response 404 fields (application/json):

  - `success` (boolean)
    Example: false

  - `data` (null)

  - `meta` (object)

## Response 422:

  - `422` (unknown)
    Validation error

## Response 422 fields (application/json):

  - `success` (boolean)
    Example: false

  - `data` (null)

  - `meta` (object)

  - `meta.message` (string)

  - `meta.errors` (object)

