API Overview
The Solução42 Console API is a RESTful API that allows you to manage companies, users, groups, and permissions programmatically.
Base URL
| Environment | URL |
|---|---|
| Production | https://api.console.solucao42.com.br |
All endpoints are prefixed with /v1/ for versioning.
Authentication
All API requests (except login and public endpoints) require authentication using a JWT token:
curl https://api.console.solucao42.com.br/v1/users \
-H "Authorization: Bearer YOUR_JWT_TOKEN"
See Authentication for details on obtaining tokens.
Request Format
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes* | Bearer token for authentication |
Content-Type | For POST/PUT | Always application/json |
*Not required for login and public endpoints.
Request Body
All request bodies must be valid JSON:
{
"name": "Example",
"email": "[email protected]"
}
Response Format
Successful Responses
Single resource:
{
"_id": "507f1f77bcf86cd799439011",
"name": "Example Resource",
"created_at": "2024-03-01T10:30:00.000Z"
}
List of resources:
{
"total": 100,
"quantity": 20,
"records": [
{ "_id": "...", "name": "Resource 1" },
{ "_id": "...", "name": "Resource 2" }
]
}
| Field | Description |
|---|---|
total | Total number of records matching your query |
quantity | Number of records in this response |
records | Array of resource objects |
Error Responses
Validation error (422):
{
"errors": [
{
"instancePath": "/email",
"message": "must be a valid email"
}
]
}
Business logic error (400):
{
"error": "User with this email already exists",
"error_code": "USER_EMAIL_DUPLICATE"
}
HTTP Status Codes
| Code | Description |
|---|---|
200 | Success |
201 | Created successfully |
204 | Success with no content (e.g., delete) |
400 | Bad request - check error message |
401 | Unauthorized - invalid or missing token |
403 | Forbidden - insufficient permissions |
404 | Resource not found |
422 | Validation error - check errors array |
429 | Rate limit exceeded |
500 | Internal server error |
Pagination
List endpoints support pagination:
GET /v1/users?page=2&per_page=50
| Parameter | Default | Max | Description |
|---|---|---|---|
page | 1 | - | Page number (starts at 1) |
per_page | 20 | 100 | Items per page |
Rate Limiting
To protect the API, rate limits are enforced:
Available Endpoints
Authentication
| Method | Endpoint | Description |
|---|---|---|
| GET | /v1/auth/validate-company | Check if company exists |
| POST | /v1/auth/login | Login with email/password |
| POST | /v1/auth/google | Login with Google OAuth |
| POST | /v1/auth/passwordless/request | Request login code |
| POST | /v1/auth/passwordless/verify | Verify login code |
| POST | /v1/auth/2fa/login | Verify 2FA token |
| GET | /v1/auth/sso/:slug/start | Start SSO flow |
| GET | /v1/auth/me | Get current user |
| POST | /v1/auth/logout | Logout |
Users
| Method | Endpoint | Description |
|---|---|---|
| GET | /v1/users | List all users |
| GET | /v1/users/:id | Get user by ID |
| POST | /v1/users/invite | Invite new user |
| POST | /v1/users/accept-invitation | Accept invitation |
| POST | /v1/users/reset-password/request | Request password reset |
| POST | /v1/users/:id/activate | Activate user |
| POST | /v1/users/:id/deactivate | Deactivate user |
| POST | /v1/users/:id/groups | Add groups to user |
| PUT | /v1/users/:id/groups | Replace user groups |
| DELETE | /v1/users/:id/groups | Remove groups from user |
Groups
| Method | Endpoint | Description |
|---|---|---|
| GET | /v1/groups | List all groups |
| GET | /v1/groups/:id | Get group by ID |
| POST | /v1/groups | Create group |
| PUT | /v1/groups/:id | Update group |
| DELETE | /v1/groups/:id | Delete group |
| POST | /v1/groups/:id/permissions | Add permissions |
| PUT | /v1/groups/:id/permissions | Replace permissions |
| DELETE | /v1/groups/:id/permissions | Remove permissions |
Permissions
| Method | Endpoint | Description |
|---|---|---|
| GET | /v1/permissions | List all permissions |
| GET | /v1/permissions/:id | Get permission by ID |
| POST | /v1/permissions | Create permission |
| PUT | /v1/permissions/:id | Update permission |
| DELETE | /v1/permissions/:id | Delete permission |
Error Codes
Common error codes you may encounter:
| Error Code | Description |
|---|---|
INVALID_CREDENTIALS | Wrong email, password, or company |
UNAUTHORIZED | Token missing or expired |
FORBIDDEN | Insufficient permissions |
VALIDATION_ERROR | Request validation failed |
NOT_FOUND | Resource doesn't exist |
USER_EMAIL_DUPLICATE | Email already in use |
COMPANY_NOT_FOUND | Company slug not found |
CANNOT_DEACTIVATE_SELF | Cannot deactivate your own user account |
SDKs and Libraries
While we don't have official SDKs yet, here are community resources:
- Example JavaScript client in our Getting Started guide
- OpenAPI specification available upon request
Need Help?
- 📧 Email: [email protected]
- 📚 Guides: Check our conceptual guides
- 🐛 Issues: Report bugs via email