Complete reference for all MaaS Toolbox REST API endpoints, including request formats, response structures, and usage examples.
- Base URL and Authentication
- Tier Management API
- Group Query API
- User Query API
- Configuration Details
- Business Rules
- Error Responses
After deployment, retrieve the route URL:
ROUTE_URL=$(oc get route maas-toolbox -n maas-toolbox -o jsonpath='{.spec.host}')
echo "API URL: https://$ROUTE_URL"Currently, MaaS Toolbox relies on OpenShift Route authentication. Future versions will include token-based authentication.
curl https://$ROUTE_URL/healthResponse:
{
"status": "ok"
}Base path: /api/v1/tiers
Endpoint: POST /api/v1/tiers
Description: Create a new tier with specified name, description, level, and associated groups.
Request Body:
{
"name": "free",
"description": "Free tier for basic users",
"level": 1,
"groups": ["system:authenticated"]
}Request Fields:
name(string, required): Unique tier identifier. Cannot be changed after creation.description(string, required): Human-readable description of the tier.level(integer, optional): Priority level for tier selection. Default: 0. Must be non-negative.groups(array of strings, required): List of Kubernetes/OpenShift group names that have access to this tier.
Example Request:
curl -X POST https://$ROUTE_URL/api/v1/tiers \
-H "Content-Type: application/json" \
-d '{
"name": "free",
"description": "Free tier for basic users",
"level": 1,
"groups": ["system:authenticated"]
}'Success Response (201 Created):
{
"name": "free",
"description": "Free tier for basic users",
"level": 1,
"groups": ["system:authenticated"]
}Error Responses:
400 Bad Request: Validation error (missing required fields, invalid data)409 Conflict: Tier with this name already exists
Endpoint: GET /api/v1/tiers
Description: Retrieve all configured tiers.
Example Request:
curl https://$ROUTE_URL/api/v1/tiersSuccess Response (200 OK):
[
{
"name": "free",
"description": "Free tier for basic users",
"level": 1,
"groups": ["system:authenticated"]
},
{
"name": "premium",
"description": "Premium tier",
"level": 10,
"groups": ["premium-users"]
}
]Endpoint: GET /api/v1/tiers/{name}
Description: Retrieve details for a specific tier by name.
Path Parameters:
name(string): The tier name
Example Request:
curl https://$ROUTE_URL/api/v1/tiers/freeSuccess Response (200 OK):
{
"name": "free",
"description": "Free tier for basic users",
"level": 1,
"groups": ["system:authenticated"]
}Error Responses:
404 Not Found: Tier does not exist
Endpoint: PUT /api/v1/tiers/{name}
Description: Update an existing tier's description, level, and groups. The tier name cannot be changed.
Path Parameters:
name(string): The tier name to update
Request Body:
{
"description": "Updated free tier description",
"level": 2,
"groups": ["system:authenticated", "free-users"]
}Request Fields:
description(string, optional): Updated descriptionlevel(integer, optional): Updated priority levelgroups(array of strings, optional): Updated group list
Note: The name field cannot be changed. Only description, level, and groups can be updated.
Example Request:
curl -X PUT https://$ROUTE_URL/api/v1/tiers/free \
-H "Content-Type: application/json" \
-d '{
"description": "Updated free tier description",
"level": 2,
"groups": ["system:authenticated", "free-users"]
}'Success Response (200 OK):
{
"name": "free",
"description": "Updated free tier description",
"level": 2,
"groups": ["system:authenticated", "free-users"]
}Error Responses:
400 Bad Request: Validation error404 Not Found: Tier does not exist
Endpoint: DELETE /api/v1/tiers/{name}
Description: Remove a tier from the configuration.
Path Parameters:
name(string): The tier name to delete
Example Request:
curl -X DELETE https://$ROUTE_URL/api/v1/tiers/freeSuccess Response (204 No Content): No response body.
Error Responses:
404 Not Found: Tier does not exist500 Internal Server Error: Failed to delete tier
Endpoint: POST /api/v1/tiers/{name}/groups
Description: Add a Kubernetes/OpenShift group to an existing tier.
Path Parameters:
name(string): The tier name
Request Body:
{
"group": "new-group"
}Example Request:
curl -X POST https://$ROUTE_URL/api/v1/tiers/free/groups \
-H "Content-Type: application/json" \
-d '{"group": "new-group"}'Success Response (200 OK):
{
"name": "free",
"description": "Free tier for basic users",
"level": 1,
"groups": ["system:authenticated", "new-group"]
}Error Responses:
400 Bad Request: Invalid group name or group already exists in tier404 Not Found: Tier does not exist
Endpoint: DELETE /api/v1/tiers/{name}/groups/{group}
Description: Remove a group from a tier's access list.
Path Parameters:
name(string): The tier namegroup(string): The group name to remove (URL-encoded if contains special characters)
Example Request:
# For group with special characters like "system:authenticated"
curl -X DELETE https://$ROUTE_URL/api/v1/tiers/free/groups/system:authenticatedSuccess Response (200 OK):
{
"name": "free",
"description": "Free tier for basic users",
"level": 1,
"groups": []
}Error Responses:
404 Not Found: Tier or group does not exist in tier
Base path: /api/v1/groups
Endpoint: GET /api/v1/groups/{group}/tiers
Description: Retrieve all tiers that contain a specific Kubernetes/OpenShift group.
Path Parameters:
group(string): The group name (URL-encoded if contains special characters)
Example Request:
curl https://$ROUTE_URL/api/v1/groups/premium-users/tiersSuccess Response (200 OK):
[
{
"name": "premium",
"description": "Premium tier with high priority",
"level": 10,
"groups": ["premium-users", "cluster-admins"]
}
]Notes:
- Returns an empty array
[]if no tiers contain the specified group - Always returns
200 OKeven if the array is empty
Base path: /api/v1/users
Endpoint: GET /api/v1/users/{username}/tiers
Description: Retrieve all tiers that a user has access to based on their group memberships. Results are sorted by tier level (priority) in ascending order.
Path Parameters:
username(string): The username to lookup
Example Request:
curl https://$ROUTE_URL/api/v1/users/bryonbaker/tiersSuccess Response (200 OK):
[
{
"name": "standard",
"description": "Standard tier for authenticated users",
"level": 5,
"groups": ["system:authenticated"]
},
{
"name": "premium",
"description": "Premium tier with high priority",
"level": 10,
"groups": ["cluster-admins", "premium-users"]
}
]Response Details:
- Each tier includes the complete tier configuration
- Tiers are sorted by
level(ascending) - Only includes tiers where the user belongs to at least one of the tier's groups
- Automatically includes the implicit
system:authenticatedgroup for all authenticated users
Error Responses:
404 Not Found: User does not exist in the cluster500 Internal Server Error: Failed to query user or groups
Tier configuration is stored in a Kubernetes ConfigMap following the official ODH MaaS format.
ConfigMap Structure:
apiVersion: v1
kind: ConfigMap
metadata:
name: tier-to-group-mapping
namespace: maas-api
data:
tiers: |
- name: free
description: Free tier for basic users
level: 1
groups:
- system:authenticated
- name: premium
description: Premium tier
level: 10
groups:
- premium-usersBy default, MaaS Toolbox validates that groups exist in the cluster before creating or updating tiers. This validation can be disabled for environments where groups are managed externally.
When to disable group validation:
- Groups are managed in external identity providers (Keycloak, LDAP, Active Directory)
- Groups are synced to OpenShift/Kubernetes but not as Group custom resources
- You want to pre-configure tiers before groups exist in the cluster
To disable validation:
Set the VALIDATE_GROUPS environment variable to no in the deployment configuration.
Note: User-to-tier lookups (/api/v1/users/{username}/tiers) always use runtime group membership from the Kubernetes API, regardless of this setting.
| Variable | Default | Description |
|---|---|---|
NAMESPACE |
maas-api |
Kubernetes namespace where the ConfigMap is stored |
CONFIGMAP_NAME |
tier-to-group-mapping |
Name of the ConfigMap containing tier configuration |
PORT |
8080 |
HTTP server port |
VALIDATE_GROUPS |
yes |
Validate groups exist before creating/updating tiers. Set to no when using external identity providers |
- Immutable: Tier name is set at creation time and cannot be changed
- Unique: Tier names must be unique across all tiers
- Required: Name field is mandatory for tier creation
- Description: Required field, can be updated
- Level: Optional, defaults to 0, must be non-negative integer
- Groups: Required array, must contain at least one group (unless validation is disabled)
- Group Existence: By default, groups must exist in the cluster (can be disabled with
VALIDATE_GROUPS=no) - Duplicates: Adding a group that already exists in a tier returns an error
- Special Groups: The group
system:authenticatedis implicitly available to all authenticated users
All error responses follow this JSON format:
{
"error": "error message describing what went wrong"
}| Status Code | Meaning |
|---|---|
200 OK |
Request successful |
201 Created |
Resource created successfully |
204 No Content |
Resource deleted successfully (no response body) |
400 Bad Request |
Validation error or invalid request data |
404 Not Found |
Resource not found |
409 Conflict |
Resource already exists (duplicate) |
500 Internal Server Error |
Server error during processing |
Missing Required Fields:
{
"error": "name and description are required"
}Invalid Group:
{
"error": "group 'invalid-group' does not exist in the cluster"
}Duplicate Group:
{
"error": "group already exists in tier"
}Tier Not Found:
{
"error": "tier not found"
}User Not Found:
{
"error": "user 'unknown-user' not found"
}Duplicate Tier:
{
"error": "tier already exists"
}Storage Errors:
{
"error": "failed to save tier configuration"
}Interactive API documentation is available via Swagger UI:
https://$ROUTE_URL/swagger/index.html
The Swagger interface provides:
- Complete API documentation
- Interactive "Try it out" functionality
- Request/response examples for all endpoints
- Schema definitions
- Authentication requirements
After making changes to API annotations in the code:
swag init -g cmd/server/main.go -o docsA comprehensive test suite is available to validate all API endpoints:
# Test against deployed cluster
./tests/test-api.sh https://maas-toolbox-maas-toolbox.apps.$BASE_DOMAINThe test script validates:
- All CRUD operations (Create, Read, Update, Delete)
- Group management (Add/Remove groups)
- Group query endpoints
- User query endpoints
- Error cases (duplicates, not found, invalid data)
- Edge cases (empty groups, validation, etc.)
Test output includes:
- Colored pass/fail status for each test
- Detailed error messages on failures
- Summary statistics at completion
For complete workflow examples and common use cases, see the EXAMPLES.md file.
For comparison with direct OpenShift/MaaS API integration (showing the complexity that MaaS Toolbox simplifies), see the OPENSHIFT-MAAS-API-GUIDE.md.