v beta-2.0.1 Released

Referência da API REST

05 de janeiro de 2026
beta-2.0.1
Time Técnico NexarSystems

Esta seção contém a documentação técnica detalhada de todos os endpoints da API do NexarGrid.

# Catálogo de Serviços e Endpoints

Abaixo está a lista completa de endpoints disponíveis na API do NexarGrid, organizados por serviço.

# Serviço: attendance

Método Endpoint Ação
GET /api/attendance/test test

# Serviço: billing

Método Endpoint Ação
POST /api/billing/batch/approve approveBatch
POST /api/billing/batch/reject rejectBatch
POST /api/billing/batch/totals getBatchTotals
POST /api/billing/entry/create createEntry
POST /api/billing/entry/create-batch createBatch
POST /api/billing/entry/delete deleteEntry
POST /api/billing/entry/get getEntry
POST /api/billing/entry/list listEntries
POST /api/billing/entry/update updateEntry
POST /api/billing/parameter/create createParameter
POST /api/billing/parameter/delete deleteParameter
POST /api/billing/parameter/get getParameter
POST /api/billing/parameter/list listParameters
POST /api/billing/parameter/update updateParameter
POST /api/billing/report/entry-breakdown getEntryBreakdown
POST /api/billing/report/payment-cycle getPaymentCycleReport
POST /api/billing/report/payment-summary getPaymentSummary

# Serviço: calendargrid

Método Endpoint Ação
POST /api/calendargrid/create createCalendarGridItems
POST /api/calendargrid/create-single createSingleCalendarGridItem
POST /api/calendargrid/get-calendar-grid-items getCalendarGridItems
POST /api/calendargrid/get-future-calendar-grid-items getFutureCalendarGridItems
POST /api/calendargrid/remove-calendar-grid-items removeCalendarGridItems
POST /api/calendargrid/split-calendar-grid-item splitCalendarGridItem
POST /api/calendargrid/trigger-fsm-publication triggerFSMPublication
POST /api/calendargrid/update-calendar-grid-item updateCalendarGridItem

# Serviço: client

Método Endpoint Ação
POST /api/client/create createClient
DELETE /api/client/delete deleteClient
POST /api/client/get-client getClientById
GET /api/client/list listClients
GET /api/client/test test
PUT /api/client/update updateClient
POST /api/client/update-projects updateProjects

# Serviço: collision

Método Endpoint Ação
POST /api/collision/check-shift-item checkShiftItemCollisions
GET /api/collision/grid/{gridId} listGridCollisions
GET /api/collision/health health
POST /api/collision/recheck/{shiftItemId} recheckShiftItem
POST /api/collision/resolve resolveCollision
GET /api/collision/shift-item/{shiftItemId} getShiftItemCollisions
POST /api/collision/vacate-rostereds vacateRostereds

# Exemplos Práticos: Detecção de Colisões

Verificar Colisões (/api/collision/check-shift-item)

O backend retorna um objeto detalhado indicando se há conflitos de horário, cruzando informações de diferentes projetos e grades.

Resposta de Exemplo (Com Colisão):

{
    "id": "collision:01K87...",
    "rosteredId": "rostered:01K...",
    "hasCollision": true,
    "detectedAt": "2025-10-23T08:07:16.234Z",
    "conflicts": [
        {
            "type": "time_overlap",
            "severity": "high",
            "conflictingShiftItemId": "shiftItem:01K87KWA37VW7MNY1D7HR93RYP",
            "conflictingGridId": "grid:01K87KTQJ625CVXKXKKZ992JME",
            "conflictingProjectId": "project:01K02795GBBRQDXN2RM63DVEJ0",
            "startTime": "07:00",
            "endTime": "13:00",
            "message": "Sobreposição de horário detectada com outro plantão.",
            "currentWeekDayName": "Segunda-feira",
            "currentProjectName": "Hospital São Lucas",
            "currentGridName": "Escala Médicos - Janeiro 2025",
            "conflictWeekDayName": "Segunda-feira",
            "conflictProjectName": "Clínica Central",
            "conflictGridName": "Plantão Emergência"
        }
    ],
    "involvedShiftItems": [
        "shiftItem:CURRENT_ID",
        "shiftItem:01K87KWA37VW7MNY1D7HR93RYP"
    ]
}

# Serviço: errorhandler

Método Endpoint Ação
GET /api/errorhandler/test test

