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

# List branches for a project



## OpenAPI

````yaml https://api.specular.dev/openapi.json get /projects/{id}/branches
openapi: 3.0.0
info:
  title: Specular API
  description: Backend-as-a-Service API for managing projects and branches
  version: 1.0.0
servers:
  - url: https://api.specular.dev
    description: Production server
  - url: http://localhost:3000
    description: Development server
security:
  - bearerAuth: []
paths:
  /projects/{id}/branches:
    get:
      tags:
        - Projects
      summary: List branches for a project
      parameters:
        - schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 20
          in: query
          name: limit
          required: false
          description: Maximum number of branches to return (1-100)
        - schema:
            type: integer
            minimum: 0
            default: 0
          in: query
          name: offset
          required: false
          description: Number of branches to skip
        - schema:
            type: string
          in: path
          name: id
          required: true
          description: Project ID
      responses:
        '200':
          description: List of branches
          content:
            application/json:
              schema:
                description: List of branches
                type: object
                properties:
                  branches:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        projectId:
                          type: string
                        name:
                          type: string
                        state:
                          type: string
                          enum:
                            - idle
                            - building
                            - merging
                            - merged
                            - deleted
                            - archived
                          description: >-
                            Branch state: idle (ready to use), building
                            (actively building), merging (being merged), merged
                            (merge complete), deleted (soft deleted), archived
                            (due to inactivity)
                        createdAt:
                          type: string
                          format: date-time
                        updatedAt:
                          type: string
                          format: date-time
                        openApiSpec:
                          type: string
                          nullable: true
                          description: OpenAPI spec in YAML format
                  total:
                    type: integer
                    description: Total number of branches
                  limit:
                    type: integer
                    description: Maximum number of branches returned
                  offset:
                    type: integer
                    description: Number of branches skipped
        '401':
          description: Authentication required
          content:
            application/json:
              schema:
                description: Authentication required
                type: object
                properties:
                  error:
                    type: string
        '404':
          description: Project not found
          content:
            application/json:
              schema:
                description: Project not found
                type: object
                properties:
                  error:
                    type: string
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: 'Bearer authentication with API key (format: Bearer sk_xxx)'

````