# CSV Import, Export And The API

> Source: https://primemoq.app/help/managing-rules/rules-api-and-csv-import-export
> Collection: Managing Rules
> Updated: 2026-11-15

Move rules in and out of Prime MOQ as JSON or CSV, bulk-edit them in a spreadsheet, or read and write them from your own systems with an API key and a write log.

**Short answer.** Settings, Import, export and API is where rules move in and out of Prime MOQ. JSON is the complete, lossless format and is free on every plan. CSV, on Pro, carries the fields you bulk-edit in a spreadsheet, and a CSV import leaves untouched anything the file does not carry. API keys, also Pro, let your own systems read and write rules at 60 requests per minute per key, with every write recorded in a write log.

## Key takeaways

- JSON is the complete backup and is free. CSV is for spreadsheet bulk edits and is Pro.
- A CSV row with a ruleId updates that rule. A row without one creates a new, paused rule.
- A CSV import never erases what the CSV does not carry, such as messages, design and exclusion lists.
- JSON import adds every rule as a new, paused rule, alongside the ones you already have.
- An API key is shown once. Prime MOQ only stores a hash of it.
- The Write log records every API write, with the key that made it.

## Where it is

Go to **Settings**, then **Import, export and API**:

> **Import, export and API**
Move rules in and out of Prime MOQ, or read and write them from your own
systems.

The page has two parts: **Import and export rules**, and **API keys**.

## JSON or CSV

The page explains the difference in one line:

> JSON is the complete, lossless format and stays on every plan. CSV is the one
you can edit in a spreadsheet: it carries the fields you bulk-edit, not the
design and message JSON.

|  | JSON | CSV |
| --- | --- | --- |
| **Buttons** | Export JSON, Import JSON | Export CSV, Import CSV |
| **Plan** | Free on every plan | Pro |
| **Carries** | Everything | The fields you bulk-edit |
| **Edit by hand** | No. Treat it as a backup file. | Yes, in any spreadsheet |
| **Use it for** | Backups, and moving rules to another store | Changing many rules at once |

Export JSON downloads the same `.dpx` backup file the Safe Uninstall page
produces. It is not a separate format, just the same backup available any time.

## CSV export and import

### What a CSV carries

One row per rule, with columns for the rule's ID, name, type and status; its
minimum, maximum, multiple, value and weight limits and weight unit; how to
count; its schedule; its product scope (products, collections, tags, vendors,
product types and price ranges); customer eligibility and countries; and the
Contact us settings.

It does not carry per-language messages, design, purchase history or the
detail of each scope entry. That is what keeps JSON as the complete format.

### How an import treats each row

| Row | What happens |
| --- | --- |
| Has a `ruleId` that exists in this store | That rule is updated. If the row sets a status, the status changes too. |
| Has no `ruleId` | A new rule is created, as **Paused**. |
| Has a `ruleId` that does not exist here | The row is skipped, with an error. |

When the import finishes it reports "{created} created · {updated} updated ·
{skipped} skipped", with a list of rows that failed and why. An updated rule
that is active is reapplied straight away.

### It does not erase what it does not carry

The page shows this on its own:

> **A CSV import will not erase what the CSV does not carry**
Per-language messages, design and exclusion lists are left untouched.
Round-tripping an export through a spreadsheet is safe.

So you can export, change the minimums in a spreadsheet, and import, without
losing the messages you wrote in four languages. A blank scope column also
leaves that part of the scope as it was.

## JSON import

Import JSON accepts a Prime MOQ export (`.dpx`, `.json` or `.txt`) and works on
any store, including one that already has rules. Every rule in the file is
**added as a new, paused rule**. Nothing existing is replaced, so importing the
same file twice gives you two copies of each rule. Review the imported rules,
then activate the ones you want.

## Dos and don'ts

- Do export JSON before a large bulk edit. It is the complete, lossless
backup.

- Do use CSV only for the fields you actually want to bulk-edit in a
spreadsheet.

- Don't rely on CSV as your only backup. It does not carry per-language
messages or design settings.

- Don't assume a CSV re-import clears fields it does not include. Missing
columns are left untouched, not wiped.

## API keys

> **API keys**
Read and write rules from your own systems. /api/v1/rules · 60 requests per
minute per key.

An API key lets another system, such as an ERP, a PIM or your own script, list,
read, create, update and delete rules. Send the key as a bearer token. Each key
can make 60 requests a minute.

### Create a key

Click **Create key**, give it a name that says which integration it is for, and
create it. The token appears once:

> **You will not see this again**
Copy this token now. Prime MOQ only stores a hash of it, not the plaintext.

Copy it straight into wherever the integration keeps its secrets. Prime MOQ
cannot show it to you again, because it never kept it. If you lose it, revoke
the key and create a new one.

### The keys table

| Column | What it shows |
| --- | --- |
| **Name** | The name you gave the key. |
| **Key** | The first characters of the key followed by dots, enough to tell keys apart without showing the token. |
| **Created** | When it was made. |
| **Last used** | When it last made a request, or **Never**. |
| **Revoke** | Switches the key off immediately. |

Revoking is immediate and cannot be undone. Anything using that key stops
working on its next request.

### The Write log

Below the keys sits the **Write log**:

> Every write through the API, with the key that made it. When an integration
wipes a merchant's rules at 3am, this is the difference between an answer and
a guess.

Each entry records **When**, **Key** (the key's name), **Action** (create,
update or delete, with the ID of the rule it touched) and **Status** (the
response code, so a refused write shows as well as a successful one). Read-only
requests are not logged, because they cannot change anything.

It is worth knowing about before you need it. When rules change and nobody on
the team changed them, the write log tells you which integration did it and
when, and which key to revoke.

### Keeping keys safe

- Store a key in a password manager or secrets vault, not a shared document.

- Create a separate key for each integration, so you can revoke one without
breaking the others.

- Never paste a key into client-side code, such as theme JavaScript, or into a
public repository.

- If you suspect a key has leaked, revoke it immediately and create a new one.

## Common mistakes

- Using CSV as the only backup. It leaves out messages and design. Export
JSON as well.

- Deleting a column to clear a field. A missing or blank column leaves the
field as it was. Change the value instead.

- Importing JSON twice. JSON import always adds new rules, so a second run
duplicates everything.

- One key shared by every integration. You cannot then revoke one without
breaking them all, and the write log cannot tell them apart.

- Expecting imported rules to enforce straight away. New rules from either
import arrive Paused.

## FAQ

### Is CSV import and export free?

No, CSV is Pro. JSON import and export are free on every plan, and JSON is the complete backup.

### Will a CSV import delete my translated messages?

No. A CSV does not carry per-language messages, design or exclusion lists, and an import leaves anything the file does not carry exactly as it was.

### How do I create new rules from a CSV?

Leave the ruleId column empty on those rows. Each one is created as a new, paused rule. Rows with a ruleId update the existing rule instead.

### What is the difference between this page and Safe Uninstall?

Safe Uninstall walks you through backing up before you remove the app, and its export is the same JSON backup as Export JSON here. This page is available any time, imports into a store that already has rules, and adds CSV and the API on Pro.

### What happens if an integration goes over 60 requests a minute?

Requests above the limit for that key are refused until the minute passes. Spread bulk changes out, or use CSV import for a one-off change across many rules.

### I lost an API key. Can I see it again?

No. Prime MOQ only stores a hash of the key, so it cannot be shown again. Revoke it and create a new one.

**Best for:** Stores managing many rules, agencies moving setups between stores, and teams connecting Prime MOQ to an ERP or PIM.

**Applies to:** JSON and CSV rule files, Prime MOQ API
