Imperial Characters API & Exports

The ImperialCharacters module allows a FiveM server to create, retrieve, and delete characters or vehicles in ImperialCAD using exports and backend API calls.


โš™๏ธ Setup

Add the following to your server.cfg:

setr imperial_community_id "YOUR_COMMUNITY_ID"
set imperialAPI "YOUR_API_SECRET"

Enable debug output:

Config.debug = true

๐Ÿ“ค Exports & Examples


๐Ÿ”น NewCharacter(data, callback)

Creates a new civilian character in CAD.

Required Fields

Field
Type
Description

users_discordID

string

Discord ID of the player(This allows them to still edit and interact with API made char's)

Fname

string

First name

Mname

string

Middle name

Lname

string

Last name

Birthdate

string

Format: YYYY-MM-DD

gender

string

"Male", "Female", etc.

race

string

Race/ethnicity

hairC

string

Hair color

eyeC

string

Eye color

height

string

e.g., "6'0"

weight

string

e.g., "180"

postal

string

Postal code

address

string

Street address

city

string

City

county

string

County

phonenum

string

Phone number

dlstatus

string

e.g., "Valid" or "Suspended"

citizenid

string

Unique character ID

Example Usage

exports["ImperialCAD"]:NewCharacter({
  users_discordID = "123456789012345678",
  Fname = "John",
  Mname = "T",
  Lname = "Doe",
  Birthdate = "1995-03-21",
  gender = "Male",
  race = "White",
  hairC = "Black",
  eyeC = "Brown",
  height = "6'1",
  weight = "190",
  postal = "202",
  address = "124 Grove St",
  city = "Los Santos",
  county = "Los Santos",
  phonenum = "5553331234",
  dlstatus = "Valid",
  citizenid = "JD321"
}, function(success, res)
  if success then print("Civilian created!") else print("Failed:", res) end
end)

Example Response

{
  "status": "success",
  "response": {
    "ssn": 684699354,
    "DLN": "D78239341",
    "age": 30,
    "name": " John T Doe"
  }
}

๐Ÿ”น NewCharacterAdvanced(data, callback)

Same as NewCharacter but supports license and misc details.

Additional Fields

licensedetails = {
  hasBoatLic = true,
  hasCDL = true,
  CDLNumber = "CDL1234",
  CDLStatus = "Valid",
  hasDL = true,
  DLNumber = "D1234567",
  DLStatus = "Valid",
  hasFirearmsCertification = true,
  hasFishLic = false,
  hasHuntLic = true
},
misc = {
  missing = false
}

Example

exports["ImperialCAD"]:NewCharacterAdvanced({
  Fname = "Jane",
  Mname = "A",
  Lname = "Smith",
  Birthdate = "1990-07-15",
  gender = "Female",
  race = "Hispanic",
  hairC = "Blonde",
  eyeC = "Green",
  height = "5'7",
  weight = "145",
  postal = "404",
  address = "555 Clinton Ave",
  city = "Los Santos",
  county = "Blaine",
  state = "San Andreas",
  phonenum = "5558881212",
  licensedetails = {
    hasBoatLic = false,
    hasCDL = true,
    CDLNumber = "CDL5678",
    CDLStatus = "Valid",
    hasDL = true,
    DLNumber = "D7894561",
    DLStatus = "Valid",
    hasFirearmsCertification = true,
    hasFishLic = true,
    hasHuntLic = true
  },
  misc = {
    missing = false
  }
}, function(success, res)
  if success then print("Advanced character created!") else print("Failed:", res) end
end)

Example Response

{
  "status": "success",
  "response": {
    "ssn": 684699354,
    "DLN": "D7894561",
    "age": 35,
    "name": "Jane A Smith"
  }
}

๐Ÿ”น DeleteCharacter(data, callback)

Deletes a character from CAD.

Required Fields

Field
Type

users_discordID

string

citizenid

string

Example

exports["ImperialCAD"]:DeleteCharacter({
  users_discordID = "123456789012345678",
  citizenid = "JD321"
}, function(success, res)
  if success then print("Character deleted.") else print("Failed to delete character:", res) end
end)

Example Response

{
  "status": "SUCCESS",
  "message": "Civilian and relevant data was marked to be deleted"
}

๐Ÿ”น GetCharacter(charid, commId, callback)

Retrieves a character by ID.

Parameters

Param
Type
Description

charid

string

Citizen ID

commId

string

Your community ID

Example

exports["ImperialCAD"]:GetCharacter("JD321", "myCommIdHere", function(success, data)
  if success then print(json.encode(data)) else print("Failed:", data) end
end)

Example Response

{
  "status": "success",
  "response": {
    "charid": "JD321",
    "name": "Jane A Smith",
    "ssn": "123456789",
    "age": "35",
    "address": "000 No Where Rd"
  }
}

๐Ÿ”น GetCharacterAdvanced({ firstname, lastname }, callback)

Searches by name.

Parameters

Field
Type

firstname

string

lastname

string

Example

exports["ImperialCAD"]:GetCharacterAdvanced({
  firstname = "Jane",
  lastname = "Smith"
}, function(success, data)
  if success then print(json.encode(data)) else print("โŒ Failed:", data) end
end)

Example Response

{
  "status": "success",
  "response": {
    "charid": "JD321",
    "name": "Jane A Smith",
    "ssn": "123456789",
    "age": "35",
    "address": "000 No Where Rd"
  }
}

๐Ÿ”น CreateVehicle(data, callback)

Basic vehicle registration.

Required Fields

Field
Type
Required

ssn

string

โœ…

plate

string

โœ…

model

string

โœ…

color

string

โœ…

year

string

Optional (default "2015")

make

string

Optional (default "UNKNOWN")

Example

exports["ImperialCAD"]:CreateVehicle({
  ssn = "JD321",
  plate = "ABC123",
  model = "Charger",
  color = "Black",
  year = "2022",
  make = "Dodge"
}, function(success, res)
  if success then print("Vehicle registered.") else print("โŒ Failed:", res) end
end)

Example Response

{
  "status": "success",
  "response": {}
}

๐Ÿ”น CreateVehicleAdvanced(data, callback)

Detailed vehicle registration with owner & insurance.

Required Format

{
  vehicleData = {
    plate = "XYZ123",
    model = "Sultan RS",
    Make = "Karin",
    color = "Gray",
    year = "2021",
    regState = "SA",
    regStatus = "Valid",
    regExpDate = "2025-05-01",
    vin = "1HGCM82633A004352",
    stolen = false
  },
  vehicleInsurance = {
    hasInsurance = true,
    insuranceStatus = "Active",
    insurancePolicyNum = "INS234"
  },
  vehicleOwner = {
    ownerSSN = "JD321", --Attaching a valid SSN will allow us to link the vehicle to the civilian char
    ownerFirstName = "Jane",
    ownerLastName = "Smith",
    ownerGender = "Female",
    ownerAddress = "123 Main St",
    ownerCity = "Los Santos"
  }
}

Example

exports["ImperialCAD"]:CreateVehicleAdvanced({
  vehicleData = {
    plate = "XYZ123",
    model = "Sultan RS",
    Make = "Karin",
    color = "Gray",
    year = "2021",
    regState = "SA",
    regStatus = "Valid",
    regExpDate = "2025-05-01",
    vin = "1HGCM82633A004352",
    stolen = false
  },
  vehicleInsurance = {
    hasInsurance = true,
    insuranceStatus = "Active",
    insurancePolicyNum = "INS234"
  },
  vehicleOwner = {
    ownerSSN = "JD321",
    ownerFirstName = "Jane",
    ownerLastName = "Smith",
    ownerGender = "Female",
    ownerAddress = "123 Main St",
    ownerCity = "Los Santos"
  }
}, function(success, res)
  if success then print("Vehicle registered.") else print("Failed:", res) end
end)

Example Response

{
  "status": "success",
  "response": {
    "charid": "JD321",
    "name": "Jane A Smith",
    "ssn": "123456789",
    "age": "35",
    "address": "000 No Where Rd"
  }
}

๐Ÿ”— API Reference

All API's will use the same format of "https://imperialcad.app/api/1.1/wf/" and then the provided API Endpoint as provided below.

TYPE https://imperialcad.app/api/1.1/wf/<API_GOES_HERE>

Type
Export
API Endpoint

POST

NewCharacter

NewCharacter

POST

NewCharacterAdvanced

NewAdvancedCharacter

POST

DeleteCharacter

DeleteCharacter

GET

GetCharacter

GetCharacter

GET

GetCharacterAdvanced

GetCharacterAdvanced

POST

CreateVehicle

registerVehicle

POST

CreateVehicleAdvanced

registeradvancedvehicle


๐Ÿ” API Authorization

All POST endpoints require the following header:

{
  "Content-Type": "application/json",
  "APIKEY": GetConvar("imperialAPI", "")
}

๐Ÿ“Ž License

ยฉ Imperial Solutions. Unauthorized distribution or use is prohibited.

Last updated

Was this helpful?