OP-FW REST API

Reference

Last updated: Mon, 14 Oct 2024 11:33:52 UTC

Base-URL

https://c2s1.op-framework.com/op-framework

Authentication

Most routes require authentication. Authentication is done via the Authorization header. Required for all restricted routes.

Example
Authorization: Bearer my-op-fw-token

Response

All successful data responses will have a 2xx status code and look similar to this:

{
    "statusCode": 200,
    "data": {}
}

All successful message responses will have a 2xx status code and look similar to this:

{
    "statusCode": 201,
    "message": "Success message"
}

If an error occurs the response will have a 4xx or 5xx status code and look similar to this:

{
    "statusCode": 404,
    "message": "What went wrong"
}

Public Routes

/beanMachineDeliveries.json

Returns the recent Bean Machine deliveries.

Example response (data)
[
            {
                "characterId": 739,
                "deliveries": [
                    "deliveryPrice": 1234,
                    "distanceBonus": 12.34,
                    "totalPrice": 1234.56,
                    "distance": 123,
                    "startTimestamp": 7216537123,
                    "endTimestamp": 672137135,
                    "duration": 12345
                ]
            }
        ]

/burgerShotDeliveries.json

Returns the recent Burger Shot deliveries.

Example response (data)
[
            {
                "characterId": 739,
                "deliveries": [
                    "deliveryPrice": 1234,
                    "distanceBonus": 12.34,
                    "totalPrice": 1234.56,
                    "distance": 123,
                    "startTimestamp": 7216537123,
                    "endTimestamp": 672137135,
                    "duration": 12345
                ]
            }
        ]

/chatEmotes.json

Returns an array of the active chat emotes.

Example response (data)
[
    {
        "id": "436458377372237824",
        "name": "legacy",
        "animated": false
    },
    {
        "id": "634818410366369830",
        "name": "IntenseThinking",
        "animated": true
    }
]

/compression.json

Returns general compression statistics.

Example response (data)
{
    "maxClients": 96,
    "queueAmount": 0,
    "joinedAmount": 3,
    "joiningAmount": 0,
    "serverUptime": "09h 56m",
    "serverVersion": "alpha_2.30.0.4997"
}

/connections.json

Returns all player connections.

Example response (data)
[
    {
        "playerName": "Twoot",
        "licenseIdentifier": "license:ef8947e6991a8c70ebb9fdf5b0401f9712e2d20c",
        "source": 33,
        "joined": false
    },
    {
        "playerName": "Kekker",
        "licenseIdentifier": "license:ef8947e6991a8c70ebb9fdf5b0401f9712e2d20c",
        "source": 2,
        "joined": true
    }
]

/exclusiveDealership.json

Returns information about the current EDM rotation.

Example response (data)
{
    "rotation": [
        "rmodgt63",
        "db11",
        "harleychopper"
    ],
    "next": 1684610659
}

/items.json

Returns information about every single item in the game.

Example response (data)
{
    "weapon_combatpdw": {
        "weight": 15,
        "label": "Combat PDW",
        "stackable": false,
        "isWeapon": true
    }
}

/items.txt

Returns information about every single item in the game in text form.

Example response (data)
Combat PDW - weapon_combatpdw...

/jobs.json

Returns all jobs available in-game.

Example response (data)
{
    "jobs": {
        "Bar and Club": {
            "Bar Jobs": {
                "Bar Owner": {
                    "salary": 70
                },
                "Bar Manager": {
                    "salary": 54
                },
                "Bar Security": {
                    "salary": 45
                },
                "Bartender": {
                    "salary": 35
                }
            }
        }
    }
}

/jobs.txt

Returns all jobs available in-game in text form.

Example response (data)
Law Enforcement...

/mechanicRepairs.json

Returns the recent repairs done by mechanics.

