diff --git a/src/app/v5/api/contacts/page.mdx b/src/app/v5/api/contacts/page.mdx new file mode 100644 index 0000000..4bd989d --- /dev/null +++ b/src/app/v5/api/contacts/page.mdx @@ -0,0 +1,1637 @@ +## Table Of Contents +- [Overview](#overview) +- [Rest Endpoints](#endpoints) + * Auth + * [**/auth** `GET`](#get-auth) + * [**/auth/callback2** `GET`](#get-authcallback2) + * [**/auth/tokencallback** `GET`](#get-authtokencallback) + * Status + * [**/status** `GET`](#get-status) + * Effects + * [**/effects** `GET`](#get-effects) + * [**/effects** `POST`](#post-effects) + * [**/effects/preset** `GET`](#get-effectspreset) + * [**/effects/:effectId** `GET`](#get-effectseffectid) + * [**/effects/preset/:presetListId** `GET`](#get-effectspresetpresetlistid) + * [**/effects/preset/:presetListId** `POST`](#post-effectspresetpresetlistid) + * [**/effects/preset/:presetListId/run** `GET`](#get-effectspresetpresetlistidrun) + * [**/effects/preset/:presetListId/run** `POST`](#post-effectspresetpresetlistidrun) + * Fonts + * [**/fonts** `GET`](#get-fonts) + * [**/fonts/:name** `GET`](#get-fontsname) + * Custom-variables + * [**/custom-variables** `GET`](#get-custom-variables) + * [**/custom-variables/:variableName** `GET`](#get-custom-variablesvariablename) + * [**/custom-variables/:variableName** `POST`](#post-custom-variablesvariablename) + * Variables + * [**/variables** `GET`](#get-variables) + * Viewers + * [**/viewers** `GET`](#get-viewers) + * [**/viewers/export** `GET`](#get-viewersexport) + * [**/viewers/:userId** `GET`](#get-viewersuserid) + * [**/viewers/:userId/metadata/:metadataKey** `POST`](#post-viewersuseridmetadatametadatakey) + * [**/viewers/:userId/metadata/:metadataKey** `PUT`](#put-viewersuseridmetadatametadatakey) + * [**/viewers/:userId/metadata/:metadataKey** `DELETE`](#delete-viewersuseridmetadatametadatakey) + * [**/viewers/:userId/currency** `GET`](#get-viewersuseridcurrency) + * [**/viewers/:userId/currency/:currencyId** `GET`](#get-viewersuseridcurrencycurrencyid) + * [**/viewers/:userId/currency/:currencyId** `POST`](#post-viewersuseridcurrencycurrencyid) + * [**/viewers/:userId/customRoles** `GET`](#get-viewersuseridcustomroles) + * [**/viewers/:userId/customRoles/:customRoleId** `POST`](#post-viewersuseridcustomrolescustomroleid) + * [**/viewers/:userId/customRoles/:customRoleId** `DELETE`](#delete-viewersuseridcustomrolescustomroleid) + * CustomRoles + * [**/customRoles** `GET`](#get-customroles) + * [**/customRoles/:customRoleId** `GET`](#get-customrolescustomroleid) + * [**/customRoles/:customRoleId/clear** `GET`](#get-customrolescustomroleidclear) + * [**/customRoles/:customRoleId/viewer/:userId** `POST`](#post-customrolescustomroleidvieweruserid) + * [**/customRoles/:customRoleId/viewer/:userId** `DELETE`](#delete-customrolescustomroleidvieweruserid) + * Currency + * [**/currency** `GET`](#get-currency) + * [**/currency/:currencyName** `GET`](#get-currencycurrencyname) + * [**/currency/:currencyName/top** `GET`](#get-currencycurrencynametop) + * Quotes + * [**/quotes** `GET`](#get-quotes) + * [**/quotes** `POST`](#post-quotes) + * [**/quotes/:quoteId** `GET`](#get-quotesquoteid) + * [**/quotes/:quoteId** `PUT`](#put-quotesquoteid) + * [**/quotes/:quoteId** `PATCH`](#patch-quotesquoteid) + * [**/quotes/:quoteId** `DELETE`](#delete-quotesquoteid) + * Counters + * [**/counters** `GET`](#get-counters) + * [**/counters/:counterId** `GET`](#get-counterscounterid) + * [**/counters/:counterId** `POST`](#post-counterscounterid) + * Timers + * [**/timers** `GET`](#get-timers) + * [**/timers/:timerId** `GET`](#get-timerstimerid) + * [**/timers/:timerId/:action** `GET`](#get-timerstimeridaction) + * Queues + * [**/queues** `GET`](#get-queues) + * [**/queues/:queueId** `GET`](#get-queuesqueueid) + * [**/queues/:queueId/pause** `GET`](#get-queuesqueueidpause) + * [**/queues/:queueId/pause** `POST`](#post-queuesqueueidpause) + * [**/queues/:queueId/resume** `GET`](#get-queuesqueueidresume) + * [**/queues/:queueId/resume** `POST`](#post-queuesqueueidresume) + * [**/queues/:queueId/toggle** `GET`](#get-queuesqueueidtoggle) + * [**/queues/:queueId/toggle** `POST`](#post-queuesqueueidtoggle) + * [**/queues/:queueId/clear** `GET`](#get-queuesqueueidclear) + * [**/queues/:queueId/clear** `POST`](#post-queuesqueueidclear) +- [WebSocket Endpoint](#ws-endpoint) + +# Overview +Firebot hosts a local API that developers can use to get data from Firebot or tell it to run effects. +* The API is hosted on port **7472**. All endpoints have the root **http://localhost:7472/api/v1** +* All responses are in JSON. +* Don't forget that Firebot must be running for the API to be available. + +# Endpoints + +## Authentication + +### `GET /auth` + +#### Description: + +Redirects the user to the authorization URI of the specified authentication provider. + +#### Query Parameters: + +- `providerId` `string`: The ID of the authentication provider. + +#### Example Request (URL): + +``` +GET /auth?providerId=google + +``` + +#### Example Response (Redirect): + +This will redirect the user to the authorization URI of the specified provider (e.g., Google OAuth2 authorization page). + +```http +HTTP/1.1 302 Found +Location: https://accounts.google.com/o/oauth2/auth?client_id=...&redirect_uri=...&response_type=code&scope=... + +``` + +### `GET /auth/callback2` + +#### Description: + +Callback endpoint for authentication providers after user authorization. It exchanges the authorization code or token +for an access token. + +#### Query Parameters: + +- `state` `string`: The provider ID passed in the initial authentication request, used to identify the provider. + +#### Example Request (URL): + +``` +GET /auth/callback2?state=google&code=authorizationCodeHere + +``` + +#### Example Response (Redirect): + +Upon success, redirects to the login success page. + +```http +HTTP/1.1 302 Found +Location: /loginsuccess?provider=google + +``` + +#### Example Response (Error): + +If the `state` parameter is invalid or missing, returns an error response. + +```json +{ +"error": "Invalid provider id in state" +} + +``` + +If the authentication fails (e.g., invalid token exchange or an OAuth error), the response will be: + +```json +{ +"error": "Authentication failed" +} + +``` + +## Status + +### `GET /status` + +#### Description: + +Fetches the current status of the application's connections, specifically the chat connection status. + +#### Example Response (JSON): + +```json +{ +"connections": { +"chat": true +} +} + +``` + +## Effects + +### `GET /effects` + +#### Description: + +Fetches all available effect definitions. Optionally, filters them by trigger type if the `trigger` query parameter is +provided. + +#### Query Parameters: + +- `trigger` `string: optional`: The type of trigger to filter the effects by. + +#### Example Request (URL): + +``` +GET /effects?trigger=someTriggerType + +``` + +#### Example Response (JSON): + +```json +[ +{ +"id": "effect1", +"name": "Effect 1", +"description": "Description of effect 1", +"triggers": ["someTriggerType"] +}, +{ +"id": "effect2", +"name": "Effect 2", +"description": "Description of effect 2" +} +] + +``` + +### `GET /effects/:effectId` + +#### Description: + +Fetches the details of a specific effect by its `effectId`. + +#### URL Parameters: + +- `effectId` `string`: The ID of the effect to fetch. + +#### Example Request (URL): + +``` +GET /effects/effect1 + +``` + +#### Example Response (JSON): + +```json +{ +"id": "effect1", +"name": "Effect 1", +"description": "Description of effect 1", +"triggers": ["someTriggerType"] +} + +``` + +#### Example Response (Error): + +```json +{ +"status": "error", +"message": "Cannot find effect 'effect1'" +} + +``` + +### `POST /effects` + +#### Description: + +Triggers one or more effects with optional trigger data. Requires a request body containing an array of effects to run. + +#### Request Body (JSON): + +```json +{ +"effects": [ +{ "id": "effect1" }, +{ "id": "effect2" } +], +"triggerData": { +"username": "API Call" +} +} + +``` + +#### Example Response (Success): + +```json +{ +"status": "success" +} + +``` + +#### Example Response (Error): + +```json +{ +"status": "error", +"message": "No effects provided." +} + +``` + +### `GET /effects/preset` + +#### Description: + +Fetches a list of all preset effect lists, including their IDs and associated arguments. + +#### Example Response (JSON): + +```json +[ +{ +"id": "preset1", +"name": "Preset 1", +"args": ["arg1", "arg2"] +}, +{ +"id": "preset2", +"name": "Preset 2", +"args": ["arg1"] +} +] + +``` + +### `GET /effects/preset/:presetListId` + +#### Description: + +Runs the specified preset effect list synchronously (i.e., waits for the effects to complete before responding). + +#### URL Parameters: + +- `presetListId` `string`: The ID of the preset effect list to run. + +#### Example Request (URL): + +``` +GET /effects/preset/preset1 + +``` + +#### Example Response (Success): + +```json +{ +"status": "success" +} + +``` + +#### Example Response (Error): + +```json +{ +"status": "error", +"message": "Cannot find preset effect list 'preset1'" +} + +``` + +### `POST /effects/preset/:presetListId` + +#### Description: + +Runs the specified preset effect list synchronously with optional arguments and username. + +#### URL Parameters: + +- `presetListId` `string`: The ID of the preset effect list to run. + +#### Request Body (JSON): + +```json +{ +"username": "testuser", +"args": { "arg1": "value1", "arg2": "value2" } +} + +``` + +#### Example Response (Success): + +```json +{ +"status": "success" +} + +``` + +#### Example Response (Error): + +```json +{ +"status": "error", +"message": "Cannot find preset effect list 'preset1'" +} + +``` + +### `GET /effects/preset/:presetListId/run` + +#### Description: + +Triggers the specified preset effect list asynchronously (i.e., doesn't wait for the effects to complete). + +#### URL Parameters: + +- `presetListId` `string`: The ID of the preset effect list to run. + +#### Example Request (URL): + +``` +GET /effects/preset/preset1/run + +``` + +#### Example Response (Success): + +```json +{ +"status": "success" +} + +``` + +#### Example Response (Error): + +```json +{ +"status": "error", +"message": "Cannot find preset effect list 'preset1'" +} + +``` + +### `POST /effects/preset/:presetListId/run` + +#### Description: + +Triggers the specified preset effect list asynchronously with optional arguments and username. + +#### URL Parameters: + +- `presetListId` `string`: The ID of the preset effect list to run. + +#### Request Body (JSON): + +```json +{ +"username": "testuser", +"args": { "arg1": "value1", "arg2": "value2" } +} + +``` + +#### Example Response (Success): + +```json +{ +"status": "success" +} + +``` + +#### Example Response (Error): + +```json +{ +"status": "error", +"message": "Cannot find preset effect list 'preset1'" +} + +``` + +## Fonts + +### `GET /fonts` + +#### Description: + +Fetches a list of all installed fonts, including their names and formats. + +#### Example Response (JSON): + +```json +[ +{ +"name": "Arial", +"format": "TrueType" +}, +{ +"name": "Helvetica", +"format": "OpenType" +} +] + +``` + +### `GET /fonts/:name` + +#### Description: + +Fetches the font file for a specific font by its name. Returns the font file if it exists on the server. + +#### URL Parameters: + +- `name` `string`: The name of the font to fetch. + +#### Example Request (URL): + +``` +GET /fonts/Arial + +``` + +#### Example Response (File): + +The server will send the font file (e.g., `.ttf` or `.otf`) in response. This will be handled by the browser, which may +download or render the font depending on its capabilities. + +#### Example Response (Error): + +If the font is not found: + +```json +{ +"status": "error", +"message": "/fonts/Arial not found" +} + +``` + +## Custom Variables + +### `GET /custom-variables` + +#### Description: +Fetches all custom variables in the system. + +#### Example Response (JSON): +```json +[ +{ +"name": "var1", +"data": "some data", +"ttl": 3600 +}, +{ +"name": "var2", +"data": "more data", +"ttl": 0 +} +] +``` + +### `GET /custom-variables/:variableName` + +#### Description: +Fetches the value of a specific custom variable by its `variableName`. + +#### URL Parameters: +- `variableName` `string`: The name of the custom variable to retrieve. + +#### Example Request (URL): +``` +GET /custom-variables/var1 +``` + +#### Example Response (JSON): +```json +{ +"name": "var1", +"data": "some data", +"ttl": 3600 +} +``` + +### `POST /custom-variables/:variableName` + +#### Description: +Sets a custom variable by its `variableName`. The request body should contain the data and optional TTL (time-to-live) +for the variable. + +#### URL Parameters: +- `variableName` `string`: The name of the custom variable to set. + +#### Request Body (JSON): +```json +{ +"data": "new value", +"ttl": 3600 +} +``` + +#### Example Response (Success): +```json +{ +"status": "success" +} +``` + +#### Example Response (Error): +```json +{ +"status": "error", +"message": "No data provided" +} +``` + +## Variables + +### `GET /variables` + +#### Description: +Fetches a list of all replace variables, sorted by their `handle` value. + +#### Example Response (JSON): +```json +[ +{ + "definition": { + "handle": "example_variable_name", + "aliases": [ + "alias1", + "alias2" + ], + "usage": "Example usage description", + "description": "Example variable definition description", + "examples": [ + { + "usage": "example usage 1", + "description": "Example description 1" + }, + { + "usage": "example usage 2", + "description": "Example description 2" + } + ], + "categories": [ + "common", + "trigger based", + "user based", + "text", + "numbers", + "advanced", + "obs", + "integrations" + ], + "triggers": { + "command": true, + "custom_script": true, + "startup_script": false, + "api": true, + "event": [ + "event1", + "event2" + ], + "hotkey": false, + "timer": true, + "counter": false, + "preset": true, + "quick_action": false, + "manual": true + }, + "possibleDataOutput": [ + "null", + "bool", + "number", + "text", + "array", + "object", + "ALL" + ], + "hidden": false, + "spoof": true + }, + "handle": "ALL" +}, +] +``` + + +## Custom Roles API + +### `GET /customRoles` + +#### Description: + +Fetches a list of all custom roles with the associated viewers. + +#### Example Response (JSON): + +```json +[ +{ +"id": "role1", +"name": "Moderator", +"viewers": ["viewer1", "viewer2"] +}, +{ +"id": "role2", +"name": "VIP", +"viewers": ["viewer3"] +} +] + +``` + +---------- + +### `GET /customRoles/:customRoleId` + +#### Description: + +Fetches a specific custom role by its ID. Returns role details and the list of viewers associated with it. + +#### Example Response (JSON): + +```json +{ +"id": "role1", +"name": "Moderator", +"viewers": ["viewer1", "viewer2"] +} + +``` + +#### Example Error Response (if the role does not exist): + +```json +{ +"status": "error", +"message": "Custom role 'role1' not found" +} + +``` + +---------- + +### `POST /customRoles/:customRoleId/viewer/:userId` + +#### Description: + +Adds a user to a custom role. You can specify the user by either `userId` or `username` via query parameter. + +#### Request Parameters: + +- `customRoleId`: The ID of the custom role to which the user is being added. +- `userId`: The ID of the viewer to be added to the role. + +#### Query Parameter: + +- `username`: Set to "true" if the user should be found by `username` instead of `userId`. + +#### Example Request (URL): + +``` +POST /customRoles/role1/viewer/viewer1?username=true + +``` + +#### Example Success Response: + +```json +{ +"status": "success", +"message": "Viewer added to custom role" +} + +``` + +#### Example Error Response (if user or custom role does not exist): + +```json +{ +"status": "error", +"message": "Specified viewer does not exist" +} + +``` + +---------- + +### `DELETE /customRoles/:customRoleId/viewer/:userId` + +#### Description: + +Removes a user from a custom role. You can specify the user by either `userId` or `username` via query parameter. + +#### Request Parameters: + +- `customRoleId`: The ID of the custom role to which the user is being removed from. +- `userId`: The ID of the viewer to be removed from the role. + +#### Query Parameter: + +- `username`: Set to "true" if the user should be found by `username` instead of `userId`. + +#### Example Request (URL): + +``` +DELETE /customRoles/role1/viewer/viewer1?username=true + +``` + +#### Example Success Response: + +```json +{ +"status": "success", +"message": "Viewer removed from custom role" +} + +``` + +#### Example Error Response (if user or custom role does not exist): + +```json +{ +"status": "error", +"message": "Specified viewer does not exist" +} + +``` + +---------- + +### `DELETE /customRoles/:customRoleId/clear` + +#### Description: + +Removes all viewers from a custom role. + +#### Request Parameters: + +- `customRoleId`: The ID of the custom role from which all viewers are being removed. + +#### Example Request (URL): + +``` +DELETE /customRoles/role1/clear + +``` + +#### Example Success Response: + +```json +{ +"status": "success", +"message": "All viewers removed from the custom role" +} + +``` + +#### Example Error Response (if custom role does not exist): + +```json +{ +"status": "error", +"message": "Specified custom role does not exist" +} + +``` + + +## Currency API + +### `GET /currencies/:currencyName?` + +#### Description: + +Fetches currency data for a specific currency or all currencies if no currency name is provided. + +- If `currencyName` is specified, it will return data for the specified currency. +- If `currencyName` is not provided, it will return a list of all currencies. + +#### Example Request (for a specific currency): + +``` +GET /currencies/coin + +``` + +#### Example Response (for a specific currency): + +```json + { + "d073da00-a726-11e9-a874-7de9c8544807": { + "id": "d073da00-a726-11e9-a874-7de9c8544807", + "name": "coin", + "active": true, + "payout": 5, + "interval": 5, + "limit": 1000000, + "transfer": "Allow", + "bonus": {}, + "offline": 5, + "$$hashKey": "object:35427" + } + } + +``` + +#### Example Request (for all currencies): + +``` +GET /currencies + +``` + +#### Example Response (for all currencies): + +```json +[ + { + "d073da00-a726-11e9-a874-7de9c8544807": { + "id": "d073da00-a726-11e9-a874-7de9c8544807", + "name": "coin", + "active": true, + "payout": 5, + "interval": 5, + "limit": 1000000, + "transfer": "Allow", + "bonus": {}, + "offline": 5, + "$$hashKey": "object:35427" + } + }, + { + "d073da00-a726-11e9-a874-7de9c8544807": { + "id": "d073da00-a726-11e9-a874-7de9c8544807", + "name": "pups", + "active": true, + "payout": 5, + "interval": 5, + "limit": 1000000, + "transfer": "Allow", + "bonus": {}, + "offline": 5, + "$$hashKey": "object:35427" + } + } +] + +``` + +---------- + +### `GET /currencies/:currencyName/topHolders` + +#### Description: + +Fetches the top holders of a specific currency. By default, it will return the top 10 holders, but you can specify a +`count` query parameter to change the number of top holders returned. + +#### Request Parameters: + +- `currencyName`: The name of the currency (e.g., "coin", "pups"). +- `count`: (Optional) The number of top holders to return. If not specified, defaults to 10. + +#### Example Request (with `count` query parameter): + +``` +GET /currencies/pups/topHolders?count=2 + +``` + +#### Example Response: + +```json +[ +{ + "username": "fluffypanda", + "displayName": "FluffyPanda", + "currency": { + "d073da00-a726-11e9-a874-7de9c8544807": 281272, + "3eba5d80-4297-11ee-86eb-d7d7d2938882": 103665 + }, + "_id": "90448736" +}, +{ + "username": "sparklenova", + "displayName": "SparkleNova", + "currency": { + "d073da00-a726-11e9-a874-7de9c8544807": 281272, + "3eba5d80-4297-11ee-86eb-d7d7d2938882": 103665 + }, + "_id": "90448726" +} +] + +``` + +#### Example Request (default 10 top holders): + +``` +GET /currencies/coin/topHolders + +``` + +#### Example Response (default top 10 holders): + +```json +[ +{ + "username": "fluffypanda", + "displayName": "FluffyPanda", + "currency": { + "d073da00-a726-11e9-a874-7de9c8544807": 281272, + "3eba5d80-4297-11ee-86eb-d7d7d2938882": 103665 + }, + "_id": "90448736" +}, +{ + "username": "sparklenova", + "displayName": "SparkleNova", + "currency": { + "d073da00-a726-11e9-a874-7de9c8544807": 281272, + "3eba5d80-4297-11ee-86eb-d7d7d2938882": 103665 + }, + "_id": "90448726" +}, +// More users... +] + +``` + + +## Quotes API + +### `GET /quotes` + +#### Description: + +Fetches all available quotes. + +#### Example Request: + +``` +GET /quotes + +``` + +#### Example Response: + +```json +[ +{ +"id": 1, +"text": "This is a sample quote.", +"originator": "John Doe", +"creator": "Jane Smith", +"game": "Game Name", +"createdAt": "2024-12-14T00:00:00Z" +}, +{ +"id": 2, +"text": "Another quote here.", +"originator": "Alice", +"creator": "Bob", +"game": "Another Game", +"createdAt": "2024-12-13T00:00:00Z" +} +] + +``` + +---------- + +### `GET /quotes/:quoteId` + +#### Description: + +Fetches a specific quote by its `quoteId`. + +#### Request Parameters: + +- `quoteId`: The unique identifier of the quote. + +#### Example Request: + +``` +GET /quotes/1 + +``` + +#### Example Response: + +```json +{ +"id": 1, +"text": "This is a sample quote.", +"originator": "John Doe", +"creator": "Jane Smith", +"game": "Game Name", +"createdAt": "2024-12-14T00:00:00Z" +} + +``` + +---------- + +### `POST /quotes` + +#### Description: + +Creates a new quote. + +#### Request Body: + +- `text`: The text content of the quote (required). +- `originator`: The person who originated the quote (required). +- `creator`: The creator of the quote (required). +- `game`: The game context (optional). + +#### Example Request: + +```json +{ +"text": "This is a new quote.", +"originator": "Alice", +"creator": "Bob", +"game": "Sample Game" +} + +``` + +#### Example Response: + +```json +{ +"id": 3, +"text": "This is a new quote.", +"originator": "Alice", +"creator": "Bob", +"game": "Sample Game", +"createdAt": "2024-12-14T00:00:00Z" +} + +``` + +---------- + +### `PUT /quotes/:quoteId` + +#### Description: + +Creates or updates a specific quote. If a quote with the provided `quoteId` does not exist, it will be created; +otherwise, it will be updated. + +#### Request Parameters: + +- `quoteId`: The unique identifier of the quote to be updated or created. + +#### Request Body: + +- `text`: The text content of the quote (required). +- `originator`: The person who originated the quote (required). +- `creator`: The creator of the quote (required). +- `game`: The game context (optional). +- `createdAt`: The creation date (optional). + +#### Example Request: + +```json +{ +"text": "Updated quote content", +"originator": "Alice", +"creator": "Bob", +"game": "Sample Game", +"createdAt": "2024-12-14T00:00:00Z" +} + +``` + +#### Example Response: + +```json +{ +"id": 1, +"text": "Updated quote content", +"originator": "Alice", +"creator": "Bob", +"game": "Sample Game", +"createdAt": "2024-12-14T00:00:00Z" +} + +``` + +---------- + +### `PATCH /quotes/:quoteId` + +#### Description: + +Partially updates an existing quote. You can update specific fields such as `text`, `originator`, `creator`, `game`, or +`createdAt`. + +#### Request Parameters: + +- `quoteId`: The unique identifier of the quote to be updated. + +#### Request Body: + +Any of the following fields can be included: + +- `text`: The text content of the quote. +- `originator`: The person who originated the quote. +- `creator`: The creator of the quote. +- `game`: The game context. +- `createdAt`: The creation date. + +#### Example Request: + +```json +{ +"text": "Partially updated quote content", +"originator": "Alice" +} + +``` + +#### Example Response: + +```json +{ +"id": 1, +"text": "Partially updated quote content", +"originator": "Alice", +"creator": "Bob", +"game": "Sample Game", +"createdAt": "2024-12-14T00:00:00Z" +} + +``` + +---------- + +### `DELETE /quotes/:quoteId` + +#### Description: + +Deletes a specific quote by its `quoteId`. + +#### Request Parameters: + +- `quoteId`: The unique identifier of the quote to be deleted. + +#### Example Request: + +``` +DELETE /quotes/1 + +``` + +#### Example Response: + +``` +HTTP Status 204 No Content + +``` + +## Counters API + +### `GET /counters` + +#### Description: + +Fetches all available counters. + +#### Example Request: + +``` +GET /counters + +``` + +#### Example Response: + +```json +[ +{ +"id": "counter1", +"name": "Counter 1", +"value": 10 +}, +{ +"id": "counter2", +"name": "Counter 2", +"value": 15 +} +] + +``` + +---------- + +### `GET /counters/:counterId` + +#### Description: + +Fetches a specific counter by its `counterId`. + +#### Request Parameters: + +- `counterId`: The unique identifier of the counter. + +#### Example Request: + +``` +GET /counters/counter1 + +``` + +#### Example Response: + +```json +{ +"id": "counter1", +"name": "Counter 1", +"value": 10 +} + +``` + +---------- + +### `POST /counters/:counterId` + +#### Description: + +Updates the value of an existing counter. Optionally, you can override the current value. + +#### Request Parameters: + +- `counterId`: The unique identifier of the counter to be updated. + +#### Request Body: + +- `value`: The new value to set for the counter (required). +- `override`: A boolean indicating whether to override the counter's current value (optional, defaults to `false`). + +#### Example Request: + +```json +{ +"value": 20, +"override": true +} + +``` + +#### Example Response: + +```json +{ +"oldValue": 10, +"newValue": 20 +} + +``` + + +## Timers API + +### `GET /timers` + +#### Description: + +Fetches all available timers. + +#### Example Request: + +``` +GET /timers + +``` + +#### Example Response: + +```json +[ +{ +"id": "timer1", +"name": "Timer 1", +"active": true +}, +{ +"id": "timer2", +"name": "Timer 2", +"active": false +} +] + +``` + +---------- + +### `GET /timers/:timerId` + +#### Description: + +Fetches a specific timer by its `timerId`. + +#### Request Parameters: + +- `timerId`: The unique identifier of the timer. + +#### Example Request: + +``` +GET /timers/timer1 + +``` + +#### Example Response: + +```json +{ +"id": "timer1", +"name": "Timer 1", +"active": true +} + +``` + +---------- + +### `POST /timers/:timerId/:action` + +#### Description: + +Performs an action on the specified timer. + +#### Request Parameters: + +- `timerId`: The unique identifier of the timer to be modified. +- `action`: The action to perform on the timer. Can be one of the following: +- `enable`: Enables the timer. +- `disable`: Disables the timer. +- `toggle`: Toggles the active state of the timer. +- `clear`: Clears the timer's interval. + +#### Example Request: + +``` +POST /timers/timer1/enable + +``` + +#### Example Response: + +```json +{ +"status": "success", +"message": "Timer enabled" +} + +``` + +#### Example Request: + +``` +POST /timers/timer1/clear + +``` + +#### Example Response: + +```json +{ +"status": "success", +"message": "Timer interval cleared" +} + +``` + +## Effect Queue API + +### `GET /queues` + +#### Description: +Fetches all available effect queues. + +#### Example Request: +``` +GET /queues +``` + +#### Example Response: +```json +[ +{ +"id": "queue1", +"name": "Queue 1", +"status": "active" +}, +{ +"id": "queue2", +"name": "Queue 2", +"status": "paused" +} +] +``` + +--- + +### `GET /queues/:queueId` + +#### Description: +Fetches a specific effect queue by its `queueId`. + +#### Request Parameters: +- `queueId`: The unique identifier of the queue. + +#### Example Request: +``` +GET /queues/queue1 +``` + +#### Example Response: +```json +{ +"id": "queue1", +"name": "Queue 1", +"status": "active" +} +``` + +--- + +### `POST /queues/:queueId/pause` + +#### Description: +Pauses the specified effect queue. + +#### Request Parameters: +- `queueId`: The unique identifier of the queue to be paused. + +#### Example Request: +``` +POST /queues/queue1/pause +``` + +#### Example Response: +```json +{ +"id": "queue1", +"name": "Queue 1", +"status": "paused" +} +``` + +--- + +### `POST /queues/:queueId/resume` + +#### Description: +Resumes the specified effect queue. + +#### Request Parameters: +- `queueId`: The unique identifier of the queue to be resumed. + +#### Example Request: +``` +POST /queues/queue1/resume +``` + +#### Example Response: +```json +{ +"id": "queue1", +"name": "Queue 1", +"status": "active" +} +``` + +--- + +### `POST /queues/:queueId/toggle` + +#### Description: +Toggles the status of the specified effect queue (pauses if active, resumes if paused). + +#### Request Parameters: +- `queueId`: The unique identifier of the queue to be toggled. + +#### Example Request: +``` +POST /queues/queue1/toggle +``` + +#### Example Response: +```json +{ +"id": "queue1", +"name": "Queue 1", +"status": "paused" +} +``` + +--- + +### `POST /queues/:queueId/clear` + +#### Description: +Clears the specified effect queue (removes the queue). + +#### Request Parameters: +- `queueId`: The unique identifier of the queue to be cleared. + +#### Example Request: +``` +POST /queues/queue1/clear +``` + +#### Example Response: +```json +{ +"id": "queue1", +"name": "Queue 1", +"status": "removed" +} +``` +# WS Endpoint +Firebot hosts a local Websocket API that developers can use to get data from Firebot. +* The API is hosted on port **7472**. All endpoints have the root **ws://localhost:7472/api/v1** +* All responses are in JSON. +* Don't forget that Firebot must be running for the API to be available. +```json +{ + "type": "invoke", + "id": 0, + "name": "subscribe-events", + "data": [] +} +```