async def create_user_api_key(
            id: UUID = Path(
                ..., description="ID of the user for whom to create an API key"
            ),
            name: Optional[str] = Body(
                None, description="Name of the API key"
            ),
            description: Optional[str] = Body(
                None, description="Description of the API key"
            ),
            auth_user=Depends(self.providers.auth.auth_wrapper()),
        ) -> WrappedAPIKeyResponse:
            """Create a new API key for the specified user.

            Only superusers or the user themselves may create an API key.
            """
            if auth_user.id != id and not auth_user.is_superuser:
                raise R2RException(
                    "Only the user themselves or a superuser can create API keys for this user.",
                    403,
                )

            api_key = await self.services.auth.create_user_api_key(
                id, name=name, description=description
            )
            return api_key  # type: ignore
Create a new API key for the specified user.

            Only superusers or the user themselves may create an API key.
            
py/core/main/api/v3/users_router.py