async def create_entity(
            collection_id: UUID = Path(
                ...,
                description="The collection ID corresponding to the graph to add the entity to.",
            ),
            name: str = Body(
                ..., description="The name of the entity to create."
            ),
            description: str = Body(
                ..., description="The description of the entity to create."
            ),
            category: Optional[str] = Body(
                None, description="The category of the entity to create."
            ),
            metadata: Optional[dict] = Body(
                None, description="The metadata of the entity to create."
            ),
            auth_user=Depends(self.providers.auth.auth_wrapper()),
        ) -> WrappedEntityResponse:
            """Creates a new entity in the graph."""
            if (
                # not auth_user.is_superuser
                collection_id not in auth_user.collection_ids
            ):
                raise R2RException(
                    "The currently authenticated user does not have access to the collection associated with the given graph.",
                    403,
                )

            return await self.services.graph.create_entity(  # type: ignore
                name=name,
                description=description,
                parent_id=collection_id,
                category=category,
                metadata=metadata,
            )
Creates a new entity in the graph.
py/core/main/api/v3/graph_router.py