API Endpoints
View all of our API endpoints, learn about our data structuring, and integrate your framework with Sonoran CAD.
API endpoints are not enabled with the free version of Sonoran CAD. For more information, see our pricing or view how to check your community limits.
Looking for VPS, web, or dedicated hosting? Check out our official server hosting!

Available API Endpoints

Emergency Endpoints

View all emergency endpoints including unit actions, emergency calls, dispatching, and more!

Civilian Endpoints

View all civilian endpoints including creating new characters, modifying licenses, vehicle registrations, and more!

General Endpoints

View all general endpoints for user account actions, administrative actions, and more!

API Code Examples

Javascript

This example makes a unit panic request based on a unit's API ID. This uses the Axios library to help make the HTTP POST request.
The server response is then logged to console.
1
// Import Axios library
2
// https://www.npmjs.com/package/axios
3
// Install command: `npm i axios`
4
import axios from 'axios';
5
// Set the API URL (CAD backend)
6
let baseURL = 'https://api.sonorancad.com';
7
// Set the `api` object to be used
8
let api = axios.create({ baseURL });
9
10
// Format the POST body data
11
// https://info.sonorancad.com/sonoran-cad/api-integration/api-endpoints/emergency/unit-panic
12
const data = {
13
id: 'YOUR_COMMUNITY_ID',
14
key: 'YOUR_API_KEY',
15
type: 'UNIT_PANIC',
16
data: [
17
// Data: List (array) of unit panic objects
18
// Here, we're specifying one unit to PANIC
19
{
20
apiId: "STEAM:5678", // Unit with their API ID set as `STEAM:5678`
21
isPanic: true, // Panic ON
22
}
23
],
24
};
25
26
// Send the POST request
27
// Format the data to JSON
28
api.post('/emergency/unit_panic', JSON.stringify(data))
29
.then((response) => {
30
// Response back from the backend
31
console.log(response);
32
})
33
.catch((err) => {
34
// Error response back from the backend
35
console.log(err);
36
});
Copied!

Lua

This example makes a unit panic request based on a unit's API ID. This uses the FiveM performHttpRequest native to help make the HTTP POST request.
The server response is then logged to console.
1
-- Body payload object
2
local payload = {}
3
4
-- Specify our community ID, API key, and API method type (Panic)
5
payload["id"] = "YOUR_COMMUNITY_ID"
6
payload["key"] = "YOUR_API_KEY"
7
payload["type"] = "UNIT_PANIC"
8
9
-- Data: List (array) of unit panic objects
10
-- Here, we're specifying one unit to PANIC
11
local postData = {
12
{
13
["apiId"] = "STEAM:5678", -- Unit with their API ID set as `STEAM:5678`
14
["isPanic"] = true -- Panic ON
15
},
16
}
17
-- Add this data to our payload
18
payload["data"] = postData
19
20
-- Send POST request with JSON encoded body (payload)
21
PerformHttpRequest("https://api.sonorancad.com/emergency/unit_panic", function(statusCode, res, headers)
22
if statusCode == 200 and res ~= nil then
23
-- Status code 200 (Success)
24
print("result: "..tostring(res))
25
else
26
-- Error code
27
print(("CAD API ERROR: %s %s"):format(statusCode, res))
28
end
29
end, "POST", json.encode(payload), {["Content-Type"]="application/json"})
Copied!