# Importing and exporting bundles (/docs/guides/import-export-bundles)



A decision almost never lives alone: it leans on reusable decision tables and project constants.
When work has to move — from a test environment to production, from one project to another, or
simply to keep a copy — what you want to carry over is *the decision and everything it needs to
run*, not just the drawing of the flow.

That is what the **transfer** is for: export to a file and import it back.

## File shapes [#file-shapes]

There are three file shapes, all in JSON and all identifiable by a `kind` field:

| Kind         | What it carries                                                          |
| ------------ | ------------------------------------------------------------------------ |
| `decision`   | A decision: its key, its name and its working draft.                     |
| `table`      | A decision table: its key, its name and its definition.                  |
| `bundle`     | A decision **plus** the tables it references and the constants it reads. |
| `collection` | Every element of a type in one file — a backup of the whole project.     |

A bundle is the useful shape when you want to recreate a whole behavior in another project.

## What travels and what does not [#what-travels-and-what-does-not]

**Only the working draft travels**: the logic exactly as you are editing it. What does not travel:

* The **version history** — the decision arrives with no published versions; it is published again
  whenever you want.
* **Credentials** — a flow stores references to credentials, never their secrets, so the file can
  be shared without leaking anything.

## Resolving a clashing key [#resolving-a-clashing-key]

Keys are unique within a project. If the key already exists on import, you decide what to do:

* **Overwrite** — the existing draft is replaced. It is safe precisely because a published
  decision keeps the version it was published with; nothing already in service changes until you
  publish again.
* **Import as a copy** — the decision comes in with a new key that you choose.

In a bundle, tables and constants that already exist are **reused as-is** in `create` mode and
**replaced** in `overwrite` mode. The whole bundle is written in a single transaction: if
anything fails, nothing is left half-done.

## In the console [#in-the-console]

* **Decisions list** and **tables list**: an *Import* button and an *Export* button (exports
  every element of the type).
* **Decision detail**: an *Export* button with two options — just the decision, or the full
  bundle with its tables and constants.
* **Table editor**: an *Export* button for that table.

## Over the API [#over-the-api]

Importing is a session-authorized operation:

```
POST /api/v1/decisions/import
POST /api/v1/tables/import
POST /api/v1/decisions/import-bundle
```

Each receives the file content plus a `mode` field — `create` (refuses an existing key) or
`overwrite` (replaces the draft). The interactive API documentation describes them with their
schemas.
