CSV formats
CSV imports and exports are built on pkg/csvx (see libraries): columns are declared once per
type and drive parsing and writing. Implemented today: members (import, export) and inventory (items,
consumables, locations). Other services have no CSV yet.
Common rules
Reading (imports)
| Rule | Behaviour |
|---|---|
| Upload | multipart/form-data, field file; body size capped by the service (see each format) |
| Encoding | UTF-8; a leading BOM is skipped |
| Separator | , or ;, detected on the first line (more ; than , means ;) |
| Quoting | standard CSV double quotes; rows may have a variable number of fields; leading spaces trimmed |
| Header | required (line 1); names trimmed and lower-cased, so matching is case-insensitive; order free; unknown columns ignored |
| Cells | trimmed; an empty cell is treated as absent (default value, or required error) |
| Lists | multiple values in one cell are separated by |; empty items dropped |
| Row limit | above the limit the whole file is rejected (400 invalid_csv) |
| Dry run | dry_run=true as query parameter or form field: validate only, write nothing |
Validation is all-or-nothing: every row is parsed and validated first. If any error exists, the response is
422 with every error, valid: 0, and nothing is written. Otherwise the rows are written one by one (unless dry
run) and each line gets its own outcome; a failure while writing one line (e.g. an unavailable provider) does
not stop the others and is not rolled back.
Errors use csvx.LineError; line numbers are 1-based physical lines of the file (header = line 1):
{"line": 3, "column": "personal_email", "message": "email"}
| Source | column | message |
|---|---|---|
| Missing required header | column name (line 1) | missing column; no row is parsed |
| Empty required cell | column name | required |
| Cell parser | column name | parser message (e.g. unknown status, invalid number) |
| Domain validation | domain field name (may differ from the CSV column, e.g. site_ids, site_id, purchase.price) | validation tag (required, email, max, oneof…) |
| Other failures (inventory) | empty | problem code (e.g. forbidden) |
| Malformed CSV (bad quoting) | empty | encoding/csv error text |
Import response (200 or 422):
{"dry_run": false, "valid": 2, "errors": [], "lines": [{"line": 2, "...": "per format"}]}
lines is only present after a real (non dry run) import with no errors.
Writing (exports)
| Rule | Behaviour |
|---|---|
| Response | 200, Content-Type: text/csv; charset=utf-8, Content-Disposition: attachment |
| Encoding | UTF-8 with BOM (spreadsheet compatibility) |
| Separator | ,, LF line endings, standard quoting |
| Lists | joined with | |
| Formula injection | a cell starting with =, +, -, @, tab or CR is prefixed with ' (so +33 6… is exported as '+33 6…) |
| Audit | every export is an audited read |
| Filters | the list filters of the resource apply; results are limited to the caller's authz scope |
Members
Import
POST /v1/members/import — permission members.member.create on the whole member collection (a site-scoped
grant is not enough). Limits: 1 MiB request body (400 invalid_file above), 500 data rows.
| Column | Required | Format |
|---|---|---|
first_name | yes | text, 1–64 characters |
last_name | yes | text, 1–64 characters |
personal_email | no | bare e-mail address (no display name), ≤ 254 characters |
phone | no | optional +, then 6–24 characters among digits, space, ( ) . - |
poles | no | | list among tech, bike, textile, mechanics, printing_3d, communication |
site | no | one site ID matching ^[a-z0-9][a-z0-9_-]{0,63}$ |
status | no | key of an existing status; default MEMBER_DEFAULT_STATUS (active) |
Not importable: display name (defaults to first_name last_name), birth date, pronouns, locale (fr).
Parser messages: unknown pole (allowed: …), invalid site identifier, unknown status.
Each valid line is then created like POST /v1/members (Workspace + Keycloak provisioning, see
members), sequentially. Line outcome:
| Field | Meaning |
|---|---|
line | line number |
member_id | member created |
provisioning_id + error | provisioning failed at a step (workspace_failed, keycloak_failed, keycloak_link_failed, store_failed); retry through POST /v1/members/provisionings/:id/retry |
error alone | problem code (e.g. workspace_email_unavailable, unavailable) |
Initial Workspace passwords are not returned by the import (only by the single create).
The members handler recomputes the line of each valid row assuming one record per line from line 2. After a
blank line or a quoted cell spanning several lines, validation errors and outcomes may point to the wrong line
(errors raised by csvx itself are exact). The inventory imports keep exact line numbers.
first_name;last_name;personal_email;phone;poles;site;status
Ada;Lovelace;ada@example.org;+33 6 12 34 56 78;tech|printing_3d;paris;active
Jean;Dupont;;;bike;strasbourg;
Export
GET /v1/members/export.csv → members.csv. Permission members.member.export on the whole collection;
audited as members.member.export. Filters: q, status, pole, site, include_deleted (also needs
members.member.delete). Deleted and erased members are excluded by default. The file is built in memory
(no pagination). Private fields are included.
| Column | Content |
|---|---|
id | member ID (Keycloak ID) |
first_name, last_name, display_name | names |
workspace_email | Workspace address |
personal_email, phone | private fields (decrypted) |
poles | | list |
site | site IDs, | list |
status | status key |
id,first_name,last_name,display_name,workspace_email,personal_email,phone,poles,site,status
6f1c…,Ada,Lovelace,Ada Lovelace,ada.lovelace@atelier-maker.fr,ada@example.org,'+33 6 12 34 56 78,tech|printing_3d,paris,active
Inventory
Common to the three imports: 5 MiB request body, 5000 data rows, errors sorted by line. Line outcome:
line, id, short_code (items), status (created, or exists for locations), error (problem code).
Exports are streamed row by row (common writing rules above). Upload errors: missing or unreadable file
field (or body over 5 MiB) → 400 invalid_file; unparsable file or more than 5000 rows → 400 invalid_csv.
Formats are also described in the API reference.
Items and consumables import
POST /v1/inventory/items/import (tools and machines) and POST /v1/inventory/consumables/import.
Each row is checked with inventory.item.create on the new item (site parent). Common columns:
| Column | Required | Format |
|---|---|---|
name | yes | text, ≤ 200 characters |
description | no | ≤ 4000 characters |
category, brand, model, serial | no | ≤ 64, 100, 100, 100 characters |
site | yes | site ID ^[a-z0-9][a-z0-9_-]{0,63}$ |
location | no | location ID, or name path in the site (Salle A/Armoire 1, case and accent insensitive); unresolved → location / not_found |
project_id | no | ^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$ |
tags | no | | list, ≤ 30 tags of ≤ 40 characters (normalised: lower case, no accents, words joined by -) |
supplier | no | ≤ 200 characters |
purchase_price | no | decimal ≥ 0, . or , as decimal mark |
purchase_date | no | YYYY-MM-DD |
custom_fields | no | key=value|key=value, ≤ 30 pairs, key ≤ 64, value ≤ 500 characters |
Items only:
| Column | Required | Format |
|---|---|---|
kind | no | tool (default) or machine |
status | no | available (default), borrowed, in_maintenance, out_of_service, lost |
required_training_type_ids | no | | list of up to 20 training type IDs |
Consumables only (kind is always consumable, status available):
| Column | Required | Format |
|---|---|---|
unit | yes | piece, m, g, kg, ml, l, sheet |
quantity | no | decimal ≥ 0, default 0 |
low_stock_threshold | no | decimal ≥ 0 |
unit_cost | no | decimal ≥ 0 |
name;site;location;kind;category;tags;purchase_price;purchase_date;custom_fields
Perceuse Bosch;paris;Salle A/Armoire 1;tool;perçage;sans fil|18V;89,90;2025-10-02;voltage=18V
Laser Epilog;paris;Salle B;machine;découpe;;12000;2024-01-15;
name,site,unit,quantity,low_stock_threshold,unit_cost
Contreplaqué 3 mm,paris,sheet,40,10,"4,50"
Filament PLA noir,paris,kg,12,2,22
Items and consumables export
GET /v1/inventory/items/export.csv (items.csv, tools and machines) and
GET /v1/inventory/consumables/export.csv (consumables.csv). Results are limited to the
inventory.item.read scope; both audited as inventory.item.export. Filters: q, site, location, kind
(must match the export, otherwise 422), status, category, tag, project, low_stock,
include_deleted (needs inventory.item.read_all).
Columns: id, short_code, kind, name, description, category, brand, model, serial, site,
location (name path), location_id, status, project_id, tags, supplier, purchase_price,
purchase_date, custom_fields (keys sorted), then required_training_type_ids (items) or unit,
quantity, low_stock_threshold, unit_cost (consumables). Numbers use .. The import ignores the extra
columns (id, short_code, location_id…), so an export can be re-imported to create copies.
Locations import
POST /v1/inventory/locations/import. Permission inventory.location.create per site.
| Column | Required | Format |
|---|---|---|
site | yes | site ID |
path | yes | names from the site root separated by / (Salle A/Armoire 1); each name 1–100 characters |
type | yes | key of a location type of the site (defaults: room, furniture, shelf, bin); else type / unknown |
description | no | ≤ 1000 characters |
Lines are processed in order: the parent of a path must exist or be created by an earlier line (otherwise
path / parent_not_found). An existing path (compared case and accent insensitive) is reported exists and
left unchanged.
site,path,type,description
paris,Salle A,room,Atelier bois
paris,Salle A/Armoire 1,furniture,
paris,Salle A/Armoire 1/Étagère haute,shelf,Visserie
Locations export
GET /v1/inventory/locations/export.csv → locations.csv, limited to the inventory.location.read scope,
audited as inventory.location.export. Filters: site, parent, under, q. Parents come before children,
so the file can be re-imported as is. Columns: id, site, path, type, description, parent_id.
id,site,path,type,description,parent_id
01J…A,paris,Salle A,room,Atelier bois,
01J…B,paris,Salle A/Armoire 1,furniture,,01J…A