Wiki Navigation

API Reference
CRUD Operations

Random Presets API

Manage random preset configurations (cfgrandompresets.xml). Define reusable cargo and attachment presets that can be referenced by spawnable types.

Authentication required: All endpoints require a valid Bearer token. See Authentication for details.

GET

List Random Presets

Retrieve a paginated list of random presets for a specific instance.

Endpoint

GET /api/instance/{instance_sid}/random-preset

Parameters

instance_sid
string required

The SID of the instance (URL parameter)

page integer

Page number for pagination. Defaults to 1.

like string

Filter presets by name using partial match.

type string

Filter by type: CARGO or ATTACHMENT.

Response

{
  "current_page": 1,
  "data": [
    {
      "id": 1,
      "sid": "preset123abc",
      "name": "foodGeneral",
      "type": "CARGO",
      "chance": 0.5,
      "instance_id": 1
    },
    {
      "id": 2,
      "sid": "preset456def",
      "name": "rifleAttachments",
      "type": "ATTACHMENT",
      "chance": 0.3,
      "instance_id": 1
    }
  ],
  "per_page": 30,
  "total": 12
}
GET

Get Random Preset

Retrieve details of a specific random preset including its child items.

Endpoint

GET /api/instance/{instance_sid}/random-preset/{random_preset_sid}

URL Parameters

instance_sid required

The SID of the instance

random_preset_sid required

The SID of the random preset

Response

{
  "id": 1,
  "sid": "preset123abc",
  "name": "foodGeneral",
  "type": "CARGO",
  "chance": 0.5,
  "instance_id": 1,
  "children": [
    {
      "id": 1,
      "parent_id": 1,
      "classname_id": 50,
      "chance": 0.3,
      "classname": {
        "id": 50,
        "name": "Apple"
      }
    },
    {
      "id": 2,
      "parent_id": 1,
      "classname_id": 51,
      "chance": 0.2,
      "classname": {
        "id": 51,
        "name": "Pear"
      }
    }
  ]
}
POST

Create Random Preset

Create a new random preset for an instance.

Endpoint

POST /api/instance/{instance_sid}/random-preset

Request Body

name
string required

Unique preset name identifier

type
string required

CARGO or ATTACHMENT

chance float

Spawn chance (0.0 - 1.0)

Example Request

{
  "name": "medicalSupplies",
  "type": "CARGO",
  "chance": 0.4
}
PATCH

Update Random Preset

PATCH /api/instance/{instance_sid}/random-preset/{random_preset_sid}

Update an existing random preset. Include only fields to change.

DELETE

Delete Random Preset

DELETE /api/instance/{instance_sid}/random-preset/{random_preset_sid}

Permanently delete a random preset and its child items from the instance.