Circulares are the school’s official communication layer: directors post announcements and target them to specific audiences (all users, parents, teachers, or students). When a circular is created, the API automatically builds aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/iamalexis689725/cole/llms.txt
Use this file to discover all available pages before exploring further.
circular_user pivot record for every user in the tenant that matches the target audience, enabling per-user read tracking. Any recipient can mark a circular as read, and directors can query delivery statistics at any time to see how many recipients have or have not opened the announcement.
All endpoints require a valid Sanctum bearer token. The module:circulares middleware must be active on the tenant — if the module is disabled, all routes in this group return a module-not-available error before reaching the controller.
Module Requirement
Every endpoint in this section requires the
circulares module to be enabled for the tenant. This is enforced by the module:circulares middleware applied to all routes in the circulares route group. Contact your tenant administrator if requests are being rejected at the middleware level.Read Endpoints
These endpoints are available to any authenticated user as long as the circulares module is active. Directors receive unfiltered lists; all other roles only see circulars they have been explicitly targeted to receive.List Circulares
GET /api/circulares- Directors receive every circular with the
creatorrelationship included, regardless of audience targeting. - All other roles (parents, students, teachers) only see circulares that were addressed to them, filtered via the
circular_userpivot. Each result also includes the user’s own read status (leido,leido_at) from that pivot row.
Get a Single Circular
GET /api/circulares/{id}- Directors can retrieve any circular in their tenant.
- Other users must have a
circular_userrecord for the circular (i.e., they were in the target audience) or a403 No autorizadois returned.
The ID of the circular to retrieve.
Mark a Circular as Read
POST /api/circulares/{id}/leerleido flag and recording the leido_at timestamp in the circular_user pivot table. This endpoint is idempotent — if the circular is already marked as read, it returns success without modifying the existing leido_at timestamp.
The request will return 404 if the authenticated user does not have a circular_user record for this circular (i.e., they were not in the target audience).
The ID of the circular to mark as read.
Director Endpoints
The following endpoints require the authenticated user to hold the
director role in addition to the circulares module being active. Requests from other roles will be rejected with 403 Forbidden.Create a Circular
POST /api/circulares- Inserts the circular record with
published_atset to the current timestamp. - Queries all users in the tenant matching the
targetaudience. - Bulk-inserts one
circular_userpivot row per recipient withleido = false.
The subject/title of the circular announcement.
The full body text of the circular. HTML or plain text.
Who receives this circular. One of:
all— every user in the tenant.padres— only users with thepadrerole.profesores— only users with theprofesorrole.estudiantes— only users with theestudianterole.
201 Created
ID of the newly created circular.
Title as submitted.
Body text as submitted.
Audience targeting value:
all, padres, profesores, or estudiantes.Tenant the circular belongs to.
User ID of the director who created the circular.
ISO 8601 timestamp when the circular was published (set automatically to
now()).Update a Circular
PUT /api/circulares/{id}titulo and/or contenido of an existing circular. A circular that has been read by at least one recipient cannot be edited. Attempting to do so returns 400 Bad Request with the message "No se puede editar, ya fue leída". This protects the integrity of communication records that users have already acknowledged.
The ID of the circular to update.
New title. Optional — only provided fields are changed.
New body text. Optional — only provided fields are changed.
400 Bad Request
Delete a Circular
DELETE /api/circulares/{id}circular_user pivot rows. The circular must belong to the director’s tenant; attempting to delete a circular from another tenant returns 403 No autorizado.
The ID of the circular to delete.
View Read / Delivery Statistics
GET /api/circulares/{id}/statscircular_user pivot table: total is the number of users the circular was delivered to, leidos is the number who have marked it as read, and pendientes is the difference.
The ID of the circular to retrieve stats for.
Total number of users the circular was delivered to (rows in
circular_user for this circular).Number of recipients who have marked the circular as read (
leido = true).Number of recipients who have not yet read the circular (
total − leidos).Read Tracking — How It Works
The circulares feature uses acircular_user pivot table to track delivery and read receipts on a per-user basis. Here is the full lifecycle:
-
Creation — When a director calls
POST /api/circulares, the API resolves every user in the tenant whose role matchestarget. Onecircular_userrow is inserted per user withleido = falseandleido_at = null. -
Listing — Non-director users only see circulares for which a
circular_userrow exists with theiruser_id. The pivot data (read status) is eager-loaded and returned alongside the circular content. -
Marking as read — When a user calls
POST /api/circulares/{id}/leer, the API looks up the user’s owncircular_userrow and setsleido = trueandleido_at = now(). This operation is guarded so that a circular already marked as read is not updated a second time (the originalleido_atis preserved). -
Statistics —
GET /api/circulares/{id}/statsaggregates counts directly from thecircular_usertable, giving directors a real-time view of how many recipients have and have not acknowledged a circular. - Edit protection — A circular cannot be modified once any recipient has read it. This ensures the read receipt is an accurate acknowledgement of the actual content that was delivered.