Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Edfermachado/proyectoSistemas/llms.txt

Use this file to discover all available pages before exploring further.

GET /api/auth/me is a lightweight route that resolves the caller’s active session and returns the full tenant record associated with it. It is primarily consumed by faculty admin UIs to display the current faculty context — for example, the faculty name and slug shown in the admin dashboard header. Because tenant information is encoded in the JWT as a tenantId, this endpoint performs a single database lookup against the tenants table and returns the matching row.

Endpoint

GET /api/auth/me

Authentication

This endpoint requires a valid session HTTP-only cookie containing a JWT with a non-null tenantId claim. The cookie is set automatically when a tenant_admin, event_manager, or access_control user logs in via loginFacultyAdmin. Standard user accounts and superadmin accounts carry a null tenantId and will receive a 401 response. The cookie is sent by the browser automatically with every same-origin request — no manual header is required from the client side.

Request

No request body and no query parameters are accepted. The endpoint derives all required context from the session cookie.

Response

On success the endpoint returns 200 OK with the tenant object from the tenants table serialised as JSON.
{
  "id": "a3f2c1d4-0e5b-4a7f-9c8e-1d2b3e4f5a6b",
  "name": "Facultad de Ingeniería",
  "slug": "facultad-de-ingenieria",
  "description": "Facultad de Ingeniería y Tecnología de la Universidad Central.",
  "universityId": "e7d1a2b3-4c5f-6e7a-8b9c-0d1e2f3a4b5c",
  "categoryId": "f1e2d3c4-b5a6-7890-abcd-ef1234567890",
  "createdAt": "2024-08-15T10:30:00.000Z"
}
id
string
UUID primary key of the tenant (faculty).
name
string
Human-readable name of the faculty. Unique across the platform.
slug
string
URL-safe identifier for the faculty, derived from its name. Unique across the platform.
description
string | null
Optional long-form description of the faculty.
universityId
string | null
UUID of the parent university record this tenant belongs to. References the universities table.
categoryId
string | null
UUID of the category that classifies this tenant (e.g. engineering, arts). References the categories table.
createdAt
string | null
ISO 8601 timestamp of when the tenant was created.

Error Responses

StatusBodyReason
401 Unauthorized{ "error": "Unauthorized" }No session cookie is present, the JWT signature is invalid or expired, or the tenantId claim is null.

Example

cURL

curl -X GET https://your-domain.com/api/auth/me \
  --cookie "session=<your_session_token>"
Replace <your_session_token> with the raw JWT value from the session cookie. In a browser context the cookie is sent automatically; the explicit --cookie flag is only needed for direct API testing.

Successful Response

{
  "id": "a3f2c1d4-0e5b-4a7f-9c8e-1d2b3e4f5a6b",
  "name": "Facultad de Ingeniería",
  "slug": "facultad-de-ingenieria",
  "description": "Facultad de Ingeniería y Tecnología de la Universidad Central.",
  "universityId": "e7d1a2b3-4c5f-6e7a-8b9c-0d1e2f3a4b5c",
  "categoryId": "f1e2d3c4-b5a6-7890-abcd-ef1234567890",
  "createdAt": "2024-08-15T10:30:00.000Z"
}

Unauthorized Response

{
  "error": "Unauthorized"
}

Notes

  • This endpoint is primarily intended for faculty admin UIs. Standard user accounts do not have a tenantId and cannot use this endpoint.
  • The superadmin role also carries a null tenantId and will receive a 401. The super-admin dashboard uses separate endpoints that are not tenant-scoped.
  • The returned object is the raw tenants row. Nested relations (e.g. the full university or category object) are not expanded.

Build docs developers (and LLMs) love