Public API (Script-Used Endpoints Only)

This page includes only the HTTP endpoints that are actually called by the ActivityManager Lua script (mainly files in server/). Each endpoint includes a short usage note.

Base URL & Required Headers

Base URL used by script: Config.ActivityManager.baseUrl (default https://activitymanager.it).

X-API-Key · Yes

Guild API key (also accepted as query `api_key`).

X-Guild-ID · Yes

Discord guild ID (also accepted as query `guild_id`).

Content-Type · JSON requests

Use `application/json` for POST/PUT bodies.

X-Server-IP · Yes

Server IP validation is enabled.

Endpoints

GET/api/test

Used by: server/main.lua, server/ampanel.lua

How to use: Call it after loading guild config to verify API key + guild headers are valid and the backend is reachable.

Example usage: curl -X GET "https://activitymanager.it/api/test" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678"
GET/api/v1/fivem/guild-config/:guildId

Used by: server/main.lua, server/ampanel.lua

How to use: Fetch runtime config (API key, premium state, script flags) before performing authenticated API actions.

Example usage: curl -X GET "https://activitymanager.it/api/v1/fivem/guild-config/:guildId" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678"
GET/api/v1/fivem/verify-server/:guildId

Used by: server/ampanel.lua

How to use: Validate that the FiveM server/IP is authorized for the target guild before setup operations.

Example usage: curl -X GET "https://activitymanager.it/api/v1/fivem/verify-server/:guildId" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678"
POST/api/shifts/start

Used by: server/main.lua

How to use: Start a shift for a Discord-linked employee from in-game flow.

Example usage: curl -X POST "https://activitymanager.it/api/shifts/start" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678" \ + -H "Content-Type: application/json" \ + -d '{ "discordId": "...", "playerName": "...", "playerId": 1, "inGameId": "..." }'
Sample body: { "discordId": "...", "playerName": "...", "playerId": 1, "inGameId": "..." }
POST/api/shifts/end

Used by: server/main.lua, server/sv_tablet.lua, server/sv_bossmenu_private.lua

How to use: Close an active shift and persist final work data.

Example usage: curl -X POST "https://activitymanager.it/api/shifts/end" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678" \ + -H "Content-Type: application/json" \ + -d '{ "discordId": "...", "reason": "manual|auto" }'
Sample body: { "discordId": "...", "reason": "manual|auto" }
GET/api/shifts/active?discordId=:id

Used by: server/main.lua, server/sv_tablet.lua

How to use: Check whether a specific employee currently has an active shift.

Example usage: curl -X GET "https://activitymanager.it/api/shifts/active?discordId=:id" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678"
GET/api/shifts/completed

Used by: server/sv_bossmenu_private.lua

How to use: Retrieve completed shifts for management UI (supports filters/pagination via query params).

Example usage: curl -X GET "https://activitymanager.it/api/shifts/completed" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678"
PUT/api/shifts/edit

Used by: server/sv_bossmenu_private.lua

How to use: Edit a completed shift from boss menu tools.

Example usage: curl -X PUT "https://activitymanager.it/api/shifts/edit" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678" \ + -H "Content-Type: application/json" \ + -d '{ "shiftId": "...", "turniCompletati": 10 }'
Sample body: { "shiftId": "...", "turniCompletati": 10 }
DELETE/api/shifts/delete

Used by: server/sv_bossmenu_private.lua

How to use: Delete one completed shift record.

Example usage: curl -X DELETE "https://activitymanager.it/api/shifts/delete" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678" \ + -H "Content-Type: application/json" \ + -d '{ "shiftId": "..." }'
Sample body: { "shiftId": "..." }
POST/api/sync/active-shifts

Used by: server/main.lua

How to use: Send the current in-memory active shifts list to backend for reconciliation.

Example usage: curl -X POST "https://activitymanager.it/api/sync/active-shifts" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678" \ + -H "Content-Type: application/json" \ + -d '{ "shifts": [ ... ] }'
Sample body: { "shifts": [ ... ] }
POST/api/v1/invoice/create

Used by: server/main.lua

How to use: Create and register an invoice from gameplay events or billing bridges.

Example usage: curl -X POST "https://activitymanager.it/api/v1/invoice/create" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678" \ + -H "Content-Type: application/json" \ + -d '{ "userId": "...", "cost": 1000, "description": "...", "type": "Fattura" }'
Sample body: { "userId": "...", "cost": 1000, "description": "...", "type": "Fattura" }
POST/api/invoices/create

Used by: server/main.lua

How to use: Invoice create.

Example usage: curl -X POST "https://activitymanager.it/api/invoices/create" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678" \ + -H "Content-Type: application/json" \ + -d '{ "userId": "...", "cost": 1000, "description": "..." }'
Sample body: { "userId": "...", "cost": 1000, "description": "..." }
GET/api/v1/invoice/list/:userId

Used by: server/main.lua, server/sv_tablet.lua, server/sv_bossmenu_private.lua

How to use: Get invoices for one employee (often with `?limit=&skip=`).

Example usage: curl -X GET "https://activitymanager.it/api/v1/invoice/list/:userId" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678"
PUT/api/v1/invoice/:id

Used by: server/main.lua, server/sv_tablet.lua, server/sv_bossmenu_private.lua

How to use: Edit invoice object/type/amount.

Example usage: curl -X PUT "https://activitymanager.it/api/v1/invoice/:id" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678" \ + -H "Content-Type: application/json" \ + -d '{ "cost": 1200, "object": "Updated" }'
Sample body: { "cost": 1200, "object": "Updated" }
DELETE/api/v1/invoice/:id

Used by: server/main.lua, server/sv_tablet.lua, server/sv_bossmenu_private.lua

How to use: Delete one invoice entry.

Example usage: curl -X DELETE "https://activitymanager.it/api/v1/invoice/:id" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678"
GET/api/v1/guild/:guildId/invoice-types

Used by: server/main.lua, server/sv_tablet.lua

How to use: Read configured invoice categories for UI/forms.

Example usage: curl -X GET "https://activitymanager.it/api/v1/guild/:guildId/invoice-types" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678"
GET/api/user/:userId/balance

Used by: server/main.lua, server/sv_tablet.lua, server/sv_bossmenu_private.lua

How to use: Fetch employee totals: invoices, shifts, earnings summary.

Example usage: curl -X GET "https://activitymanager.it/api/user/:userId/balance" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678"
GET/api/player/:discordId/role

Used by: server/main.lua, server/sv_tablet.lua, server/sv_bossmenu_private.lua

How to use: Get highest Discord role recognized by ActivityManager role earnings.

Example usage: curl -X GET "https://activitymanager.it/api/player/:discordId/role" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678"
GET/api/player/:userId

Used by: server/main.lua

How to use: Legacy player data request still referenced in script.

Example usage: curl -X GET "https://activitymanager.it/api/player/:userId" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678"
GET/api/balance/:identifier

Used by: server/main.lua

How to use: Legacy balance endpoint.

Example usage: curl -X GET "https://activitymanager.it/api/balance/:identifier" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678"
POST/api/player/map

Used by: server/fivem_auto_mapping.lua

How to use: Map current FiveM player identity to a Discord user.

Example usage: curl -X POST "https://activitymanager.it/api/player/map" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678" \ + -H "Content-Type: application/json" \ + -d '{ "discordId": "...", "fivemIdentifier": "..." }'
Sample body: { "discordId": "...", "fivemIdentifier": "..." }
POST/api/player-mapping/register

Used by: server/main.lua

How to use: Register/update persistent mapping used across shifts/invoices.

Example usage: curl -X POST "https://activitymanager.it/api/player-mapping/register" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678" \ + -H "Content-Type: application/json" \ + -d '{ "discordId": "...", "playerName": "...", "identifier": "..." }'
Sample body: { "discordId": "...", "playerName": "...", "identifier": "..." }
POST/api/recruitment/send-invite

Used by: server/main.lua

How to use: Send a Discord invite for recruitment from in-game command flow.

Example usage: curl -X POST "https://activitymanager.it/api/recruitment/send-invite" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678" \ + -H "Content-Type: application/json" \ + -d '{ "guildId": "...", "discordId": "..." }'
Sample body: { "guildId": "...", "discordId": "..." }
GET/api/v1/tablet/management-overview

Used by: server/sv_tablet.lua, server/sv_bossmenu_private.lua

How to use: Load management dashboard totals for tablet/bossmenu.

Example usage: curl -X GET "https://activitymanager.it/api/v1/tablet/management-overview" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678"
GET/api/v1/bossmenu/guild-roles

Used by: server/sv_bossmenu_private.lua

How to use: Load Discord roles to hire/fire/change-rank employees.

Example usage: curl -X GET "https://activitymanager.it/api/v1/bossmenu/guild-roles" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678"
POST/api/v1/bossmenu/hire

Used by: server/sv_bossmenu_private.lua

How to use: Assign employee role(s) to a Discord target.

Example usage: curl -X POST "https://activitymanager.it/api/v1/bossmenu/hire" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678" \ + -H "Content-Type: application/json" \ + -d '{ "guildId": "...", "targetDiscordId": "...", "roleIds": ["..."] }'
Sample body: { "guildId": "...", "targetDiscordId": "...", "roleIds": ["..."] }
POST/api/v1/bossmenu/fire

Used by: server/sv_bossmenu_private.lua

How to use: Remove employee role(s) from a Discord target.

Example usage: curl -X POST "https://activitymanager.it/api/v1/bossmenu/fire" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678" \ + -H "Content-Type: application/json" \ + -d '{ "guildId": "...", "targetDiscordId": "..." }'
Sample body: { "guildId": "...", "targetDiscordId": "..." }
POST/api/v1/bossmenu/change-nickname

Used by: server/sv_bossmenu_private.lua

How to use: Set employee nickname from boss menu.

Example usage: curl -X POST "https://activitymanager.it/api/v1/bossmenu/change-nickname" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678" \ + -H "Content-Type: application/json" \ + -d '{ "guildId": "...", "targetDiscordId": "...", "nickname": "..." }'
Sample body: { "guildId": "...", "targetDiscordId": "...", "nickname": "..." }
POST/api/v1/bossmenu/bonus

Used by: server/sv_bossmenu_private.lua

How to use: Add or remove bonus for an employee.

Example usage: curl -X POST "https://activitymanager.it/api/v1/bossmenu/bonus" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678" \ + -H "Content-Type: application/json" \ + -d '{ "guildId": "...", "userId": "...", "amount": 1000 }'
Sample body: { "guildId": "...", "userId": "...", "amount": 1000 }
POST/api/v1/warn/create

Used by: server/sv_bossmenu_private.lua

How to use: Create a warning entry from in-game management.

Example usage: curl -X POST "https://activitymanager.it/api/v1/warn/create" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678" \ + -H "Content-Type: application/json" \ + -d '{ "guildId": "...", "userId": "...", "reason": "..." }'
Sample body: { "guildId": "...", "userId": "...", "reason": "..." }
GET/api/v1/bossmenu/reports

Used by: server/sv_bossmenu_private.lua

How to use: List reports for payroll/review.

Example usage: curl -X GET "https://activitymanager.it/api/v1/bossmenu/reports" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678"
GET/api/v1/bossmenu/reports/:reportId

Used by: server/sv_bossmenu_private.lua

How to use: Load one report details.

Example usage: curl -X GET "https://activitymanager.it/api/v1/bossmenu/reports/:reportId" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678"
DELETE/api/v1/bossmenu/reports/:reportId

Used by: server/sv_bossmenu_private.lua

How to use: Delete one report.

Example usage: curl -X DELETE "https://activitymanager.it/api/v1/bossmenu/reports/:reportId" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678"
POST/api/v1/bossmenu/create-report

Used by: server/sv_bossmenu_private.lua

How to use: Generate a new report snapshot.

Example usage: curl -X POST "https://activitymanager.it/api/v1/bossmenu/create-report" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678" \ + -H "Content-Type: application/json" \ + -d '{ "guildId": "..." }'
Sample body: { "guildId": "..." }
GET/api/v1/fivem/guild-channels/:guildId

Used by: server/sv_inventory_public.lua

How to use: Load text channels for inventory tracking setup UI.

Example usage: curl -X GET "https://activitymanager.it/api/v1/fivem/guild-channels/:guildId" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678"
POST/api/v1/fivem/send-channel-message

Used by: server/sv_inventory_private.lua

How to use: Send Discord embed/message for inventory logs.

Example usage: curl -X POST "https://activitymanager.it/api/v1/fivem/send-channel-message" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678" \ + -H "Content-Type: application/json" \ + -d '{ "guildId": "...", "channelId": "...", "embed": { ... } }'
Sample body: { "guildId": "...", "channelId": "...", "embed": { ... } }
POST/api/v1/fivem/update-channel-message

Used by: server/sv_inventory_private.lua

How to use: Edit an existing Discord message (inventory status embed).

Example usage: curl -X POST "https://activitymanager.it/api/v1/fivem/update-channel-message" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678" \ + -H "Content-Type: application/json" \ + -d '{ "guildId": "...", "channelId": "...", "messageId": "...", "embed": { ... } }'
Sample body: { "guildId": "...", "channelId": "...", "messageId": "...", "embed": { ... } }
GET/api/v1/loyalty/check-premium/:guildId

Used by: server/sv_loyalty.lua

How to use: Verify loyalty feature availability for current guild.

Example usage: curl -X GET "https://activitymanager.it/api/v1/loyalty/check-premium/:guildId" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678"
POST/api/v1/loyalty/add-points

Used by: server/sv_loyalty.lua

How to use: Add loyalty points to a citizen card.

Example usage: curl -X POST "https://activitymanager.it/api/v1/loyalty/add-points" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678" \ + -H "Content-Type: application/json" \ + -d '{ "citizenId": "...", "citizenName": "...", "points": 5, "performedBy": "..." }'
Sample body: { "citizenId": "...", "citizenName": "...", "points": 5, "performedBy": "..." }
POST/api/v1/loyalty/remove-points

Used by: server/sv_loyalty.lua

How to use: Remove loyalty points from a citizen card.

Example usage: curl -X POST "https://activitymanager.it/api/v1/loyalty/remove-points" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678" \ + -H "Content-Type: application/json" \ + -d '{ "citizenId": "...", "citizenName": "...", "points": 5, "performedBy": "..." }'
Sample body: { "citizenId": "...", "citizenName": "...", "points": 5, "performedBy": "..." }
GET/api/v1/loyalty/points/:citizenId

Used by: server/sv_loyalty.lua

How to use: Read current points for one citizen.

Example usage: curl -X GET "https://activitymanager.it/api/v1/loyalty/points/:citizenId" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678"
GET/api/v1/loyalty/list?limit=500&sortBy=points&order=desc

Used by: server/sv_loyalty.lua

How to use: Read ranked loyalty list for management UI.

Example usage: curl -X GET "https://activitymanager.it/api/v1/loyalty/list?limit=500&sortBy=points&order=desc" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678"
PUT/api/v1/loyalty/update/:citizenId

Used by: server/sv_loyalty.lua

How to use: Set an exact loyalty points value.

Example usage: curl -X PUT "https://activitymanager.it/api/v1/loyalty/update/:citizenId" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678" \ + -H "Content-Type: application/json" \ + -d '{ "points": 120, "performedBy": "..." }'
Sample body: { "points": 120, "performedBy": "..." }
DELETE/api/v1/loyalty/delete/:citizenId

Used by: server/sv_loyalty.lua

How to use: Delete a loyalty card entry.

Example usage: curl -X DELETE "https://activitymanager.it/api/v1/loyalty/delete/:citizenId" \ + -H "X-API-Key: am_xxx" \ + -H "X-Guild-ID: 123456789012345678"

Important Notes

  • Some endpoints above are legacy calls still present in Lua code paths.
  • If you build a custom system, always send X-API-Key and X-Guild-ID.
  • Use JSON payloads for POST/PUT and keep field names aligned with your script-side request objects.