---
title: "Action custom_modules__export"
description: "Exports custom module records to a file (CSV/JSON) and stores the URL."
---

# Action `custom_modules__export`

> **System ID:** `action_custom_modules__export`

## Description

Exports custom module records to a file (CSV by default), saves the file, and puts the URL into a constant. Filters, attributes, and limit are set via constants `{module_name}:filter`, `{module_name}:attributes`, `{module_name}:limit`. The file name is appended with a short UUID and the chat user ID.

## Events (scenario branches)

| Event | When it occurs |
|-------|----------------|
| **success** | File created; URL saved to a constant |
| **error** | Module missing, or query, conversion, or file save failed |

## Parameters

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `module_name` | string | yes | — | Module alias; `model` is also accepted |
| `bot_id` | number | no | current bot | Module bot ID |
| `format` | string | no | `"csv"` | File format (`csv`, `json`, etc.) |
| `filename` | string | no | `"filename"` | Base file name (UUID and user id are appended) |
| `set_to` | string | no | module name | Constant for the file URL; also `saved_entity` |

**Constants for filtering (optional):**

| Constant | Description |
|----------|-------------|
| `{module_name}:filter` | Filter criteria object |
| `{module_name}:attributes` | Array of field names to export |
| `{module_name}:limit` | Maximum number of records |

## Configuration example

```json
{
  "module_name": "products",
  "format": "csv",
  "filename": "products_export",
  "set_to": "export_file_url"
}
```

## Related docs

- [Actions reference](/en/actionjail/reference/actions-reference.md)
