Skip to main content

POST /api/permissions

Creates a new permission and registers it in the system. Permissions define granular access rights that can be assigned to roles.

Authentication

This endpoint requires authentication with a valid Bearer token.

Request Body

name
string
required
The name of the permission. Must be unique and cannot exceed 100 characters.
description
string
Optional description of the permission. Maximum 200 characters.

Response

id
uuid
Unique identifier for the created permission
name
string
The name of the permission
description
string
Description of the permission
status
string
Current status of the permission (e.g., “ACTIVE”, “INACTIVE”)

Status Codes

  • 201 Created - Permission created successfully
  • 400 Bad Request - Invalid input data or validation errors
  • 404 Not Found - Referenced module not found
  • 500 Internal Server Error - Server error occurred

Example Request

curl -X POST https://api.example.com/api/permissions \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "users:read",
    "description": "Permission to read user data"
  }'

Example Response

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "users:read",
  "description": "Permission to read user data",
  "status": "ACTIVE"
}

Error Response

{
  "timestamp": "2026-03-04T10:30:00Z",
  "status": 400,
  "error": "Bad Request",
  "message": "El nombre del permiso es obligatorio",
  "path": "/api/permissions"
}

Build docs developers (and LLMs) love