# Serviço: grid

Método Endpoint Ação
POST /api/grid/create createGrid
POST /api/grid/create-publication createGridPublication
POST /api/grid/create-publication-snapshot createGridPublicationSnapshot
DELETE /api/grid/delete deleteGrid
POST /api/grid/get-grid getGridById
POST /api/grid/get-grid-publications getGridPublications
POST /api/grid/get-shift-packs getShiftPacks
GET /api/grid/list listGrids
POST /api/grid/reset-structure resetGridStructure
POST /api/grid/rollback-to-snapshot rollbackToSnapshot
POST /api/grid/sync-ratecards syncRateCardsToShiftItems
GET /api/grid/test test
PUT /api/grid/update updateGrid

# Serviço: health

Método Endpoint Ação
GET /api/health/test test

# Serviço: imednetsync

Método Endpoint Ação
POST /api/imednetsync/list syncProjectRostereds
POST /api/imednetsync/professional/search syncUserFromLogin

# Serviço: io

Método Endpoint Ação
POST /api/io/send-alert sendAlert
POST /api/io/test-publication-progress testPublicationProgress
POST /api/io/trigger-shift-update triggerShiftUpdate

# Serviço: logging

Método Endpoint Ação
POST /api/logging/register register

# Serviço: notification

Método Endpoint Ação
GET /api/notification/test test

# Serviço: payment

Método Endpoint Ação
POST /api/payment/clone clonePaymentRule
POST /api/payment/create createPaymentRule
DELETE /api/payment/delete deletePaymentRule
POST /api/payment/ensure-default ensureDefaultPaymentRule
POST /api/payment/get-payment-rule-by-project-id getPaymentRuleCompactByProjectId
POST /api/payment/get-payment-rule-compact getPaymentRuleCompact
POST /api/payment/get-payment-rules getPaymentRules
POST /api/payment/get-project-payment-rules getProjectPaymentRules
POST /api/payment/preview-rules previewPaymentRules
POST /api/payment/recalc-shift-items recalcShiftItemsByRule
POST /api/payment/resolve-for-shift resolvePaymentForShift
POST /api/payment/update updatePaymentRules

# Serviço: people

Método Endpoint Ação
POST /api/people/auth auth
POST /api/people/resetpass resetpass
POST /api/people/send-reauth-email-message sendReauthEmailMessage
POST /api/people/send-sms-message sendSMSMessage
POST /api/people/send-whatsapp-message sendWhatsappMessage
POST /api/people/signup login
POST /api/people/verify-totp verifyotp

# Exemplos Práticos: Autenticação

Login (/api/people/auth)

Requisição:

{
  "email": "[email protected]",
  "password": "senha_segura_123",
  "device_id": "web-client-v1"
}

Resposta (Sucesso 200 OK):

{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "user": {
    "id": "usr_123456789",
    "name": "Dr. Silva",
    "email": "[email protected]",
    "roles": ["doctor", "scheduler"]
  },
  "expiresIn": 3600
}

# Serviço: project

Método Endpoint Ação
POST /api/project/create createProject
DELETE /api/project/delete deleteProject
POST /api/project/get-project getProjectById
POST /api/project/get-project-grids getProjectGrids
GET /api/project/list listProjects
PUT /api/project/update updateProject
POST /api/project/update-grids updateGrids

# Serviço: publishFSM

Método Endpoint Ação
GET /api/publishFSM/health health

# Serviço: reporting

Método Endpoint Ação
POST /api/reporting/enrich-export enrichShiftItemsForExport
POST /api/reporting/fetch-export fetchItemsForExport

# Serviço: rostered

Método Endpoint Ação
POST /api/rostered/create createRostered
DELETE /api/rostered/delete deleteRostered
POST /api/rostered/get-rostered getRosteredById
POST /api/rostered/get-rostereds-in-project getRosteredsInProject
GET /api/rostered/list listRostereds
POST /api/rostered/relationships/by-project getRelationshipsByProject
POST /api/rostered/relationships/by-rostered getRelationshipsByRostered
POST /api/rostered/relationships/deactivate deactivateRelationship
DELETE /api/rostered/relationships/delete deleteRelationship
GET /api/rostered/relationships/get-one getOneRelationship
POST /api/rostered/relationships/upsert upsertRelationship
GET /api/rostered/test test
PUT /api/rostered/update updateRostered

# Serviço: shiftItem

