> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gomarketbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a new service

> A service is the umbrella record; the sellable variants hang off it as offerings, and only an offering carries price and duration. So a service on its own sells nothing — create at least one offering before publishing. The new service is always DRAFT regardless of what you send; publish it with POST /services/{serviceId}/status. Names must be unique within the project per language, compared with case, accents and punctuation normalised away, so a near-duplicate is a 409 rather than a second service. `businessModels` and `attributes` can be supplied inline here instead of as follow-up calls. `bufferBeforeStartMinutes` (0-120, default 0) is spacing before the service starts, for suggestions and checks only. `newCategory` is written in a separate transaction BEFORE the service, and is not rolled back if the service write then fails — after any error here, retry with `categoryId` pointing at the category that was already created, not `newCategory` again.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/projects/{projectId}/services
openapi: 3.0.0
info:
  title: MarketBox 2.0 Open API
  version: 1.0.0
  description: >-
    The MarketBox public API for building booking experiences. Core model:
    create an order, then draw its order items down into bookings. Single
    bookings reference an order item per service line; package bookings draw one
    PACKAGE item down across N sessions. To schedule a package, build a slate
    (POST /availability/package-slate) and book it by slateId (POST
    /orders/{orderId}/package-bookings). See the guides for end-to-end
    walkthroughs.
  contact:
    name: MarketBox support
servers:
  - url: https://apiv2.gomarketbox.com
    description: MarketBox Open API
security:
  - ApiKeyAuth: []
