Skip to content

Find Users and Courses by CNPJ

Endpoint used to retrieve users from the institution associated with a given CNPJ, along with their active course enrollments. Results are scoped to the authenticated institution via JWT. Both masked and unmasked CNPJ formats are accepted.

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

CNPJ with mask (equivalent):

Terminal window
curl --request GET \
--url 'https://kong.api.toolzz.com.br/api/users/courses/cnpj?cnpj=85.709.119%2F0001-90' \
--header 'Authorization: Bearer <token>'
[
{
"id": 1,
"uuid": "<string>",
"name": "<string>",
"username": null,
"email": "<string>",
"cnpj": "<string>",
"courses": [
{
"course_id": 1,
"current_score": null,
"course_concluded": 0,
"conclusion_date": null,
"class_ids": "<string>",
"school_ids": "<string>",
"enrollment_id": 1,
"expiration_date": null,
"created_at": "<string>",
"updated_at": "<string>"
}
]
}
]

The cnpj field is always returned without formatting (digits only). When the user exists but has no courses, the courses field returns a message object instead of an array: {"message": "Não existem cursos matriculados para o CNPJ informado."}.


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
idnumberUnique identifier of the user.
uuidstringUniversal Unique Identifier (UUID) of the user.
namestringFull name of the user.
usernamestring | nullUsername (may be null).
emailstringUser email address.
cnpjstringCNPJ digits only (no formatting).
coursesarrayList of active course enrollments for this user.
courses.course_idnumberUnique identifier of the course.
courses.current_scorenumber | nullCurrent score in the course.
courses.course_concludednumberCompletion status: 1 = completed, 0 = in progress.
courses.conclusion_datestring | nullConclusion date (null if not concluded).
courses.class_idsstringComma-separated class IDs the user belongs to.
courses.school_idsstringComma-separated school IDs linked to the enrollment.
courses.enrollment_idnumberUnique identifier of the enrollment record.
courses.expiration_datestring | nullEnrollment expiration date (null if no expiry).
courses.created_atstringEnrollment creation timestamp (ISO 8601).
courses.updated_atstringLast update timestamp (ISO 8601).

HTTPSituation
404No users found with this CNPJ in the institution.
422CNPJ is invalid (wrong check digits, wrong length).
422cnpj parameter not provided.
403User lacks admin permission.
429Rate limit exceeded (100 req/min).
{
"cnpj": ["The provided CNPJ is invalid. Please inform a valid 14-digit CNPJ."]
}
{
"cnpj": ["The cnpj field is required."]
}
{
"message": "Nenhum usuário encontrado para o CNPJ informado."
}

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.