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

# Pick a calendar or a staff member

> calendar_id picks the calendar to use, one that GET /calendars/{connection_id}/calendars lists as writable. staff_id makes the connection a staff member's calendar, or with null the business's. Values the connection already has change nothing. A new calendar_id is checked with Google: a connection Google no longer accepts is a 409, and a deployment without Google Calendar answers 403.



## OpenAPI

````yaml /api-reference/openapi.json patch /calendars/{connection_id}
openapi: 3.1.0
info:
  title: LobbyStack API
  version: v1
  description: >-
    Read calls, contacts, appointments and messages, book appointments, and
    subscribe to webhooks. Authenticate with an API key in the Authorization
    header. A platform key also names the business it acts on in the
    LobbyStack-Business header. Each key allows 120 requests per minute by
    default.
servers:
  - url: https://app.lobbystack.com/api/v1
security:
  - bearerAuth: []
tags:
  - name: Business
  - name: Receptionist
  - name: Billing
  - name: Phone numbers
  - name: Onboarding
  - name: Team
  - name: Website chat
  - name: Calendars
  - name: Notifications
  - name: Calls
  - name: Contacts
  - name: Appointments
  - name: Messages
  - name: Knowledge
  - name: Webhooks
  - name: Platform
paths:
  /calendars/{connection_id}:
    patch:
      tags:
        - Calendars
      summary: Pick a calendar or a staff member
      description: >-
        calendar_id picks the calendar to use, one that GET
        /calendars/{connection_id}/calendars lists as writable. staff_id makes
        the connection a staff member's calendar, or with null the business's.
        Values the connection already has change nothing. A new calendar_id is
        checked with Google: a connection Google no longer accepts is a 409, and
        a deployment without Google Calendar answers 403.
      operationId: updateCalendarConnection
      parameters:
        - name: connection_id
          in: path
          required: true
          description: The calendar connection id.
          schema:
            type: string
            format: uuid
        - name: LobbyStack-Business
          in: header
          description: >-
            The business a platform key acts on. Required with a platform key. A
            per-business key may leave it out; if it sends one, it must be the
            key's own business.
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CalendarConnectionUpdate'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    $ref: '#/components/schemas/CalendarConnection'
        '400':
          description: >-
            The request is invalid (invalid_request), or a platform key sent no
            LobbyStack-Business header (business_required).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: The API key is missing, invalid, or revoked (unauthorized).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: >-
            Refused. insufficient_scope: the key lacks the business:write scope.
            forbidden: a per-business key named another business in
            LobbyStack-Business. key_owner_inactive: the person the key acts for
            can't any more: a per-business key's creator is no longer an owner
            or admin, or a platform key's owner_email has no verified LobbyStack
            account.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: >-
            Not found (not_found), including a business a platform key cannot
            act on.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: The request conflicts with the current state.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: >-
            Too many requests (rate_limited). Wait for the Retry-After header's
            number of seconds.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          headers:
            Retry-After:
              schema:
                type: integer
              description: Seconds to wait.
      security:
        - bearerAuth: []
components:
  schemas:
    CalendarConnectionUpdate:
      type: object
      properties:
        calendar_id:
          description: >-
            A writable calendar from GET /calendars/{connection_id}/calendars.
            Picking another one reads it again, so the staff it covers can't be
            booked until that finishes.
          type: string
          minLength: 1
          maxLength: 255
        staff_id:
          description: >-
            An active staff member from GET /staff, or null for the business's
            calendar.
          anyOf:
            - type: string
              format: uuid
              description: Stable identifier (UUID).
            - type: 'null'
      additionalProperties: false
    CalendarConnection:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Stable identifier (UUID).
        provider:
          type: string
          description: 'google: Google Calendar.'
        account_id:
          type: string
          description: Google's id for the connected account.
        calendar_id:
          description: >-
            The calendar LobbyStack reads busy times from and adds appointments
            to. null until one is picked with PATCH /calendars/{connection_id};
            until then the connection changes nothing.
          type:
            - string
            - 'null'
        staff_id:
          anyOf:
            - type: string
              format: uuid
              description: Stable identifier (UUID).
            - type: 'null'
          description: >-
            The staff member whose calendar this is: its busy times block only
            them, and their appointments go to it. null: the business's
            calendar, whose busy times block everyone and which takes the
            appointments of staff without a calendar of their own.
        status:
          type: string
          enum:
            - connected
            - syncing
            - error
          description: >-
            connected: the busy times are up to date. syncing: reading the
            calendar after a change. error: the last sync failed, and sync_error
            says why. While a picked calendar is syncing or failing, the staff
            it covers can't be booked.
        sync_error:
          type:
            - string
            - 'null'
        last_synced_at:
          anyOf:
            - type: string
              format: date-time
              description: ISO 8601 timestamp in UTC.
            - type: 'null'
        created_at:
          type: string
          format: date-time
          description: ISO 8601 timestamp in UTC.
        updated_at:
          type: string
          format: date-time
          description: ISO 8601 timestamp in UTC.
      required:
        - id
        - provider
        - account_id
        - calendar_id
        - staff_id
        - status
        - sync_error
        - last_synced_at
        - created_at
        - updated_at
      additionalProperties: false
      description: A calendar account connected to the business.
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - invalid_request
                - unauthorized
                - forbidden
                - insufficient_scope
                - not_found
                - conflict
                - idempotency_key_reused
                - idempotency_request_in_progress
                - booking_disabled
                - booking_requires_confirmation
                - slot_unavailable
                - rate_limited
                - rate_limit_unavailable
                - method_not_allowed
                - internal_error
                - business_required
                - key_owner_inactive
                - plan_limit_reached
            message:
              type: string
            details:
              type: array
              items:
                type: object
                properties:
                  path:
                    type: string
                  message:
                    type: string
                required:
                  - path
                  - message
                additionalProperties: false
          required:
            - code
            - message
          additionalProperties: false
      required:
        - error
      additionalProperties: false
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        An API key from Settings > API keys (lsk_...), which acts on its own
        business, or a platform key from the PLATFORM_API_KEYS setting
        (lsp_...), which onboards and manages businesses. Scopes: business:read,
        business:write, calls:read, contacts:read, contacts:write,
        appointments:read, appointments:write, messages:read, knowledge:read,
        knowledge:write, webhooks:manage, billing:manage, phone_numbers:manage,
        team:manage, businesses:create, users:create. Only platform keys can
        hold businesses:create and users:create.

````

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