> For the complete documentation index, see [llms.txt](https://cde-inc.gitbook.io/cde-cad-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cde-inc.gitbook.io/cde-cad-documentation/fivem-developer-integration/evidence.md). Agents can also search and read this documentation through its [MCP server](https://cde-inc.gitbook.io/cde-cad-documentation/~gitbook/mcp).

# Evidence

Book seized items into the CAD's evidence locker from in game. The item gets a tag, goes into the officer's custody and shows up in their locker on the CAD straight away. It is the same record you get from booking it on the website.

## Book an Item

```
POST /api/fivem/evidence
```

{% hint style="warning" %}
Requires `actingDiscordId`. The officer has to be a member of the community **with department access** - the same rule the locker uses on the website. Without it the request returns `403` with the reason. This applies to the community owner too: the game API never gets admin access to the locker.
{% endhint %}

### Request Body

```json
{
  "actingDiscordId": "DISCORD_USER_ID",    // required: the officer booking it
  "description": "Glock 17, serial filed off", // required
  "category": "Firearm",                   // optional: defaults to "Other"
  "quantity": "1",                         // optional: free text, e.g. "3 bags" or "$4,200"
  "caseNumber": "LSPD-26-0042",            // optional
  "collectedLocation": "Grove Street",     // optional: where it was found
  "storageLocation": "Locker 3",           // optional: where it's kept
  "collectedAt": "2026-10-15T18:30:00Z",   // optional: defaults to now
  "owner": "123-45-6789",                  // optional: civilian _id or SSN
  "ownerName": "John Doe",                 // optional: filled in from the civilian if you pass owner
  "notes": "Recovered from the glovebox"   // optional
}
```

`category` is one of `Firearm`, `Currency`, `Narcotics`, `Vehicle`, `Electronics`, `Document`, `Biological`, `Clothing` or `Other`.

`owner` can also be sent as `civilianId`. It's only looked up in your own community, so a civilian from another community returns `404`.

`collectedAt` can be earlier in the shift but not in the future.

Long text is trimmed, not rejected: `description` 2000 characters, `notes` 4000, `collectedLocation` 200, `storageLocation` and `ownerName` 120, `caseNumber` and `quantity` 60.

You can't attach photos or files from in game. Book the item, then add files to it from the evidence locker on the CAD. A request that includes `files` returns `400`.

### Response

`201 Created`

```json
{
  "success": true,
  "evidence": {
    "id": "6710f0c2a1b2c3d4e5f60718",
    "tag": "EV-2026-000042",
    "status": "in-custody",
    "category": "Firearm",
    "description": "Glock 17, serial filed off",
    "quantity": "1",
    "caseNumber": "LSPD-26-0042",
    "storageLocation": "Locker 3",
    "collectedLocation": "Grove Street",
    "collectedAt": "2026-10-15T18:30:00.000Z",
    "collectedBy": "Ana Ortiz",
    "owner": "6710e9b4a1b2c3d4e5f60701",
    "ownerName": "John Doe",
    "notes": "Recovered from the glovebox"
  }
}
```

`tag` is what officers search for in the locker, so it's the one worth showing the player.

### Errors

| Status | Reason                                                                                                                                       |
| ------ | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `400`  | Missing `actingDiscordId` or `description`, an unknown `category`, a future `collectedAt`, or `files` sent. `field` names the problem field. |
| `401`  | Invalid or revoked API key.                                                                                                                  |
| `403`  | The officer isn't in the community or has no department access, or your API key doesn't have the `evidence:write` scope.                     |
| `404`  | `owner` isn't a civilian in your community.                                                                                                  |

Errors come back as `{ "success": false, "msg": "...", "field": "..." }`. `msg` is written to be shown to the player as is.

### Lua Example

```lua
-- server/evidence.lua
local function getDiscordId(src)
    for _, id in ipairs(GetPlayerIdentifiers(src)) do
        if id:sub(1, 8) == 'discord:' then
            return id:sub(9)
        end
    end
end

-- From the client:
-- TriggerServerEvent('cde-cad:bookEvidence', { description = 'Glock 17', category = 'Firearm', storageLocation = 'Locker 3' })
RegisterNetEvent('cde-cad:bookEvidence')
AddEventHandler('cde-cad:bookEvidence', function(item)
    local src = source
    local discordId = getDiscordId(src)
    if not discordId then
        TriggerClientEvent('chat:addMessage', src, { args = { '^1[Evidence]', 'Discord is not linked to FiveM.' } })
        return
    end

    local body = json.encode({
        actingDiscordId   = discordId,
        description       = item.description,
        category          = item.category,
        quantity          = item.quantity,
        caseNumber        = item.caseNumber,
        storageLocation   = item.storageLocation,
        collectedLocation = item.location,
        owner             = item.owner
    })

    PerformHttpRequest(Config.CadUrl .. '/api/fivem/evidence', function(statusCode, responseText)
        local data = responseText and json.decode(responseText) or {}
        if statusCode == 201 then
            TriggerClientEvent('chat:addMessage', src, {
                args = { '^2[Evidence]', 'Booked in as ' .. data.evidence.tag }
            })
        else
            TriggerClientEvent('chat:addMessage', src, {
                args = { '^1[Evidence]', data.msg or ('Failed: ' .. tostring(statusCode)) }
            })
        end
    end, 'POST', body, {
        ['Content-Type'] = 'application/json',
        ['x-api-key']    = Config.ApiKey
    })
end)
```