Example response (data)
[
    {
        "vehicles": {
            "64FGY457": {
                "repairs": {
                    "engine": [
                        [
                            {
                                "amount": 3,
                                "itemName": "scrap"
                            },
                            {
                                "amount": 1,
                                "itemName": "steel"
                            }
                        ],
                        [
                            {
                                "amount": 3,
                                "itemName": "scrap"
                            },
                            {
                                "amount": 1,
                                "itemName": "steel"
                            }
                        ]
                    ],
                    "body": [
                        [
                            {
                                "amount": 3,
                                "itemName": "scrap"
                            },
                            {
                                "amount": 2,
                                "itemName": "aluminum"
                            }
                        ]
                    ],
                    "door": 1
                },
                "modelName": "sultan"
            }
        },
        "characterId": 739
    }
]

/models.json

Returns a map for all models and their model hash (including weapons).

Example response (data)
{
    "models": {
        "-234152995": "hei_prop_heist_tug",
        "471123930": "sum_prop_ac_rock_01e"
    },
    "weapons": {
        "453432689": "weapon_pistol"
    }
}

/routes.json

Returns all available API routes.

Example response (data)
[
    {
        "restricted": true,
        "responseType": "message",
        "method": "PATCH",
        "path": "/execute/setQueuePosition"
    }
]

/serverMetrics.json

Returns basic server metrics.

Example response (data)
{
    "playerCount": 114,
    "maxClients": 120,
    "queueSize": 2,
    "uptime": "04h 24m",
    "version": "alpha_2.37.0.5969"
}

/specialImportsDealership.json

Returns information about the current Special imports rotation.

Example response (data)
{
    "rotation": [
        {
            "stock": 10,
            "modelName": "adder"
        },
        {
            "stock": 6,
            "modelName": "sultanrs"
        }
    ],
    "next": 1684610659
}

/towImpounds.json

Returns the recent impounds done by tow drivers.

Example response (data)
[
    {
        "towImpounds": [
            {
                "timestamp": 1637979085,
                "playerVehicle": false,
                "reward": 71,
                "plateNumber": "89UTK635",
                "modelName": "gresley"
            }
        ],
        "characterId": 739
    }
]

/uptime.json

Returns the uptime in milliseconds.

Example response (data)
{
    "uptime": 179383
}

/variables.json

Returns all global server variables.

Example response (data)
{
    "uniqueId": 2,
    "whitelist": true,
    "communityName": "OP Framework",
    "serverId": 1,
    "communityWebsite": "www.op-framework.com",
    "hardcoreEnabled": false,
    "testServer": true,
    "clusterId": 2,
    "maxClients": 96,
    "serverReady": true,
    "serverUptime": "07h 32m",
    "serverIp": "51.195.188.114:30120",
    "serverVersion": "alpha_2.37.0.5969",
    "defaultLanguageCode": "en-US",
    "frameworkDiscord": "discord.gg/opfw",
    "environment": "prod",
    "communityNameAbbreviation": "OP-FW",
    "communityLogo": "https://www.legacy-roleplay.com/files/OPLogo.png",
    "serverConnectIp": "c2s1.op-framework.com",
    "communityDiscord": "discord.gg/opfw"
}

/vehicles.json

Returns all vehicles, their price, display name, etc.

Example response (data)
{
            "-1216765807": {
                "model": "adder"
                "label": "Adder",
                "price": 220000
            }
        }

/vehicles.txt

Returns all vehicles, their display name and their model name in text form.

Example response (data)
Air Force One - afo...

/weapons.json

Returns a map for all weapons and their weapon hash.

Example response (data)
{
    "453432689": {
        "name": "weapon_pistol",
        "type": "pistol",
        "addon": false,
        "melee": false,
        "wearable": false,
        "throwable": false,
        "misc": false
    }
}

Restricted Routes

/antiCheat.json

Returns general anti-cheat information.