paths:
  /v1/projects/{projectId}/services:
    post:
      tags:
        - Services
      summary: Create a new service
      description: >-
        A service is the umbrella record; the sellable variants hang off it as
        offerings, and only an offering carries price and duration. So a service
        on its own sells nothing — create at least one offering before
        publishing. The new service is always DRAFT regardless of what you send;
        publish it with POST /services/{serviceId}/status. Names must be unique
        within the project per language, compared with case, accents and
        punctuation normalised away, so a near-duplicate is a 409 rather than a
        second service. `businessModels` and `attributes` can be supplied inline
        here instead of as follow-up calls. `bufferBeforeStartMinutes` (0-120,
        default 0) is spacing before the service starts, for suggestions and
        checks only. `newCategory` is written in a separate transaction BEFORE
        the service, and is not rolled back if the service write then fails —
        after any error here, retry with `categoryId` pointing at the category
        that was already created, not `newCategory` again.
      parameters:
        - schema:
            type: string
            minLength: 1
            description: >-
              The project (tenant) that owns the resource. Every resource in
              this API is scoped to a project, and your API key is restricted to
              the projects it was issued for — a project outside that scope
              returns 403.
            example: prj_01kv60qgnef2kt3pvqgwmkbzfr
          required: true
          description: >-
            The project (tenant) that owns the resource. Every resource in this
            API is scoped to a project, and your API key is restricted to the
            projects it was issued for — a project outside that scope returns
            403.
          name: projectId
          in: path
      requestBody:
        description: Service data
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: object
                  additionalProperties:
                    type: string
                description:
                  type: object
                  additionalProperties:
                    type: string
                  default: {}
                primaryLanguage:
                  type: string
                  minLength: 1
                categoryId:
                  type: string
                newCategory:
                  type: object
                  properties:
                    name:
                      type: object
                      additionalProperties:
                        type: string
                    primaryLanguage:
                      type: string
                      minLength: 1
                  required:
                    - name
                    - primaryLanguage
                taxSettings:
                  type: object
                  properties:
                    taxable:
                      type: boolean
                    taxPercentage:
                      type: number
                      minimum: 0
                  default:
                    taxable: false
                  required:
                    - taxable
                participantSettings:
                  $ref: '#/components/schemas/ParticipantSettings'
                bufferBeforeStartMinutes:
                  type: integer
                  minimum: 0
                  maximum: 120
                  default: 0
                  description: >-
                    Minutes a supplier needs free before this service starts.
                    Used for suggestions and checks only, never as busy time.
                  example: 10
                businessModels:
                  type: array
                  items:
                    type: object
                    properties:
                      type:
                        type: string
                        enum:
                          - SINGLE_BOOKING
                          - PACKAGE
                          - SCHEDULED_PACKAGE
                          - SCHEDULED_SUBSCRIPTION
                          - FLEXIBLE_SUBSCRIPTION
                        description: >-
                          How the service is sold. SINGLE_BOOKING is one booking
                          at a time; PACKAGE sells prepaid credits drawn down by
                          later bookings; the SCHEDULED_* and FLEXIBLE_*
                          variants add recurrence and subscription billing. This
                          drives which order item skuType applies.
                      paymentOptions:
                        type: array
                        items:
                          type: string
                          enum:
                            - PAY_WHILE_BOOKING
                            - PAY_AFTER_SERVICE_DELIVERED
                            - NO_PAYMENT
                            - PAY_FULL_PRICE_WHILE_PURCHASING
                            - PAY_BEGINNING_OF_MONTH
                            - PAY_END_OF_MONTH
                        minItems: 1
                      fees:
                        type: array
                        items:
                          type: object
                          properties:
                            feeId:
                              type: string
                              minLength: 1
                              description: >-
                                Stable identifier for this fee, unique within
                                the business model.
                              example: fee_booking
                            name:
                              type: object
                              additionalProperties:
                                type: string
                              description: >-
                                Buyer-facing label, rendered as its own line on
                                the order summary.
                              example:
                                en: Booking fee
                            calculation:
                              type: string
                              enum:
                                - FLAT
                                - PERCENT
                              description: >-
                                How a service fee is calculated. FLAT charges a
                                fixed amount; PERCENT charges a percentage of
                                the pre-tax total of the lines the fee governs.
                              example: FLAT
                            amount:
                              type: integer
                              minimum: 0
                              description: >-
                                FLAT fees only. Integer minor units, charged in
                                whatever currency the order is placed in — 2500
                                is CA$25.00 on a CAD order and US$25.00 on a USD
                                one. Use a PERCENT fee if you need it to scale.
                              example: 2500
                            percentage:
                              type: number
                              minimum: 0
                              maximum: 100
                              description: >-
                                PERCENT fees only. Applied to the pre-tax total
                                of this business model's lines on the order.
                              example: 5
                            taxable:
                              type: boolean
                              default: false
                              description: >-
                                When true, the fee is taxed at the rate of the
                                order lines it is charged alongside (sessions or
                                packages sold under this business model) that
                                are taxed at a positive rate. Lines that are not
                                taxable or taxed at 0% lend no rate; if none of
                                the lines is taxed, the fee is not taxed either.
                              example: false
                          required:
                            - feeId
                            - name
                            - calculation
                        maxItems: 20
                        default: []
                        description: >-
                          Service fees — additional charges attached to this
                          business model, applied to any order line sold under
                          it. Each fee applies once per order regardless of how
                          many lines it governs, and appears as its own entry on
                          the order summary rather than being folded into tax.
                        example:
                          - feeId: fee_booking
                            name:
                              en: Booking fee
                            calculation: FLAT
                            amount: 2500
                            taxable: false
                          - feeId: fee_admin
                            name:
                              en: Admin fee
                            calculation: PERCENT
                            percentage: 5
                            taxable: true
                      config:
                        type: object
                        properties: {}
                        default: {}
                        additionalProperties:
                          nullable: true
                    required:
                      - type
                      - paymentOptions
                  default: []
                attributes:
                  type: array
                  items:
                    type: object
                    properties:
                      name:
                        type: object
                        additionalProperties:
                          type: string
                      attributeType:
                        type: string
                        enum:
                          - STRING
                          - NUMBER
                          - ENUM
                        description: >-
                          Value type of a service attribute. ENUM attributes
                          carry an allowed-values list.
                      enumValues:
                        type: array
                        items:
                          type: object
                          properties:
                            valueId:
                              type: string
                              minLength: 1
                            label:
                              type: object
                              additionalProperties:
                                type: string
                          required:
                            - valueId
                            - label
                      sortOrder:
                        type: integer
                        minimum: 0
                        default: 0
                    required:
                      - name
                      - attributeType
                  default: []
              required:
                - name
                - primaryLanguage
      responses:
        '201':
          description: Service created
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      entityType:
                        type: string
                        enum:
                          - SERVICE
                      projectId:
                        type: string
                      serviceId:
                        type: string
                      categoryId:
                        type: string
                      categorySnapshot:
                        type: object
                        properties:
                          categoryId:
                            type: string
                          primaryName:
                            type: string
                          primaryNameNormalized:
                            type: string
                        required:
                          - categoryId
                          - primaryName
                          - primaryNameNormalized
                      name:
                        type: object
                        additionalProperties:
                          type: string
                      description:
                        type: object
                        additionalProperties:
                          type: string
                      primaryLanguage:
                        type: string
                      primaryName:
                        type: string
                      primaryNameNormalized:
                        type: string
                      status:
                        type: string
                        enum:
                          - DRAFT
                          - LIVE
                          - INACTIVE
                        description: >-
                          Lifecycle of the service. Only LIVE services are
                          bookable; DRAFT is unpublished and INACTIVE is
                          retired.
                      taxSettings:
                        type: object
                        properties:
                          taxable:
                            type: boolean
                          taxPercentage:
                            type: number
                            minimum: 0
                        required:
                          - taxable
                      participantSettings:
                        $ref: '#/components/schemas/ParticipantSettings'
                      bufferBeforeStartMinutes:
                        type: integer
                        minimum: 0
                        maximum: 120
                      counts:
                        type: object
                        properties:
                          offerings:
                            type: integer
                            minimum: 0
                        required:
                          - offerings
                      deleted:
                        type: boolean
                      createdAt:
                        type: string
                        format: date-time
                      updatedAt:
                        type: string
                        format: date-time
                      createdBy:
                        type: string
                      updatedBy:
                        type: string
                    required:
                      - entityType
                      - projectId
                      - serviceId
                      - categoryId
                      - categorySnapshot
                      - name
                      - description
                      - primaryLanguage
                      - primaryName
                      - primaryNameNormalized
                      - status
                      - taxSettings
                      - counts
                      - deleted
                      - createdAt
                      - updatedAt
                      - createdBy
                      - updatedBy
                required:
                  - data
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '403':
          description: API key cannot access this project
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '409':
          description: Duplicate name
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
components:
  schemas:
    ParticipantSettings:
      type: object
      properties:
        supplier:
          type: object
          properties:
            canCancelBookings:
              type: boolean
              description: Suppliers can cancel upcoming sessions they are assigned to.
              example: false
            cancelNoticeHours:
              type: integer
              minimum: 0
              maximum: 8760
              description: >-
                Minimum hours before the session starts that this action is
                still allowed. 0 = allowed any time before the start.
              example: 24
            canRescheduleBookings:
              type: boolean
              description: >-
                Suppliers can move an upcoming session to another time (same
                supplier).
              example: true
            rescheduleNoticeHours:
              type: integer
              minimum: 0
              maximum: 8760
              description: >-
                Minimum hours before the session starts that this action is
                still allowed. 0 = allowed any time before the start.
              example: 24
            canSeeClientLastName:
              type: boolean
              description: >-
                When false, suppliers see the client first name and last initial
                only.
              example: true
            canSeeClientEmail:
              type: boolean
              description: Suppliers can see the client email address.
              example: false
            canSeeClientPhone:
              type: boolean
              description: Suppliers can see the client phone number.
              example: false
          required:
            - canCancelBookings
            - cancelNoticeHours
            - canRescheduleBookings
            - rescheduleNoticeHours
            - canSeeClientLastName
            - canSeeClientEmail
            - canSeeClientPhone
          description: What suppliers may do with, and see on, bookings of this service.
          example:
            canCancelBookings: false
            cancelNoticeHours: 24
            canRescheduleBookings: true
            rescheduleNoticeHours: 24
            canSeeClientLastName: true
            canSeeClientEmail: false
            canSeeClientPhone: false
        client:
          type: object
          properties:
            canRescheduleBookings:
              type: boolean
              description: >-
                Clients can move their own upcoming sessions to another
                available time.
              example: true
            rescheduleNoticeHours:
              type: integer
              minimum: 0
              maximum: 8760
              description: >-
                Minimum hours before the session starts that this action is
                still allowed. 0 = allowed any time before the start.
              example: 24
            participantDisplay:
              type: string
              enum:
                - HIDDEN
                - FIRST_NAME
                - FULL
              description: >-
                How participants are named to clients on their own bookings:
                FULL (full names), FIRST_NAME (first names only) or HIDDEN (no
                names; a count such as "2 participants").
              example: FULL
          required:
            - canRescheduleBookings
            - rescheduleNoticeHours
          description: >-
            What clients may do with, and see on, their own bookings of this
            service. Clients cannot cancel.
          example:
            canRescheduleBookings: true
            rescheduleNoticeHours: 24
            participantDisplay: FULL
      required:
        - supplier
        - client
      description: >-
        Participant interaction settings: what suppliers and clients may do
        with, and see on, bookings of this service. Replaced whole on update —
        send every field, except `client.participantDisplay`: omitted, it keeps
        its stored value. Enforced for supplier- and client-role callers;
        API-key (integrator) calls act for the business and are not restricted
        by it.
      example:
        supplier:
          canCancelBookings: false
          cancelNoticeHours: 24
          canRescheduleBookings: true
          rescheduleNoticeHours: 24
          canSeeClientLastName: true
          canSeeClientEmail: false
          canSeeClientPhone: false
        client:
          canRescheduleBookings: true
          rescheduleNoticeHours: 24
          participantDisplay: FULL
    ErrorMessage:
      type: object
      properties:
        code:
          type: string
          description: Stable machine-readable error code, e.g. NOT_FOUND.
        message:
          type: string
          description: Human-readable description of what went wrong.
        statusCode:
          type: integer
          description: The HTTP status code of this response.
        requestId:
          type: string
          description: >-
            The id of this request, also returned as the X-Request-Id header.
            Quote it in a support ticket.
      required:
        - code
        - message
        - statusCode
        - requestId
      example:
        code: NOT_FOUND
        message: Booking not found
        statusCode: 404
        requestId: a3f1c2de-9b64-4a2f-8f0e-5c9d1b7a2e10
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        API key minted in the MarketBox dashboard. Scope is restricted to the
        projects you select at creation time. Every route needs the key's
        standard API access (`*`) except `POST /v1/projects/{projectId}/events`,
        which needs `events:write`; a key without `*` is refused with 403
        `CAPABILITY_NOT_GRANTED`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.