> For the complete documentation index, see [llms.txt](https://daddy-studios.gitbook.io/daddy-studios-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://daddy-studios.gitbook.io/daddy-studios-docs/scripts/daddy-marketplace/exports/server.md).

# Server Exports

## GetActiveListings

```lua
exports['daddy-marketplace']:GetActiveListings(locationId)
```

Returns the open, unexpired listings of one location as an array of rows from `daddy_marketplace_listings` — featured first, then newest first. Pass `nil` for every location.

```lua
local rows = exports['daddy-marketplace']:GetActiveListings('main_market')

for _, row in ipairs(rows) do
    print(row.id, row.item_name, row.quantity, row.price, row.seller_name)
end
```

Useful columns: `id`, `seller_identifier`, `seller_name`, `item_name`, `item_label`, `item_metadata`, `quantity`, `price` (per unit), `category`, `location_id`, `expires_at`, `is_featured`, `is_anonymous`, `created_at`. The full schema is on the [Database](/daddy-studios-docs/scripts/daddy-marketplace/database.md) page.

{% hint style="info" %}
This is a database read. Call it when something asks for the data — a price board, a Discord bot command — not in a loop every frame.
{% endhint %}

## GetPlayerListings

```lua
exports['daddy-marketplace']:GetPlayerListings(identifier, status)
```

Returns up to 100 listings of one player, newest first. `identifier` is the framework identifier: citizenid on QB/QBX, identifier on ESX.

| `status`         | Returns                             |
| ---------------- | ----------------------------------- |
| `'active'`       | Open listings that have not expired |
| `'sold'`         | Sold listings                       |
| `'cancelled'`    | Cancelled listings                  |
| `'expired'`      | Expired listings                    |
| `'all'` or `nil` | Every listing of that player        |

```lua
local active = exports['daddy-marketplace']:GetPlayerListings('ABC12345', 'active')
print(('%s has %d active listings'):format('ABC12345', #active))
```

## IsItemBlacklisted

```lua
exports['daddy-marketplace']:IsItemBlacklisted(itemName)
```

Returns `true` when the item may never be traded: it is in `Config.BlacklistedItems` (not case-sensitive), or it is a weapon while `Config.BlockWeapons` is on.

```lua
if exports['daddy-marketplace']:IsItemBlacklisted('weapon_pistol') then
    print('the marketplace will not accept this')
end
```

Use it to keep your own trading, crafting or shop resource in step with one blacklist instead of maintaining two lists that drift apart.

## Example: a market price board

```lua
RegisterCommand('marketcheck', function(source, args)
    local wanted = (args[1] or ''):lower()
    local rows = exports['daddy-marketplace']:GetActiveListings('main_market')
    local cheapest

    for _, row in ipairs(rows) do
        if row.item_name:lower() == wanted then
            if not cheapest or row.price < cheapest.price then cheapest = row end
        end
    end

    if cheapest then
        print(('cheapest %s: $%d each'):format(cheapest.item_label, cheapest.price))
    else
        print('nothing listed')
    end
end, true)
```

## Next steps

* [Client Exports](/daddy-studios-docs/scripts/daddy-marketplace/exports/client.md)
* [Config Hooks](/daddy-studios-docs/scripts/daddy-marketplace/hooks.md)
* [Database](/daddy-studios-docs/scripts/daddy-marketplace/database.md)


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://daddy-studios.gitbook.io/daddy-studios-docs/scripts/daddy-marketplace/exports/server.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
