Server-side Composables

These composables are only available in Nitro server routes (server/api/*.ts). This page calls each API route and displays the result.

useAdminDirectus()

Creates a Directus client authenticated with DIRECTUS_ADMIN_TOKEN. Use this for privileged operations that should not depend on the current user's session.

useSessionDirectus(event)

Creates a Directus client that forwards the current user's session cookie. Requests run with that user's permissions - not admin privileges.

Log in first to see your session data.

useTokenDirectus(token)

Creates a Directus client authenticated with an explicit static token. Useful for service accounts or integrations where you manage tokens directly.