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

# Add a guest to a session

> Creates a guest user called `name`, adds them to the booking's guests and checks them in to the
session with this check-in code. `name` is required here and must not be blank.
On a booking with several tables, `pool_table_id` or `pool_table_public_id` chooses the guest's table
(`pool_table_id` wins when both are sent); without either, the guest joins the table with the fewest players.
On a booking with one table the guest always joins that table.

**Who can call it:** Game Host, Venue Admin, Brand Admin or Organization Admin with access to the venue. Also the machine key.



## OpenAPI

````yaml /openapi.yaml post /session-players/guest
openapi: 3.1.0
info:
  description: >-
    Authenticated endpoints need a bearer token: `Authorization: Bearer
    <token>`.

    Each endpoint says whether it needs one. Public endpoints need none.

    A person sends the token they signed in with. A machine, such as a Billy Q
    box, sends its machine key the same way.

    Each endpoint ends with who can call it, and "Who can call what" lists every
    endpoint against every role.


    Every response is wrapped the same way: `status` is always present
    (`success` or `error`),

    `message` carries text that is safe to show a user, and `data` holds the
    payload on success.

    One exception: a 410 for a session that has ended carries the status
    `ended`.


    Money is in minor units (pence). Timestamps are RFC 3339 in UTC. Dates are
    `YYYY-MM-DD`.
  title: CueBridge API
  version: 0.1.0
servers:
  - description: Pre-production
    url: https://api.preprod.poolhouse.dev/api
security: []
tags:
  - description: Confirmed bookings at a venue.
    name: Bookings
  - description: A booking's time at its tables, from check-in to the end of play.
    name: Sessions
  - description: The players checked in to a session.
    name: Session players
  - description: Games played during a session, and the game types a venue offers.
    name: Games
  - description: Shots recorded during a game, and the ratings derived from them.
    name: Game shots
  - description: Per-player statistics and the stat types they are measured in.
    name: Stats
  - description: A venue's pool tables.
    name: Pool tables
  - description: The items placed on a venue's floor plan.
    name: Floor plan
  - description: Achievements players have earned.
    name: Achievements
paths:
  /session-players/guest:
    post:
      tags:
        - Session players
      summary: Add a guest to a session
      description: >-
        Creates a guest user called `name`, adds them to the booking's guests
        and checks them in to the

        session with this check-in code. `name` is required here and must not be
        blank.

        On a booking with several tables, `pool_table_id` or
        `pool_table_public_id` chooses the guest's table

        (`pool_table_id` wins when both are sent); without either, the guest
        joins the table with the fewest players.

        On a booking with one table the guest always joins that table.


        **Who can call it:** Game Host, Venue Admin, Brand Admin or Organization
        Admin with access to the venue. Also the machine key.
      operationId: createGuestSessionPlayer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/handlers.sessionPlayerRequestBody'
        description: The guest to add
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/api.ResponseOf-handlers_sessionPlayerResponse
          description: The new session player.
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api.Response'
          description: >-
            The body failed validation, `name` is blank or was rejected as
            inappropriate, the booking has no tables, or the table given is not
            one of the booking's tables.
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api.Response'
          description: The bearer token is missing, invalid or expired.
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api.Response'
          description: >-
            The caller may not add players at this venue, or the session already
            has as many players as the booking's guest count.
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api.Response'
          description: >-
            No session has this check-in code, the session was removed while the
            guest was being added, or it has no booking.
        '410':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api.Response'
          description: The session has ended. The response's `status` is `ended`.
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api.Response'
          description: Something went wrong on our side.
      security:
        - BearerAuth: []
components:
  schemas:
    handlers.sessionPlayerRequestBody:
      properties:
        check_in_code:
          type: string
        name:
          description: >-
            The player's display name. Required when adding a guest; optional
            when checking in.
          type: string
        pool_table_id:
          description: The pool table to put the player on, by id. Optional.
          format: uuid
          type: string
        pool_table_public_id:
          description: >-
            The pool table to put the player on, by public id such as
            "PHSGBLLS01". Optional.
          type: string
      required:
        - check_in_code
      type: object
    api.ResponseOf-handlers_sessionPlayerResponse:
      properties:
        data:
          allOf:
            - $ref: '#/components/schemas/handlers.sessionPlayerResponse'
          description: The payload. Left out when there is none.
        message:
          description: Text that is safe to show a user. Left out when there is none.
          type: string
        status:
          allOf:
            - $ref: '#/components/schemas/api.Status'
          description: >-
            `success` or `error`. A 410 for a session that has ended says
            `ended` instead.
      type: object
    api.Response:
      properties:
        data:
          description: The payload. Left out when there is none.
        message:
          description: Text that is safe to show a user. Left out when there is none.
          type: string
        status:
          allOf:
            - $ref: '#/components/schemas/api.Status'
          description: >-
            `success` or `error`. A 410 for a session that has ended says
            `ended` instead.
      type: object
    handlers.sessionPlayerResponse:
      properties:
        has_cheated:
          type: boolean
        id:
          format: uuid
          type: string
        is_deleted:
          type: boolean
        player_index:
          type: integer
        pool_table:
          $ref: '#/components/schemas/handlers.sessionPlayerPoolTableResponse'
        pool_table_id:
          format: uuid
          type:
            - string
            - 'null'
        ratings:
          $ref: '#/components/schemas/models.PlayerRatings'
        session_id:
          format: uuid
          type: string
        user:
          $ref: '#/components/schemas/models.User'
      type: object
    api.Status:
      enum:
        - success
        - error
        - ended
      type: string
      x-enum-varnames:
        - StatusSuccess
        - StatusError
        - StatusEnded
    handlers.sessionPlayerPoolTableResponse:
      properties:
        id:
          format: uuid
          type: string
        public_id:
          type: string
        table_alias:
          type: string
      type: object
    models.PlayerRatings:
      properties:
        latest:
          $ref: '#/components/schemas/models.RatingSnapshot'
        previous:
          $ref: '#/components/schemas/models.RatingSnapshot'
      type: object
    models.User:
      properties:
        acquisition_campaign:
          description: >-
            Free-text detail under `acquisition_source`: the campaign, partner
            or event that brought the

            person in. Left out when the channel has no finer detail. Set once,
            with the source, and

            never changed.
          type: string
        acquisition_source:
          description: >-
            The channel this person first came through: `newsletter`, `enquiry`,
            `app`, `staff`,

            `paid_social`, `partner` or `event`. Set once, when the user is
            created, and never changed.

            Left out when it is not known.
          type: string
        auth0_user_id:
          type:
            - string
            - 'null'
        created_at:
          format: date-time
          type: string
        display_name:
          type:
            - string
            - 'null'
        email:
          type: string
        first_name:
          type: string
        id:
          format: uuid
          type: string
        last_name:
          type: string
        marketing_opt_in:
          type: boolean
        phone:
          type: string
        profile_picture_url:
          type: string
        updated_at:
          format: date-time
          type: string
        user_type:
          allOf:
            - $ref: '#/components/schemas/models.UserType'
          description: 'The kind of user: `primary`, `linked` or `guest`.'
        workos_user_id:
          type:
            - string
            - 'null'
      type: object
    models.RatingSnapshot:
      properties:
        game_id:
          format: uuid
          type: string
        rating:
          type: number
        shots_played:
          type: integer
      type: object
    models.UserType:
      enum:
        - primary
        - linked
        - guest
      type: string
      x-enum-varnames:
        - UserTypePrimary
        - UserTypeLinked
        - UserTypeGuest
  securitySchemes:
    BearerAuth:
      bearerFormat: JWT
      scheme: bearer
      type: http

````

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