Import & Export
Async jobs for importing and exporting your bookmark library
Import and export operations run as async jobs because they can process thousands of bookmarks. You start a job, poll its status, and download the result when complete.
The endpoints that start or feed a job (POST /export/:format and each POST /import/... step) are heavy endpoints: 2 requests per minute each. Every endpoint has its own counter, so the import steps can run back to back. GET /jobs/:id and POST /jobs/:id/download only count toward your plan's normal limits. See Rate Limits.
Export
Start an Export
POST /export/:formatScope: export
Formats: json, csv, html
Response:
{
"data": {
"jobId": "job_abc123"
}
}Check Job Status
GET /jobs/:idScope: any valid token (ownership verified; another user's job returns 404)
{
"data": {
"id": "job_abc123",
"type": "export_json",
"status": "running",
"progress": { "processed": 1200, "total": 3400 },
"createdAt": 1768473000000
}
}| Field | Type | Description |
|---|---|---|
type | string | export_json, export_csv, export_html or import_html |
status | string | See the table below |
progress | object | processed items so far, and total once it's known |
createdAt | number | When the job was created (Unix milliseconds) |
Job statuses:
| Status | Description |
|---|---|
pending | Job created, waiting to start |
running | Processing in progress |
completed | Done. Exports add downloadReady and artifactExpiresAt; imports add result |
failed | Job failed. See error |
Poll until the status is completed or failed. Polling every few seconds is fine.
A completed export adds:
| Field | Type | Description |
|---|---|---|
downloadReady | boolean | true while the file can be downloaded |
artifactExpiresAt | number | When the file expires (Unix milliseconds), 2 hours after completion |
A failed job (import or export) adds error:
{
"data": {
"id": "job_abc123",
"type": "export_json",
"status": "failed",
"progress": { "processed": 0 },
"createdAt": 1768473000000,
"error": { "code": "JOB_FAILED", "message": "Job failed" }
}
}error.code | Meaning |
|---|---|
JOB_CANCELED | The job was canceled, for example because the account is being deleted |
JOB_TIMED_OUT | An import was reserved but not started within its 10-minute window |
JOB_FAILED | Anything else. error.message says what went wrong |
Download the Export
POST /jobs/:id/downloadScope: export
Returns the export file itself, with its Content-Type (application/json, text/csv or text/html) and a Content-Disposition: attachment; filename="bookmark-land-export.<ext>" header. Errors: Job is not completed, Only export jobs support download, No artifact available and Artifact has expired.
Notes:
- Artifacts expire 2 hours after job completion. After that, start a new export.
- Collections keep their nesting: HTML nests each collection's folder inside its parent's, and the
collectionfield in JSON and CSV is the full path joined with/(for exampleDesign/Typography) - A cleanup cron removes expired artifacts, import reservations that were never started, and the chunks of failed jobs
Full Export Workflow
# 1. Start the export
curl -X POST https://api.bookmark.land/v1/export/json \
-H "Authorization: Bearer bkl_your_token"
# Response: {"data": {"jobId": "job_abc123"}}
# 2. Poll status until completed
curl https://api.bookmark.land/v1/jobs/job_abc123 \
-H "Authorization: Bearer bkl_your_token"
# 3. Download the file when status is "completed"
curl -X POST https://api.bookmark.land/v1/jobs/job_abc123/download \
-H "Authorization: Bearer bkl_your_token" \
-o bookmarks.jsonImport
Imports read a browser bookmarks export (Netscape HTML, at most 5 MB). The flow has five steps, and steps 2 to 5 must finish within 10 minutes of the reservation:
- Reserve an import job
- Get an upload URL
- Upload the file to that URL
- Claim the upload
- Start the import
Reserve an Import Job
POST /import/reserveScope: import
Body (all fields optional):
{
"targetCollectionId": "col_xyz",
"flattenDeep": true,
"skipDuplicates": true
}| Field | Type | Description |
|---|---|---|
targetCollectionId | string | Collection to import into. Must be yours and not in the trash |
flattenDeep | boolean | Folders nested more than five levels deep aren't created as collections; their bookmarks go into the nearest folder above them. With targetCollectionId, folders always nest under that collection and the levels that don't fit within five are flattened this way, whether or not flattenDeep is set |
skipDuplicates | boolean | Skip URLs already in your library. When false (the default), a second copy is saved |
Response:
{
"data": {
"jobId": "job_def456"
}
}Get an Upload URL
POST /import/upload-urlScope: import
Body: { "jobId": "job_def456" }
Response:
{
"data": {
"uploadUrl": "https://...",
"reservationId": "res_abc123"
}
}You may have up to 5 outstanding upload reservations (imports and cover images together). Over that, the request fails with 429 TOO_MANY_PENDING_UPLOADS and a Retry-After header.
Upload the File
POST the file to uploadUrl with Content-Type: text/html. This request goes to the storage service, not the API, and returns { "storageId": "..." }.
Claim the Upload
POST /import/claim-uploadScope: import
Body:
{
"jobId": "job_def456",
"reservationId": "res_abc123",
"storageId": "storage_xyz"
}Response: { "data": { "success": true } }
The file is checked here: over 5 MB fails with FILE_TOO_LARGE, and anything but text/html or application/xhtml+xml fails with INVALID_FILE_TYPE. Either way the uploaded file is deleted.
Start the Import
POST /import/startScope: import
Body:
{
"jobId": "job_def456",
"reservationId": "res_abc123"
}The server reads the file from the claimed reservation, so storageId isn't sent again.
Response: { "data": { "jobId": "job_def456", "status": "running" } }
The import processes bookmarks in batches. Use GET /jobs/:id to track progress.
Import Results
A completed import job carries result:
{
"data": {
"id": "job_def456",
"type": "import_html",
"status": "completed",
"progress": { "processed": 1200, "total": 1200 },
"createdAt": 1768473000000,
"result": {
"total": 1200,
"imported": 1150,
"duplicates": 40,
"skipped": 10,
"quotaLimited": true
}
}
}| Field | Description |
|---|---|
total | Bookmarks found in the file |
imported | Bookmarks saved, including ones restored from your trash because the same URL was there |
duplicates | URLs already in your library. With skipDuplicates, these weren't imported; without it, a second copy was saved and also counted in imported |
skipped | Bookmarks not saved for any other reason: an invalid URL, a URL being permanently deleted, or the plan's bookmark limit |
quotaLimited | Present (and true) only when the plan's bookmark limit was reached; the bookmarks after that point are counted in skipped |
Tag counts and page details catch up after an import completes: for a while, tag counts can read low, and imported bookmarks return metadataStatus: "pending" until their details are fetched.
Full Import Workflow
# 1. Reserve the import
curl -X POST https://api.bookmark.land/v1/import/reserve \
-H "Authorization: Bearer bkl_your_token" \
-H "Content-Type: application/json" \
-d '{"skipDuplicates": true}'
# 2. Get an upload URL
curl -X POST https://api.bookmark.land/v1/import/upload-url \
-H "Authorization: Bearer bkl_your_token" \
-H "Content-Type: application/json" \
-d '{"jobId": "job_def456"}'
# 3. Upload the file (to uploadUrl, not the API)
curl -X POST "$UPLOAD_URL" \
-H "Content-Type: text/html" \
--data-binary @bookmarks.html
# 4. Claim the upload
curl -X POST https://api.bookmark.land/v1/import/claim-upload \
-H "Authorization: Bearer bkl_your_token" \
-H "Content-Type: application/json" \
-d '{"jobId": "job_def456", "reservationId": "res_abc123", "storageId": "storage_xyz"}'
# 5. Start the import
curl -X POST https://api.bookmark.land/v1/import/start \
-H "Authorization: Bearer bkl_your_token" \
-H "Content-Type: application/json" \
-d '{"jobId": "job_def456", "reservationId": "res_abc123"}'
# 6. Poll status
curl https://api.bookmark.land/v1/jobs/job_def456 \
-H "Authorization: Bearer bkl_your_token"