Skip to content

Get Users by CNPJ

Endpoint used to retrieve users from the institution associated with a given CNPJ, returning enriched profile data including address, schools, custom form answers, and institution details. Results are scoped to the authenticated institution via JWT. Both masked and unmasked formats are accepted, and the CNPJ is validated against the official Brazilian checksum algorithm.

Note: This endpoint is served by api-admin (Node.js/TypeScript). Use the api-admin base URL for your environment (e.g. https://kong.api.toolzz.com.br).

Terminal window
curl --request GET \
--url 'https://kong.api.toolzz.com.br/users/getUsersByCnpj?cnpj=85709119000190' \
--header 'Authorization: Bearer <token>'

CNPJ with mask (equivalent):

Terminal window
curl --request GET \
--url 'https://kong.api.toolzz.com.br/users/getUsersByCnpj?cnpj=85.709.119%2F0001-90' \
--header 'Authorization: Bearer <token>'
{
"data": [
{
"id": 1,
"uuid": "<string>",
"name": "<string>",
"email": "<string>",
"cpf": "<string>",
"cnpj": "<string>",
"created_at": "<string>",
"updated_at": "<string>",
"rg": null,
"phone": "<string>",
"ultima_atividade": "<string>",
"birthday": "<string>",
"school": {
"id": 1,
"titulo": "<string>"
},
"schools": [
{
"id": 1,
"titulo": "<string>"
}
],
"address": null,
"custom_form": [],
"institution": [
{
"id": 1,
"subdomain": "<string>",
"titulo": "<string>"
}
]
}
]
}

ParameterTypeDescriptionRequired
AuthorizationStringAccess token (“Bearer” must be before the token). Admin role required.Yes
ParameterTypeDescriptionRequired
cnpjstringCNPJ with or without formatting (XX.XXX.XXX/XXXX-XX or 14 digits).Yes

KeyTypeDescription
dataarrayList of users associated with the given CNPJ.
data.idnumberUnique identifier of the user.
data.uuidstringUniversal Unique Identifier (UUID) of the user.
data.namestringFull name of the user.
data.emailstringUser email address.
data.cpfstring | nullUser’s CPF.
data.cnpjstring | nullCNPJ digits only (no formatting).
data.created_atstring | nullUser creation timestamp (ISO 8601).
data.updated_atstring | nullLast update timestamp (ISO 8601).
data.rgstring | nullUser’s RG document number.
data.phonestring | nullUser phone number.
data.ultima_atividadestring | nullTimestamp of last user activity.
data.birthdaystring | nullDate of birth (YYYY-MM-DD).
data.schoolobject | nullPrimary school associated with the user.
data.school.idnumberUnique identifier of the school.
data.school.titulostringSchool name.
data.schoolsarrayAll schools associated with the user.
data.addressobject | nullUser address details (null if not set).
data.custom_formarrayResponses to institution custom form questions.
data.institutionarrayInstitutions associated with the user.
data.institution.idnumberUnique identifier of the institution.
data.institution.subdomainstringInstitution subdomain.
data.institution.titulostringInstitution name.

HTTPSituation
400CNPJ parameter not provided.
400CNPJ is invalid (wrong check digits, wrong length).
400No users found with this CNPJ in the institution.
403Missing, expired, or invalid token, or user lacks admin permission.
{
"message": "The cnpj query field is required"
}
{
"message": "The provided CNPJ is invalid. Please inform a valid 14-digit CNPJ."
}
{
"message": "User not exists"
}

To access this endpoint, it is necessary to send a valid access token through the authorization header (Authorization) of the request. Additionally, the API is protected by other security measures to safeguard user data.