---
title: "One-shot import of this browser's localStorage achievements into PG"
method: POST
path: "/api/milestones/migrate"
tags: ["Education"]
---

# One-shot import of this browser's localStorage achievements into PG

`POST /api/milestones/migrate`

## Request

- Base URL: `https://www.oxfordledge.com` (the document declares no server; this is the origin it was published from)
- URL: `https://www.oxfordledge.com/api/milestones/migrate`
- Auth: none declared

Bulk-upsert a user's localStorage honors on first authed load. Body:
`{items: [{milestone_id, progress?, unlocked?}, ...]}`. Idempotent (monotonic
conflict clause); capped at 2000 items.

## Response `200`

Successful Response

- MilestonesMigrateResponse: `POST /api/milestones/migrate` — one-shot localStorage->PG import. MILE-1 (#101). `migrated` is the count of items written; idempotent — the monotonic conflict clause makes re-runs safe (they only ratchet up).
  - `migrated` integer, required: Achievements written to PG this call.
  - `error` string, nullable: Top-level error.

## Other responses

- `400`: Bad Request
- `401`: Unauthorized

---

[API](https://skmtc.dev/oxfordledge/apis/oxford-ledge-api.md) · [All operations](https://skmtc.dev/oxfordledge/apis/oxford-ledge-api/llms.txt) · [OpenAPI document](https://skmtc.dev/oxfordledge/apis/oxford-ledge-api/revisions/e832a1260f0b?raw)
