API reference

Auth, permissions and API

Composables to call your API, check permissions, manage roles and sign in with social providers.

The Authentication, Roles and permissions and Connect your API guides show them in context.

useApi()

A $fetch instance with NUXT_PUBLIC_API_BASE, the auth-token bearer header and sign-out on 401.

composables/useApi.ts
useApi(): any

toFormSubmitError()

Turns a 422 response { message, errors } into a FormSubmitError for useFormSubmit().

composables/useApi.ts
toFormSubmitError(error: unknown): any

useCan()

can(permission) answers whether the current role has a permission; role is the full role.

composables/useCan.ts
useCan(): { role: any; can: (permission?: Permission) => any; }
Returnsrolecan

useRoles()

Roles and team members: find, name, save and remove roles, assign them and manage invitations.

composables/useRoles.ts
useRoles(): { roles: any; members: any; findRole: (id: string | undefined) => any; roleName: (role: RoleModel | undefined) => any; roleDescription: (role: RoleModel | undefined) => any; membe…
ReturnsrolesmembersfindRoleroleNameroleDescriptionmemberCountsaveRoleremoveRolenextRoleIdassignRoleinviteMemberresendInviteremoveMembers

useSocialSignIn()

signIn(method) signs in with a provider or a passkey and goes to the target route; loading is the method in progress.

composables/useSocialSignIn.ts
useSocialSignIn(target: MaybeRefOrGetter<string>): { loading: any; signIn: (method: AuthSignInMethod) => Promise<void>; }
ReturnsloadingsignIn
© 2026 melsami UI.
Developer documentation for melsami UI.