Skip to main content

Users and Roles

Each tenant has its own user table, isolated from other tenants.

MCP Tool: create_user

Profile: core

Creates a user within the tenant.

Parameters

ParameterTypeRequiredDescription
tenantSlugstringYesTenant slug
emailstringYesEmail (unique within the tenant)
passwordstringYesPassword (min 8 characters, hashed)
namestringYesFull name
rolestringNoRole: owner, admin, member, viewer. Default: member
permissionsobjectNoPer-entity permissions
metadataobjectNoAdditional data (phone, department, position, avatar)

Roles

RoleDescription
ownerFull control. Can manage everything
adminCan manage users and settings
memberCan create and edit records
viewerRead only

Per-Entity Permissions

{
"entities": {
"productos": ["create", "read", "update", "delete"],
"facturas": ["read", "create"],
"reportes": ["read"]
},
"canManageUsers": false,
"canManageSettings": false
}

Example

create_user({
tenantSlug: "mi-empresa",
email: "vendedor@empresa.com",
password: "password123",
name: "Carlos Vendedor",
role: "member",
permissions: {
entities: {
clientes: ["create", "read", "update"],
productos: ["read"]
}
}
})

Login After Creating

The user can authenticate via REST:

curl -X POST "https://api.fyso.dev/api/auth/tenant/login" \
-H "Content-Type: application/json" \
-H "X-Tenant-ID: mi-empresa" \
-d '{"email":"vendedor@empresa.com","password":"password123"}'

Or via MCP:

tenant_login({
tenantSlug: "mi-empresa",
email: "vendedor@empresa.com",
password: "password123"
})

MCP Tool: list_users

Profile: core

Parameters

ParameterTypeRequiredDescription
tenantSlugstringNoTenant slug. Default: selected tenant

Example

list_users({ tenantSlug: "mi-empresa" })

Response

{
"success": true,
"users": [
{
"id": "uuid",
"email": "admin@empresa.com",
"name": "Admin Principal",
"role": "owner",
"isActive": true,
"lastLogin": "2026-02-18T10:00:00Z"
}
],
"total": 2
}

Passwords are never returned.

MCP Tool: tenant_login

Profile: advanced

Login as a tenant user. Returns a JWT for use with the REST API.

Parameters

ParameterTypeRequiredDescription
tenantSlugstringYesTenant slug
emailstringYesUser email
passwordstringYesPassword

Response

{
"success": true,
"token": "eyJhbGci...",
"user": {
"id": "uuid",
"email": "user@example.com",
"name": "Nombre",
"role": "member"
},
"usage": {
"header": "Authorization",
"value": "Bearer eyJhbGci...",
"note": "Use this token in the Authorization header for REST API calls"
}
}
Creado con Fyso