# Relação de Filiais

> Retorna todos os estabelecimentos (matriz e filiais) vinculados a um CNPJ, com endereço, situação cadastral e dados de contato da RF. Pode ser utilizada como input tanto cnpj inteiro quanto apenas o raiz.

- **Consulta:** `relacao-filiais`
- **Categoria:** Pessoa Jurídica
- **Preço:** R$ 0,32 por consulta
- **Endpoint:** `GET https://app.fontedata.com/api/v1/consulta/relacao-filiais`
- **Autenticação:** header `X-API-Key`
- **Página:** https://fontedata.com/docs/pessoa-juridica/relacao-filiais

## Requisição

### cURL

```bash
curl -H "X-API-Key: SUA_CHAVE" \
  "https://app.fontedata.com/api/v1/consulta/relacao-filiais?cnpj=SEU_CNPJ"
```

### Python

```python
import requests

resp = requests.get(
    "https://app.fontedata.com/api/v1/consulta/relacao-filiais",
    params={"cnpj": "SEU_CNPJ"},
    headers={"X-API-Key": "SUA_CHAVE"},
    timeout=60,
)
resp.raise_for_status()
print(resp.json())
```

### Node.js

```javascript
const url = new URL("https://app.fontedata.com/api/v1/consulta/relacao-filiais");

url.search = new URLSearchParams({
  "cnpj": "SEU_CNPJ"
}).toString();

const resp = await fetch(url, {
  method: "GET",
  headers: { "X-API-Key": "SUA_CHAVE" }
});

if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
console.log(await resp.json());
```

## Parâmetros

| Nome | Tipo | Obrigatório | Descrição | Exemplo |
|---|---|---|---|---|
| `cnpj` | CNPJ | sim | CNPJ (somente números, 14 dígitos) | formato: 00.000.000/0000-00 |

## Resposta

### Exemplo de resposta

```json
{
  "page": 1,
  "porte": "EMPRESA DE PEQUENO PORTE",
  "perPage": 20,
  "totalPages": 1,
  "razaoSocial": "COMERCIAL NORDESTE DISTRIBUIDORA LTDA",
  "totalAtivos": 2,
  "capitalSocial": "500000.00",
  "cnpjConsultado": "22.222.222/0001-22",
  "estabelecimentos": [
    {
      "cnpj": "22.222.222/0001-22",
      "tipo": "MATRIZ",
      "email": "FINANCEIRO@EXEMPLO.COM.BR",
      "endereco": {
        "uf": "SP",
        "cep": "01310-100",
        "bairro": "BELA VISTA",
        "numero": "1500",
        "municipio": "SAO PAULO",
        "logradouro": "AVENIDA PAULISTA 1500",
        "complemento": "SALA 12"
      },
      "telefone": "(11) 3214-4121",
      "dataSituacao": "2015-11-03",
      "nomeFantasia": "NORDESTE DISTRIB",
      "cnaePrincipal": "4669999",
      "situacaoCadastral": "ATIVA",
      "dataInicioAtividade": "2010-04-18"
    },
    {
      "cnpj": "22.222.222/0001-22",
      "tipo": "FILIAL",
      "email": "FISCAL@EXEMPLO.COM.BR",
      "endereco": {
        "uf": "RJ",
        "cep": "22041-001",
        "bairro": "COPACABANA",
        "numero": "300",
        "municipio": "RIO DE JANEIRO",
        "logradouro": "RUA BARATA RIBEIRO 300",
        "complemento": ""
      },
      "telefone": "(11) 9904-0495",
      "dataSituacao": "2022-09-27",
      "nomeFantasia": "NORDESTE DISTRIB",
      "cnaePrincipal": "4757100",
      "situacaoCadastral": "ATIVA",
      "dataInicioAtividade": "2018-02-24"
    },
    {
      "cnpj": "22.222.222/0001-22",
      "tipo": "FILIAL",
      "email": "CONTATO@EXEMPLO.COM.BR",
      "endereco": {
        "uf": "MG",
        "cep": "30130-010",
        "bairro": "CENTRO",
        "numero": "45",
        "municipio": "BELO HORIZONTE",
        "logradouro": "RUA DA BAHIA 45",
        "complemento": ""
      },
      "telefone": "(11) 3214-4121",
      "dataSituacao": "2020-09-22",
      "nomeFantasia": "",
      "cnaePrincipal": "3314707",
      "situacaoCadastral": "BAIXADA",
      "dataInicioAtividade": "2015-07-20"
    }
  ],
  "totalEstabelecimentos": 3
}
```

### Schema da resposta

```json
{
  "type": "object",
  "properties": {
    "page": {
      "type": [
        "number",
        "null"
      ],
      "description": "Página atual da listagem."
    },
    "porte": {
      "type": [
        "string",
        "null"
      ],
      "description": "Porte da empresa."
    },
    "perPage": {
      "type": [
        "number",
        "null"
      ],
      "description": "Itens por página."
    },
    "totalPages": {
      "type": [
        "number",
        "null"
      ],
      "description": "Total de páginas."
    },
    "razaoSocial": {
      "type": [
        "string",
        "null"
      ],
      "description": "Razão social da empresa."
    },
    "totalAtivos": {
      "type": [
        "number",
        "null"
      ],
      "description": "Total de estabelecimentos ativos."
    },
    "capitalSocial": {
      "type": [
        "string",
        "null"
      ],
      "format": "currency",
      "description": "Capital social da empresa."
    },
    "cnpjConsultado": {
      "type": [
        "string",
        "null"
      ],
      "format": "cnpj",
      "description": "CNPJ consultado."
    },
    "estabelecimentos": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "object",
        "properties": {
          "cnpj": {
            "type": [
              "string",
              "null"
            ],
            "format": "cnpj",
            "description": "CNPJ do estabelecimento"
          },
          "tipo": {
            "type": [
              "string",
              "null"
            ],
            "description": "Tipo (matriz ou filial)"
          },
          "email": {
            "type": [
              "string",
              "null"
            ],
            "description": "E-mail"
          },
          "endereco": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "uf": {
                "description": "UF"
              },
              "cep": {
                "format": "cep",
                "description": "CEP"
              },
              "bairro": {
                "description": "Bairro"
              },
              "numero": {
                "description": "Número"
              },
              "municipio": {
                "description": "Município"
              },
              "logradouro": {
                "description": "Logradouro"
              },
              "complemento": {
                "description": "Complemento"
              }
            },
            "description": "Endereço"
          },
          "telefone": {
            "type": [
              "string",
              "null"
            ],
            "description": "Telefone"
          },
          "dataSituacao": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "Data da situação"
          },
          "nomeFantasia": {
            "type": [
              "string",
              "null"
            ],
            "description": "Nome fantasia"
          },
          "cnaePrincipal": {
            "type": [
              "string",
              "null"
            ],
            "description": "CNAE principal"
          },
          "situacaoCadastral": {
            "type": [
              "string",
              "null"
            ],
            "description": "Situação cadastral"
          },
          "dataInicioAtividade": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "Início da atividade"
          }
        }
      },
      "description": "Lista de estabelecimentos (matriz e filiais)."
    },
    "totalEstabelecimentos": {
      "type": [
        "number",
        "null"
      ],
      "description": "Total de estabelecimentos (matriz + filiais)."
    }
  }
}
```

---

Página em HTML: https://fontedata.com/docs/pessoa-juridica/relacao-filiais
Catálogo completo: https://fontedata.com/docs
OpenAPI (JSON): https://app.fontedata.com/api/v1/openapi.json
Conectar via MCP: https://fontedata.com/docs/mcp
