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

# GET /v1/scheduling/branches

> List the tenant's active branches. Supports full-text search over name and display_name (Spanish text index).

Returns branches with `status: active` for the tenant resolved from the PAT. Search uses the `branch_text_search` text index (language `spanish`), so it tolerates plurals and accents.

## Endpoint

```
GET https://api.keebai.com/v1/scheduling/branches
```

## Required scope

`scheduling:branches:read`

## Headers

| Header          | Required | Value                    |
| --------------- | -------- | ------------------------ |
| `Authorization` | Yes      | `Bearer kbai_pk_<token>` |

## Query params

| Param    | Type     | Default | Description                                      |
| -------- | -------- | ------- | ------------------------------------------------ |
| `search` | `string` | —       | Full-text search over `name` and `display_name`. |
| `skip`   | `number` | `0`     | Pagination offset. Minimum `0`.                  |
| `limit`  | `number` | `50`    | Page size. Range `1..200`.                       |

## Example request

<CodeGroup>
  ```bash curl theme={null}
  curl -G https://api.keebai.com/v1/scheduling/branches \
    -H "Authorization: Bearer kbai_pk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
    --data-urlencode "search=clinica norte" \
    --data-urlencode "limit=20"
  ```

  ```js JavaScript theme={null}
  const url = new URL("https://api.keebai.com/v1/scheduling/branches");
  url.searchParams.set("search", "clinica norte");
  url.searchParams.set("limit", "20");

  const response = await fetch(url, {
    headers: { Authorization: `Bearer ${process.env.KEEBAI_API_TOKEN}` },
  });
  const { items } = await response.json();
  ```

  ```python Python theme={null}
  import os, requests

  resp = requests.get(
      "https://api.keebai.com/v1/scheduling/branches",
      headers={"Authorization": f"Bearer {os.environ['KEEBAI_API_TOKEN']}"},
      params={"search": "clinica norte", "limit": 20},
      timeout=10,
  )
  resp.raise_for_status()
  print(resp.json()["items"])
  ```
</CodeGroup>

## Response

### 200 OK

```json theme={null}
{
  "total": 3,
  "skip": 0,
  "limit": 20,
  "items": [
    {
      "id": "65a1f2b3c4d5e6f7a8b9c0d1",
      "name": "Clínica Norte",
      "display_name": "Norte",
      "description": "Sede principal en Vitacura",
      "address": {
        "street": "Av. Apoquindo 1234",
        "city": "Santiago",
        "region": "RM",
        "country": "CL"
      },
      "contact": { "phone": "+56229999999", "email": "norte@clinica.cl" },
      "timezone": "America/Santiago",
      "status": "active"
    }
  ]
}
```

| Field              | Type     | Description                                                                      |
| ------------------ | -------- | -------------------------------------------------------------------------------- |
| `total`            | `number` | Total branches matching the filters (before pagination).                         |
| `items[].id`       | `string` | Branch `ObjectId`. Used as `branch_id` for availability and appointments.        |
| `items[].timezone` | `string` | Branch timezone. All availability and appointments are computed against this tz. |

### 401 Unauthorized

Token missing, invalid, revoked, or expired.

### 403 Forbidden

The token doesn't have the `scheduling:branches:read` scope.


## OpenAPI

````yaml GET /v1/scheduling/branches
openapi: 3.0.0
info:
  title: Keebai Public API
  description: Superficie pública REST autenticada con Personal Access Tokens (PAT).
  version: 1.0.0
  contact: {}
servers:
  - url: https://api.keebai.com
    description: Production
security: []
tags: []
paths:
  /v1/scheduling/branches:
    get:
      tags:
        - scheduling-branches
      summary: Listar sucursales activas del tenant
      operationId: PublicBranchesController_list
      parameters:
        - name: search
          required: false
          in: query
          description: Búsqueda libre por nombre
          schema:
            type: string
        - name: skip
          required: false
          in: query
          schema:
            minimum: 0
            default: 0
            type: number
        - name: limit
          required: false
          in: query
          schema:
            minimum: 1
            maximum: 200
            default: 50
            type: number
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicBranchListResponseDto'
      security:
        - PAT: []
components:
  schemas:
    PublicBranchListResponseDto:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/PublicBranchResponseDto'
        total:
          type: number
        skip:
          type: number
        limit:
          type: number
      required:
        - items
        - total
        - skip
        - limit
    PublicBranchResponseDto:
      type: object
      properties:
        id:
          type: string
          description: ObjectId de la sucursal
        name:
          type: string
        display_name:
          type: string
        description:
          type: string
        address:
          type: object
        contact:
          type: object
        timezone:
          type: string
          description: IANA, ej. America/Santiago
        status:
          type: string
      required:
        - id
        - name
  securitySchemes:
    PAT:
      scheme: bearer
      bearerFormat: kbai_pk_<hex>
      type: http
      description: >-
        Personal Access Token con prefijo `kbai_pk_`. Generar desde el portal
        con permiso `developer.manage_tokens`.

````