Example response (data)
{
    "suspicious": [
        {
            "source": 123,
            "modelName": "blimp",
            "consoleName": "Laura [123] (license:2ced2cabd90f1208e7e056485d4704c7e1284196)",
            "timestamp": 1711149621
        }
    ],
    "explosions": [
        {
            "source": 123,
            "consoleName": "Laura [123] (license:2ced2cabd90f1208e7e056485d4704c7e1284196)",
            "timestamp": 1711149621,
            "type": "FIREWORK",
            "nearby": 2,
            "distance": 12.34,
            "suspicious": false
        }
    ]
}

/atc.json

Returns detailed information about all aircraft currently operating.

Example response (data)
[
    {
        "coords": {
            "x": -946.9000244140625,
            "y": -3361.199951171875,
            "z": 14.5,
            "w": 56.70000076293945
        },
        "modelHash": 2061630439,
        "registration": false,
        "speed": 0.0,
        "characterId": 1,
        "callsign": "MEOW"
    }
]

/auth.json

Just returns true if the request was authenticated. (Used to check if the server is reachable)

Example response (data)
{
    "authenticated": true
}

/cargoHistory.json

Gets the Cargo heist history.

Example response (data)
[
    {
        "startTimestamp": 1678955220
    },
    {
        "startTimestamp": 1678955221
    }
]

/crafting.txt

Returns all crafting recipes.

Example response (data)
- - - Station 1 - - -
        # 1.23 -4.56 7.89 (Cayo Perico)

/duty.json

Returns all currently on-duty police and ems.

Example response (data)
{
    "Medical": [
        {
            "...": 1234
        }
    ],
    "Law Enforcement": [
        {
            "characterId": 83118,
            "department": "SASP",
            "licenseIdentifier": "license:ef8947e6991a8c70ebb9fdf5b0401f9712e2d20c"
        }
    ]
}

/emergencyCalls.json

Returns all emergency calls made in the last 10 minutes.

Example response (data)
[
    {
        "callerNumber": "861-6141",
        "number": "Law Enforcement",
        "localCall": false,
        "timestamp": 1712404085,
        "coords": {
            "x": -718.7000122070312,
            "y": -1417.800048828125
        },
        "message": "HELP!"
    }
]

/employees.json

Temporary route. Returns all characters who are currently loaded in which have a certain job.

Query parameters
Field Type Description
jobName string The job you are filtering by.
Example response (data)
[
    {
        "job": {
            "positionName": "EMT",
            "departmentName": "Los Santos Medical Center"
        },
        "characterId": 739
    }
]

/execute/announcementMessage

Broadcasts a global server announcement.

Query parameters
Field Type Description
announcementMessage string The announcement to be broadcasted.
Example response (message)
"Posted announcement message."

/execute/createScreenshot

Creates a screenshot of a certain players game render.

Query parameters
Field Type Description
serverId integer The player's server id.
lifespan boolean, integer or integer How long the screenshot should be stored in seconds (false for indefinite).
duration integer Optional: If you want to record the users screen (in milliseconds, if false it will take a screenshot).
fps integer Optional: if you want a set fps for the screen capture (between 5 and 30).
Example response (message)
"A screenshot has been successfully created."

/execute/kickPlayer

Kicks a player from the server.

Query parameters
Field Type Description
licenseIdentifier string The player's license identifier.
reason string The kick reason. Will default to "No reason".
removeReconnectPriority boolean If the players reconnect priority should be removed.
Example response (message)
"Kicked player and removed reconnect priority."

/execute/refreshCharacter

Reloads a bunch of character data from the database.

Query parameters
Field Type Description
licenseIdentifier string The player's license identifier.
characterId integer The characters id.
Example response (message)
"Character refreshed."

/execute/refreshInventory

Refreshes a certain inventory (if its loaded).

Query parameters
Field Type Description
inventoryName string The inventory name to refresh.
Example response (message)
"Refreshed inventory successfully."

/execute/refreshTattoos

Reloads a characters tattoos from the database.

Query parameters
Field Type Description
licenseIdentifier string The player's license identifier.
characterId integer The characters id.
Example response (message)
"Tattoos refreshed."

/execute/restartCancel

