> For the complete documentation index, see [llms.txt](https://docs.kojascripts.eu/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kojascripts.eu/koja-lib/api-reference/server-api/notifications.md).

# Notifications

Send notifications to a player from the server side.

## SendNotify

```lua
KOJA.Server.SendNotify(data)
```

| Field    | Type      | Description                                   |
| -------- | --------- | --------------------------------------------- |
| `source` | `number`  | Player server ID                              |
| `type`   | `string?` | `"success"`, `"error"`, `"info"`, `"warning"` |
| `title`  | `string?` | Notification title                            |
| `desc`   | `string`  | Notification body text                        |
| `time`   | `number?` | Duration in milliseconds                      |
| `icon`   | `string?` | Icon name (backend-specific)                  |
| `color`  | `string?` | Accent colour (backend-specific)              |

The backend used is determined by `Config.Notify` — the same setting as the client.

## Examples

```lua
-- Success
KOJA.Server.SendNotify({
    source = source,
    type   = 'success',
    title  = 'Job Completed',
    desc   = 'You received $500.',
    time   = 5000,
})

-- Error
KOJA.Server.SendNotify({
    source = source,
    type   = 'error',
    desc   = 'You do not have enough money.',
})

-- Info
KOJA.Server.SendNotify({
    source = source,
    type   = 'info',
    title  = 'Server',
    desc   = 'Maintenance in 5 minutes.',
    time   = 10000,
})
```

## Notify all players

koja-lib does not expose a "broadcast" helper. Use a standard server event:

```lua
-- Notify every connected player
for _, playerId in ipairs(KOJA.Server.GetPlayers()) do
    KOJA.Server.SendNotify({
        source = playerId,
        type   = 'warning',
        desc   = 'Server restart in 10 minutes.',
        time   = 8000,
    })
end
```

## Backends

| Config.Notify | Backend                          |
| ------------- | -------------------------------- |
| `"esx"`       | ESX `showNotification`           |
| `"qb"`        | QBCore `QBCore.Functions.Notify` |
| `"ox"`        | `exports.ox_lib:notify`          |
| `"lib"`       | koja-lib built-in notification   |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.kojascripts.eu/koja-lib/api-reference/server-api/notifications.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
