Skip to main content

Import & export

The only way to bulk-manage links. Both endpoints live directly under /api — not /api/v1 — and ride the dashboard session cookie, not an API token. They are file transfers, not JSON RPCs, so they travel as plain HTTP.

Export​

GET /api/links.csv downloads every link as a spreadsheet-native CSV:

# Export with your dashboard session cookie (sign in at lsg.bio first)
curl -b cookies.txt https://lsg.bio/api/links.csv -o lsgbio-links.csv

Answers text/csv as an attachment (lsgbio-links.csv). Unauthenticated requests get 401.

Import​

POST /api/links/import takes the raw CSV bytes in the request body (bounded at 64 KB) and creates the rows:

curl -b cookies.txt -X POST https://lsg.bio/api/links/import \
--data-binary @lsgbio-links.csv

A file that cannot be read at all is 400 with the reason. Row-level problems are not errors — they come back 200 with a report, because 197 of 200 rows landing is a success the creator needs to hear about:

{
"total": 200,
"created": 197,
"failed": [
{ "row": 7, "slug": "spring", "reason": "that path is already in use" }
]
}

row is the spreadsheet line number, header included; failed is always a list, never null.