Cancels a planned restart.

Example response (message)
"Cancelled restart."

/execute/restartServer

Sets the server up for restart. It does not actually trigger a stop or restart of the server.

Query parameters
Field Type Description
restartType string The type of restart. Allowed values are 'restart', 'update' and 'maintenance'.
Example response (message)
"Executed the restart command."

/execute/restartWarning

Posts a restart warning message.

Query parameters
Field Type Description
restartType string The type of restart. Allowed values are 'restart', 'update' and 'maintenance'.
minutesUntilRestart integer The amount of minutes until the restart.
Example response (message)
"Posted a restart warning message."

/execute/revivePlayer

Revives a player.

Query parameters
Field Type Description
targetSource integer The server id of the player that should be revived.
Example response (message)
"Revived player successfully."

/execute/setSlots

Sets the server's slots. It will reset when the server restarts.

Query parameters
Field Type Description
slots integer The amount you want to set it to.
Example response (message)
"The server slots have now been set to `123`."

/execute/setStreaming

Sets a user to be 'streaming'.

Query parameters
Field Type Description
licenseIdentifier string The user's license identifier.
streaming boolean The target streaming state.
Example response (message)
"Modified user's 'streaming state."

/execute/setTime

Sets the time globally on the server.

Query parameters
Field Type Description
hour integer The hour you want to set (0-23).
minute integer The minute you want to set (0-59, default = 0).
doTransition boolean If the there should be a transition between times (default = false).
Example response (message)
"Successfully changed weather to `EXTRASUNNY`."

/execute/setWeather

Sets the weather globally on the server.

Query parameters
Field Type Description
weatherName string The weather name (EXTRASUNNY, CLEAR, CLOUDS, SMOG, FOGGY, OVERCAST, RAIN, THUNDER, CLEARING, NEUTRAL, SNOW, BLIZZARD, SNOWLIGHT, XMAS, HALLOWEEN, RAIN_HALLOWEEN and SNOW_HALLOWEEN).
Example response (message)
"Successfully changed weather to `EXTRASUNNY`."

/execute/skipQueue

Instantly pushes a player through the queue.

Query parameters
Field Type Description
licenseIdentifier string The player's license identifier.
Example response (message)
"The player has been pushed through the queue."

/execute/staffChatMessage

Sends a message into the in-game staff-chat.

Query parameters
Field Type Description
message string The content of the staff-chat message.
licenseIdentifier string The license identifier of the author.
Example response (message)
"Message sent."

/execute/staffPrivateMessage

Sends a Staff-PM to a player.

Query parameters
Field Type Description
message string The content of the Staff-PM.
targetSource integer The server-id of the player.
licenseIdentifier string The license identifier of the message author.
Example response (message)
"Message sent."

/execute/teleportPlayer

Teleports a player to certain coordinates.

Query parameters
Field Type Description
targetSource integer The server-id of the player.
x float The x coordinate.
y float The y coordinate.
z float The z coordinate (optional).
w float The w coordinate or heading (optional).
Example response (message)
"Teleported player successfully."

/execute/unloadCharacter

Unloads a player's character.

Query parameters
Field Type Description
licenseIdentifier string The player's license identifier.
characterId integer The character that should be unloaded.
Example response (message)
"Unloaded character."

/npcs.json

Returns information about all peds and vehicles on the server.

Example response (data)
{
    "vehicles": [
        {
            "id": 12345,
            "model": "adder",
            "coords": {
                "y": 3716.083,
                "x": 1739.13,
                "z": 33.206,
                "w": 17.008
            },
            "plate": "88YGN126"
        }
    ],
    "peds": [
        {
            "id": 12345,
            "model": "a_m_m_acult_01",
            "coords": {
                "y": 3716.083,
                "x": 1739.13,
                "z": 33.206,
                "w": 17.008
            }
        }
    ]
}

/players.json

Returns information about online users.

