Assign Resource to Role
Add a cloud resource to a role. Users assigned to this role will be able to start sessions that whitelist their IP on this resource.
Request
POST https://api.entryguard.io/api/v1/roles/{id}/resources/{resourceId}
Authentication
Requires a valid Bearer JWT token with ORG_ADMIN role.
Authorization: Bearer <access_token>
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | UUID | Yes | The unique identifier of the role |
resourceId | UUID | Yes | The unique identifier of the cloud resource to assign |
Request Body
No request body is required.
Response
Success Response
Status Code: 200 OK
{
"message": "Resource assigned to role successfully"
}
Error Responses
| Status Code | Description |
|---|---|
400 Bad Request | Resource is already assigned to this role |
401 Unauthorized | Missing or invalid authentication token |
403 Forbidden | User does not have ORG_ADMIN role |
404 Not Found | Role or resource with the specified ID does not exist in this organization |
429 Too Many Requests | Rate limit exceeded |
500 Internal Server Error | Server error occurred |
Error Response Examples:
{
"timestamp": "2026-02-18T10:30:00Z",
"status": 404,
"error": "Not Found",
"message": "Role not found with id: 550e8400-e29b-41d4-a716-446655440000",
"path": "/api/v1/roles/550e8400-e29b-41d4-a716-446655440000/resources/660e8400-e29b-41d4-a716-446655440001"
}
{
"timestamp": "2026-02-18T10:30:00Z",
"status": 404,
"error": "Not Found",
"message": "Resource not found with id: 660e8400-e29b-41d4-a716-446655440001",
"path": "/api/v1/roles/550e8400-e29b-41d4-a716-446655440000/resources/660e8400-e29b-41d4-a716-446655440001"
}
{
"timestamp": "2026-02-18T10:30:00Z",
"status": 400,
"error": "Bad Request",
"message": "Resource already assigned to this role",
"path": "/api/v1/roles/550e8400-e29b-41d4-a716-446655440000/resources/660e8400-e29b-41d4-a716-446655440001"
}
Example
Request
curl -X POST https://api.entryguard.io/api/v1/roles/550e8400-e29b-41d4-a716-446655440000/resources/660e8400-e29b-41d4-a716-446655440001 \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
Response
{
"message": "Resource assigned to role successfully"
}
Notes
- Resources can be assigned to multiple roles
- Users inherit access to all resources from all their assigned roles
- Changes take effect immediately for new sessions
- Existing active sessions are not affected