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

# Set Session Labels

> Atomically replace a session's labels. Returns the response after the assignment commits.



## OpenAPI

````yaml put /v1/sessions/{id}/labels
openapi: 3.0.0
info:
  title: Browserbase API
  description: Browserbase API for 3rd party developers
  version: v1
servers:
  - url: https://api.browserbase.com
    description: Public endpoint
    variables: {}
security:
  - BrowserbaseAuth: []
tags: []
paths:
  /v1/sessions/{id}/labels:
    put:
      summary: Set Session Labels
      description: >-
        Atomically replace a session's labels. Returns the response after the
        assignment commits.
      operationId: Sessions_setLabels
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                labels:
                  description: >-
                    Complete replacement set of label names. Empty clears
                    assignments; missing names create labels.
                  type: array
                  items:
                    type: string
                  maxItems: 1000
              additionalProperties: false
              required:
                - labels
      responses:
        '200':
          description: The session's labels after the assignment commits.
          content:
            application/json:
              schema:
                type: object
                properties:
                  labels:
                    type: array
                    items:
                      $ref: '#/components/schemas/Label'
                required:
                  - labels
        '400':
          description: Invalid request parameters or label names.
          content:
            application/json:
              schema:
                type: object
                properties:
                  statusCode:
                    description: HTTP status code.
                    type: integer
                  error:
                    description: HTTP error name.
                    type: string
                  message:
                    description: Human-readable error message.
                    type: string
                required:
                  - statusCode
                  - error
                  - message
        '404':
          description: The session does not exist in this project.
          content:
            application/json:
              schema:
                type: object
                properties:
                  statusCode:
                    description: HTTP status code.
                    type: integer
                  error:
                    description: HTTP error name.
                    type: string
                  message:
                    description: Human-readable error message.
                    type: string
                required:
                  - statusCode
                  - error
                  - message
        '422':
          description: Creating missing labels would exceed the project's label allowance.
          content:
            application/json:
              schema:
                type: object
                properties:
                  statusCode:
                    description: HTTP status code.
                    type: integer
                  error:
                    description: HTTP error name.
                    type: string
                  message:
                    description: Human-readable error message.
                    type: string
                required:
                  - statusCode
                  - error
                  - message
        '429':
          description: Your requests exceed the API rate limit.
          content:
            application/json:
              schema:
                type: object
                properties:
                  statusCode:
                    description: HTTP status code.
                    type: integer
                  error:
                    description: HTTP error name.
                    type: string
                  message:
                    description: Human-readable error message.
                    type: string
                required:
                  - statusCode
                  - error
                  - message
components:
  schemas:
    Label:
      description: A project-owned session label.
      type: object
      properties:
        id:
          description: Stable identifier of the label.
          type: string
          format: uuid
        projectId:
          description: The project that owns the label.
          type: string
          format: uuid
        name:
          description: Display name, unique ignoring case within the project.
          type: string
        createdAt:
          description: UTC timestamp when the label was created.
          type: string
          format: date-time
        updatedAt:
          description: UTC timestamp when the label was last renamed.
          type: string
          format: date-time
      required:
        - id
        - projectId
        - name
        - createdAt
        - updatedAt
  securitySchemes:
    BrowserbaseAuth:
      type: apiKey
      in: header
      name: X-BB-API-Key
      description: Your [Browserbase API Key](https://www.browserbase.com/settings).

````

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