Query parameters
Field Type Description
characterId integer Return only users with the selected character(s) loaded. You can select multiple characters by seperating the IDs with a comma.
Example response (data)
[
    {
        "source": 1,
        "playerName": "Kekker",
        "licenseIdentifier": "license:ef8947e6991a8c70ebb9fdf5b0401f9712e2d20c",
        "character": {
            "id": 1,
            "fullName": "Joe Average",
            "flags": 336,
            "portrait": "https://gta5-ss.op-framework.com/files/ef62f2297513b62c71d392f6aae58301.png",
            "phoneNumber": "375-4414"
        },
        "flags": 0
    }
]

/queue.json

Returns all players who are currently in the queue.

Example response (data)
[
    {
        "source": 65541,
        "queueTime": 27633,
        "licenseIdentifier": "license:ef8947e6991a8c70ebb9fdf5b0401f9712e2d20c",
        "consoleName": "Twoot [65541] (license:ef8947e6991a8c70ebb9fdf5b0401f9712e2d20c)",
        "priorityName": "super admin",
        "priorityLevel": 99
    }
]

/screenshot

Instructs a screenshotter to create a screenshot.

Query parameters
Field Type Description
screenshotSource integer The player source you wish to create the screenshot.
screenshotUpload string Where the player should upload the image to.
screenshotType string The type of screenshot. Allowed values are 'portrait', 'selfie', 'component', 'outfit' and 'vehicle'.
screenshotOptions object Additional options, depends on what kind of screenshot type was selected.
Example response (data)
{
    "success": true,
    "url": "https://gta5-ss-test.op-framework.com/files/temporary/43fd7920aa37d63a8df57e17e6731b04.jpg"
}

/screenshotData

Get some data for screenshots.

Query parameters
Field Type Description
dataSource integer The player source you wish to get the data.
dataType string The type of data. Allowed values are 'textureVariations'.
dataOptions object Additional options, depends on what kind of data type was selected.
Example response (data)
{
    "success": true,
    "data": {
        "variations": 12
    }
}

/screenshotterBan

Ban a screenshotter. Used when they are creating bad images. They can self-unban up to 3 times.

Query parameters
Field Type Description
licenseIdentifier string The license identifier of the player you want to ban.
Example response (message)
"Screenshotter banned."

/screenshotters.json

Returns a list of all players that are on stand-by for screenshotting.

Example response (data)
[
    {
        "playerName": "Kekker",
        "licenseIdentifier": "license:ef8947e6991a8c70ebb9fdf5b0401f9712e2d20c",
        "source": 1,
        "busy": false
    }
]

/staffChat.json

Returns the last 250 staff messages (including reports).

Example response (data)
[
    {
        "user": {
            "licenseIdentifier": "license:ef8947e6991a8c70ebb9fdf5b0401f9712e2d20c",
            "playerName": "Twoot"
        },
        "message": "Hello guys",
        "createdAt": 1633897384
    }
]

/users.json

Returns information about all users that have connected to the server since the last restart.

Example response (data)
[
    {
        "source": 1,
        "playerName": "Kekker",
        "licenseIdentifier": "license:ef8947e6991a8c70ebb9fdf5b0401f9712e2d20c"
    }
]

/world.json

Returns detailed information about all players who are currently connected to the server and their loaded in character.

Example response (data)
{
    "players": [
        {
            "speed": 0.0,
            "licenseIdentifier": "license:2ced2cabd90f1208e7e056485d4704c7e1284196",
            "name": "Laura",
            "vehicle": false,
            "afkTime": false,
            "instanceId": 816,
            "source": 282,
            "countryName": "United States",
            "flags": 0,
            "coords": {
                "x": -73.9000015258789,
                "y": -821.0,
                "z": 321.20001220703127,
                "w": 8.5
            },
            "character": {
                "id": 1628,
                "fullName": "Laura Dodger",
                "flags": 336
            }
        }
    ],
    "world": {
        "baseTime": 761.2,
        "weather": "EXTRASUNNY",
        "instance": 816
    }
}