In the commercial API, you can also query using the CNPJ root, which are the first 8 digits of the CNPJ and, in this case, will return all CNPJs of the company in question. In this endpoint, you must send the x_api_token header with the token that was sent to you via email.
You can also pass the token as a parameter in the URL, example:
const consultarCNPJ = require("consultar-cnpj");
async function getRaiz() {
const token = "INFORME O SEU TOKEN DE ACESSO";
const data = await consultarCNPJ.raiz("27865757", token);
console.log(data);
}
Caso a empresa possua mais de 20 filiais a API irá dividir a resposta em páginas. Você pode verificar isso no JSON de retono da API, na propriedade "paginacao", que exibe a página atual, o total de páginas e o total de filiais: