Back to Home

API Reference

Complete reference for all tRPC procedures and endpoints

AI Content Poster uses tRPC for type-safe API communication. All endpoints are accessed via the trpc.* client hooks in the frontend. Authentication is handled via session cookies — protected endpoints require the user to be logged in.

Authentication

Manage user authentication and session state. AI Content Poster uses Manus OAuth for authentication — sessions are managed via HTTP-only cookies.

QUERYauth.me Public

Returns the currently authenticated user's profile, including ID, name, email, avatar, role, and creation date. Returns null if not authenticated.

Output

typescript
{
  id: number;
  openId: string;
  name: string | null;
  email: string | null;
  avatarUrl: string | null;
  role: "admin" | "user";
  createdAt: Date;
} | null

Example

typescript
const { data: user } = trpc.auth.me.useQuery();

if (user) {
  console.log("Logged in as:", user.name);
  console.log("Role:", user.role);
}
MUTATIONauth.logout Auth Required

Clears the session cookie and logs the user out. Returns a success boolean.

Output

typescript
{ success: boolean }

Example

typescript
const logout = trpc.auth.logout.useMutation({
  onSuccess: () => {
    window.location.href = "/";
  },
});

logout.mutate();