> ## 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/:id

> Fetch a branch by id. Returns 404 if it doesn't belong to the tenant resolved from the PAT.

Returns the requested branch as long as it belongs to the PAT's tenant. The query filters by `company` in addition to `_id`, so a valid id from another tenant responds with `404`.

## Endpoint

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

## Required scope

`scheduling:branches:read`

## Path params

| Param | Type     | Description        |
| ----- | -------- | ------------------ |
| `id`  | `string` | Branch `ObjectId`. |

## Example request

<CodeGroup>
  ```bash curl theme={null}
  curl https://api.keebai.com/v1/scheduling/branches/65a1f2b3c4d5e6f7a8b9c0d1 \
    -H "Authorization: Bearer kbai_pk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  ```

  ```js JavaScript theme={null}
  const response = await fetch(
    `https://api.keebai.com/v1/scheduling/branches/${branchId}`,
    { headers: { Authorization: `Bearer ${process.env.KEEBAI_API_TOKEN}` } },
  );
  const branch = await response.json();
  ```
</CodeGroup>

## Response

### 200 OK

```json theme={null}
{
  "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"
}
```

### 404 Not Found

```json theme={null}
{
  "error": {
    "code": "BRANCH_NOT_FOUND",
    "message": "Branch <id> no encontrado"
  }
}
```

A 404 is also returned when the id exists in another company.

### 401 Unauthorized · 403 Forbidden

Same semantics as the rest of the public API.


## OpenAPI

````yaml GET /v1/scheduling/branches/{id}
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/{id}:
    get:
      tags:
        - scheduling-branches
      summary: Obtener detalle de una sucursal
      operationId: PublicBranchesController_getById
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicBranchResponseDto'
      security:
        - PAT: []
components:
  schemas:
    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`.

````