> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dados.rio/llms.txt
> Use this file to discover all available pages before exploring further.

# Update action

> Update an existing action's name and/or description.

**Authorization**: Requires admin privileges to update actions.

**Partial Updates**: You can update just the name, just the description, or both.
Provide only the fields you want to update.

**Impact**: Updating an action name may affect existing endpoint mappings and
authorization policies that reference this action.

**Use Cases**:
- Refine action descriptions for better clarity
- Rename actions to follow updated naming conventions
- Administrative maintenance of the action catalog



## OpenAPI

````yaml https://raw.githubusercontent.com/prefeitura-rio/heimdall/main/docs/api/openapi.json put /api/v1/actions/{action_id}
openapi: 3.1.0
info:
  title: Heimdall Admin Service
  description: >-
    # Heimdall Admin Service API


    A comprehensive admin service for user and group management with
    authorization powered by Cerbos.


    ## Features


    - **User Management**: Automatic user creation from JWT tokens with
    role-based access control

    - **Group Management**: Create, manage, and assign users to groups with
    hierarchical permissions

    - **Role Management**: Define and assign roles to users and groups

    - **Mapping Management**: Configure API endpoint to action mappings for
    authorization

    - **Action Management**: Define available actions for fine-grained
    permission control

    - **Cerbos Integration**: Policy-based authorization with external Cerbos
    service

    - **Audit Logging**: Comprehensive audit trail for all administrative
    operations

    - **Redis Caching**: High-performance caching for frequently accessed data
  version: 1.0.0
servers:
  - url: https://services.pref.rio/heimdall-admin
    description: Production server
  - url: https://services.staging.app.dados.rio/heimdall-admin
    description: Staging server
security: []
tags:
  - name: health
    description: Service health and readiness checks
  - name: users
    description: >-
      User management operations. Users are automatically created from JWT
      tokens.
  - name: groups
    description: >-
      Group management operations. Groups organize users and can have roles
      assigned.
  - name: memberships
    description: Group membership management. Assign and remove users from groups.
  - name: roles
    description: >-
      Role management operations. Roles define permissions that can be assigned
      to users or groups.
  - name: actions
    description: >-
      Action management operations. Actions define the granular permissions
      available in the system.
  - name: mappings
    description: >-
      API endpoint to action mapping configuration. Maps HTTP endpoints to
      authorization actions.
paths:
  /api/v1/actions/{action_id}:
    put:
      tags:
        - actions
      summary: Update action
      description: >-
        Update an existing action's name and/or description.


        **Authorization**: Requires admin privileges to update actions.


        **Partial Updates**: You can update just the name, just the description,
        or both.

        Provide only the fields you want to update.


        **Impact**: Updating an action name may affect existing endpoint
        mappings and

        authorization policies that reference this action.


        **Use Cases**:

        - Refine action descriptions for better clarity

        - Rename actions to follow updated naming conventions

        - Administrative maintenance of the action catalog
      operationId: update_action_api_v1_actions__action_id__put
      parameters:
        - name: action_id
          in: path
          required: true
          schema:
            type: integer
            title: Action Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ActionUpdateRequest'
      responses:
        '200':
          description: Action updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/app__routers__actions__ActionResponse'
              example:
                id: 1
                name: user:read
                description: Read user information and profile data
                endpoint_count: 3
        '400':
          description: Bad request - Invalid input data or duplicate action name
          content:
            application/json:
              example:
                detail: Action with name 'user:read' already exists
        '401':
          description: Unauthorized - Invalid or missing JWT token
          content:
            application/json:
              example:
                detail: Could not validate credentials
        '403':
          description: Forbidden - Insufficient permissions to update actions
          content:
            application/json:
              example:
                detail: Insufficient permissions to update actions
        '404':
          description: Action not found
          content:
            application/json:
              example:
                detail: Action with ID 999 not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal server error
          content:
            application/json:
              example:
                detail: 'Failed to update action: Database connection error'
      security:
        - HTTPBearer: []
components:
  schemas:
    ActionUpdateRequest:
      properties:
        name:
          anyOf:
            - type: string
              maxLength: 100
              minLength: 1
              pattern: ^[a-zA-Z0-9_:-]+$
            - type: 'null'
          title: Name
          description: Updated name for the action
          example: user:read
        description:
          anyOf:
            - type: string
              maxLength: 500
              minLength: 1
            - type: 'null'
          title: Description
          description: Updated description of the action's purpose
          example: Read user information and profile data
      type: object
      title: ActionUpdateRequest
      description: Request model for updating an existing action.
      example:
        description: Read user information and profile data
        name: user:read
    app__routers__actions__ActionResponse:
      properties:
        id:
          type: integer
          title: Id
          description: Unique identifier for the action
          example: 1
        name:
          type: string
          title: Name
          description: Action name
          example: user:read
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: Action description
          example: Read user information
        endpoint_count:
          type: integer
          title: Endpoint Count
          description: Number of API endpoints mapped to this action
          default: 0
          example: 3
      type: object
      required:
        - id
        - name
      title: ActionResponse
      description: Response model for action information.
      example:
        description: Read user information
        endpoint_count: 3
        id: 1
        name: user:read
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````