Before leaving Lemon Squeezy, export every record your business relies on: orders, customers, subscriptions, license keys, and active license key instances. While the Orders dashboard offers a CSV export, the Lemon Squeezy REST API is the authoritative way to capture full order refund history, subscriptions (including PayPal flags), license keys, and activation instances.
Export orders via CSV
From the Lemon Squeezy Orders page, click Export to receive a CSV via email. It includes order identifiers, product and variant names, buyer details, card metadata, currency, amounts in USD cents, tax name/rate, and UTC timestamp.
Keep in mind that the Orders CSV omits order status and refunded amounts. Always pull orders through the API as well so your accounting and fulfilment records include full refund and dispute states.
Export complete records via the Lemon Squeezy API
Generate an API key in your Lemon Squeezy account settings and query https://api.lemonsqueezy.com with Accept: application/vnd.api+json and Authorization: Bearer $LEMONSQUEEZY_API_KEY. List endpoints support up to 100 items per page (page[size]=100) with a rate limit of 300 requests per minute.
| Resource | Endpoint | Key fields to keep |
|---|---|---|
| Customers | GET /v1/customers | id, name, email, country, revenue totals |
| Orders | GET /v1/orders | identifier, order_number, status, amounts, refunded_amount, tax fields |
| Subscriptions | GET /v1/subscriptions | id, status, renews_at, ends_at, payment_processor (stripe or paypal), user_email |
| License keys | GET /v1/license-keys | Full key, status, activation_limit, instances_count, expires_at, product_id, order_id |
| License key instances | GET /v1/license-key-instances | id, identifier (activation instance ID), name, license_key_id |
Exporting license keys and activations safely
Keep your API key in an environment variable rather than pasting it into shell commands (read -rs LEMONSQUEEZY_API_KEY && export LEMONSQUEEZY_API_KEY). If you are moving to CopperPouch, our built-in export CLI script fetches your license keys, activations, and order item mappings in one pass and writes a locked-down JSON import file (readable only by your user account):
LEMONSQUEEZY_API_KEY=... pnpm exec tsx scripts/export-lemon-squeezy-licenses.ts > ls-licenses.json
Prefer raw curl and jq? Pass -g so curl does not interpret bracketed query parameters:
BASE="https://api.lemonsqueezy.com/v1"
mkdir -p export
fetch_all() {
endpoint="$1"
page=1
last=1
while [ "$page" -le "$last" ]; do
curl -sSg "$BASE/$endpoint?page[number]=$page&page[size]=100" \
-H "Accept: application/vnd.api+json" \
-H "Content-Type: application/vnd.api+json" \
-H "Authorization: Bearer $LEMONSQUEEZY_API_KEY" \
-o "export/$endpoint-$page.json"
last=$(jq '.meta.page.lastPage' "export/$endpoint-$page.json")
page=$((page + 1))
sleep 1
done
}
fetch_all license-keys
fetch_all license-key-instances
jq -s '[.[].data[]]' export/license-keys-*.json > export/license-keys-all.json
jq -s '[.[].data[]]' export/license-key-instances-*.json > export/license-key-instances-all.json
Never substitute key_short for the full key, and always encrypt or securely delete temporary export files once imported—they contain live customer license keys and email addresses.
Verify your export before switching over
- Match API totals: Verify
jq lengthon each merged file matchesmeta.page.totalfrom page 1. - Deduplicate by ID: Because records are sorted newest-first, a new sale during pagination can shift page boundaries. Deduplicate by
idand re-run a final diff right before cutover. - Check referential integrity: Confirm every instance’s
license_key_idmaps to an exported license key and every key maps to a product and order. - Separate test and live data: Never mix
test_mode: truerecords into your production archive. - Download tax & payout records: Save all historical tax documents and statements from your payout provider (Stripe Express, PayPal, or Wise) before closing out your account.
Importing license keys into CopperPouch
Once exported, run a dry-run import against CopperPouch to validate every key and product mapping, then commit the import with all active device instances preserved. Shipped apps keep validating without a rewrite by pointing at CopperPouch’s compatible endpoint. Follow our license key migration guide and the full migration checklist.