Método Endpoint Ação
POST /api/shiftItem/clean-rostered cleanRosteredInShiftItem
POST /api/shiftItem/create createShiftItem
POST /api/shiftItem/delete-shift-items deleteShiftItems
DELETE /api/shiftItem/delete/{id} deleteShiftItem
GET /api/shiftItem/get/{id} getShiftItemById
GET /api/shiftItem/list listShiftItems
POST /api/shiftItem/split-shift-item splitShiftItem
POST /api/shiftItem/sync-payment-rule-by-grid syncPaymentRuleByGrid
POST /api/shiftItem/sync-rate-rules syncRateRulesToShiftItems
PUT /api/shiftItem/update-rostered updateRosteredInShiftItem
PUT /api/shiftItem/update-rostered-from-drop updateRosteredFromDrop
POST /api/shiftItem/update-rotation updateShiftItemRotation
POST /api/shiftItem/update-shift-full updateShiftFull
POST /api/shiftItem/update-shift-rotation updateShiftRotation
POST /api/shiftItem/update-shift-rotation-mode updateShiftRotationMode
POST /api/shiftItem/update-slot-reference updateShiftItemSlotReference
PUT /api/shiftItem/update/{id} updateShiftItem

# Serviço: shiftPack

Método Endpoint Ação
POST /api/shiftPack/clone-bulk-slots cloneBulkSlots
POST /api/shiftPack/clone-shift-pack cloneShiftPack
POST /api/shiftPack/clone-slot cloneSlot
POST /api/shiftPack/create createShiftPack
DELETE /api/shiftPack/delete deleteShiftPack
POST /api/shiftPack/delete-bulk-shift-items deleteBulkShiftItems
POST /api/shiftPack/delete-slot-group deleteSlotGroup
POST /api/shiftPack/format-bulk-slots formatBulkSlots
POST /api/shiftPack/format-slot formatSlot
POST /api/shiftPack/get-shift-pack getShiftPackById
POST /api/shiftPack/get-shift-packs getShiftPacks
GET /api/shiftPack/list listShiftPacks
POST /api/shiftPack/remove-slot removeSlot
POST /api/shiftPack/set-slot-state setSlotState
PUT /api/shiftPack/slots-shiftitems updateSlotsAndShiftItems
PUT /api/shiftPack/update updateShiftPack
POST /api/shiftPack/update-slot-attributes updateSlotAttributes
POST /api/shiftPack/update-slot-group-name updateSlotGroupName
POST /api/shiftPack/update-slot-name updateSlotName
POST /api/shiftPack/update-slot-regime updateSlotRegime
POST /api/shiftPack/update-slots updateShiftPackSlots

# Exemplos Práticos: Gestão de Escalas

Criar Pacote de Plantões (/api/shiftPack/create)

Este endpoint inicializa um novo pacote de escalas para uma unidade e mês específicos.

Requisição:

{
  "unitId": "unit_uti_central",
  "month": "2025-02",
  "year": 2025,
  "status": "draft",
  "name": "Escala UTI Central - Fevereiro 2025",
  "config": {
    "allowOvertime": true,
    "minRestHours": 11
  }
}

Resposta (Sucesso 200 OK):

{
  "id": "sp_987654321",
  "unitId": "unit_uti_central",
  "month": "2025-02",
  "status": "draft",
  "createdAt": "2024-12-22T14:30:00Z",
  "slots": []
}

Criar Item de Plantão (/api/shiftItem/create)

Adiciona um plantão específico dentro de um pacote ou grade existente.

Requisição:

{
  "shiftPackId": "sp_987654321",
  "date": "2025-02-01",
  "startTime": "07:00",
  "endTime": "19:00",
  "specialty": "intensivist",
  "rosteredId": "doc_456",
  "value": 1200.00
}

Resposta (Sucesso 200 OK):

{
  "id": "si_11223344",
  "date": "2025-02-01",
  "duration": 12,
  "status": "assigned",
  "rostered": {
    "id": "doc_456",
    "name": "Dra. Santos"
  }
}

# Serviço: user

Método Endpoint Ação
POST /api/user/check-user-status checkUserStatus
POST /api/user/create createUser
DELETE /api/user/delete deleteUser
POST /api/user/get-user getUserById
POST /api/user/get-user-by-email getUserByEmail
GET /api/user/list listUsers
GET /api/user/test test
PUT /api/user/update updateUser