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

# Criar uma filial

> Copie para o Cursor/Claude/Copilot para gerar uma integração POST /v1/institutional/branches.

Cole este prompt no seu assistente de programação com IA. Ele já inclui o contrato, a autenticação e o envelope de erros, para que o código gerado corresponda à API de produção.

<CodeGroup>
  ```text Prompt theme={null}
  Você está integrando a API pública da Telepatia Synapse.

  Endpoint: POST /v1/institutional/branches
  Base URL: https://scribe-api.telepatia.ai
  Auth: Authorization: Bearer ${SYNAPSE_API_KEY}

  Requisição:
  - name [body]: string (obrigatório, maxLength=255)
  - type [body]: string (opcional, enum: single, multi) — Branch type — single site or multi-site.
  - visible [body]: boolean (opcional)
  - main [body]: boolean (opcional)
  - order [body]: integer (opcional, min=0.0)
  - description [body]: string (opcional, maxLength=1000)
  - address [body]: string (opcional, maxLength=500)
  - IPS [body]: array<string> (opcional)
  - coordinates [body]: object (opcional) — Geographic coordinates of a branch.
  - expectedConsultations [body]: integer (opcional, min=0.0)
  - branchManagerAccountIds [body]: array<string> (opcional)
  - cdssConfigurationId [body]: string (opcional)
  - auditConfigurationId [body]: string (opcional)
  - sessionStartLabel [body]: string (opcional, enum: consultation, reading) — Wording the scribe clients use on the start-session button.

  Sucesso 201:
  - id: string
  - name: string
  - type?: string
  - visible?: boolean
  - main?: boolean
  - order?: integer
  - description?: string
  - address?: string
  - IPS?: array<string>
  - coordinates?: object
  - expectedConsultations?: integer
  - branchManagerAccountIds?: array<string>
  - cdssConfigurationId?: string
  - auditConfigurationId?: string
  - sessionStartLabel?: string

  Erros (envelope: { error: { type, code, message, param? } }):
  - 400: parameter_missing, parameter_invalid, account_invalid
  - 401: authentication_required
  - 403: permission_denied, permission_denied_role
  - 409: resource_conflict
  - 503: service_unavailable

  Gere código na linguagem do arquivo atual que:
  1. Leia SYNAPSE_API_KEY do ambiente (não fixe o valor no código).
  2. Chame o endpoint com requisição e resposta tipadas.
  3. Mapeie o envelope de erros para exceções tipadas por código de status.
  4. Adicione um teste de caminho feliz usando o token Bearer.
  ```

  ```bash curl theme={null}
  curl -X POST https://scribe-api.telepatia.ai/v1/institutional/branches \
    -H "Authorization: Bearer $SYNAPSE_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
    "address": "Av. 7 #12-34",
    "main": false,
    "name": "Sede Norte",
    "type": "single"
  }'
  ```
</CodeGroup>
