> ## Documentation Index
> Fetch the complete documentation index at: https://docs.facetflux.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Exports

> Turn your catalog into BMEcat, CSV, or channel-specific formats through reusable export profiles.

Exports convert your enriched products into the formats your channels expect. Every export runs through an **export profile** — a named target that binds your attributes to a format and serializer. You list the profiles available for a schema, then export a single product, a selection, or the whole catalog.

## List export profiles

`GET /api/v1/pim/exports/profiles?schemaId=...` returns the profiles that apply to a schema:

```bash theme={null}
curl "https://app.facetflux.com/api/v1/pim/exports/profiles?schemaId=$SCHEMA_ID" \
  -H "Authorization: Bearer $FACETFLUX_API_KEY"
```

Each profile has a `key` (used in the export calls below), a `displayName`, the `contentType` and `fileExtension` it produces, and the `languages` it supports (`available` plus a `default`).

## Export one product

`GET /api/v1/pim/exports/products/{productId}?profileKey=...&language=...` returns the file directly — the `Content-Type` matches the profile, and the body is the export:

```bash theme={null}
curl "https://app.facetflux.com/api/v1/pim/exports/products/$PRODUCT_ID?profileKey=bmecat&language=de" \
  -H "Authorization: Bearer $FACETFLUX_API_KEY" \
  -o product.xml
```

## Export a selection

`POST /api/v1/pim/exports/selection` bundles up to **200** products into a ZIP synchronously:

```python Python theme={null}
resp = requests.post(
    "https://app.facetflux.com/api/v1/pim/exports/selection",
    headers={"Authorization": f"Bearer {os.environ['FACETFLUX_API_KEY']}"},
    json={"productIds": ids[:200], "profileKey": "bmecat", "language": "de"},
)
resp.raise_for_status()
open("selection.zip", "wb").write(resp.content)
```

For more than 200 products, use a catalog export job instead.

## Export the whole catalog

A full-schema export runs as a background job. Start it, poll status, then download:

<Steps>
  <Step title="Start the job">
    `POST /api/v1/pim/exports/catalog` with `{ "schemaId": "...", "profileKey": "...", "language": "..." }` returns `202` with a `jobId`.

    ```python theme={null}
    job = requests.post(
        "https://app.facetflux.com/api/v1/pim/exports/catalog",
        headers=headers,
        json={"schemaId": schema_id, "profileKey": "bmecat", "language": "de"},
    ).json()
    job_id = job["jobId"]
    ```
  </Step>

  <Step title="Poll status">
    `GET /api/v1/pim/exports/{jobId}/status` returns `status` (`Queued` / `Processing` / `Success` / `Failed`), `progress`, and `ready` — poll until `ready` is `true`.
  </Step>

  <Step title="Download">
    `GET /api/v1/pim/exports/{jobId}/download` streams the artifact once the job succeeded.

    ```bash theme={null}
    curl "https://app.facetflux.com/api/v1/pim/exports/$JOB_ID/download" \
      -H "Authorization: Bearer $FACETFLUX_API_KEY" -o catalog.zip
    ```
  </Step>
</Steps>

<Note>
  Only one catalog export runs per (schema, profile) at a time — starting a duplicate returns `409`. Downloading before the job succeeds returns `409`; the artifact is retained for a limited time after completion.
</Note>

<Warning>
  Job status uses capitalized values (`Success`, `Queued`, `Processing`, `Failed`) — distinct from the lowercase `status` values on products and diagnostics. Compare exact strings.
</Warning>
