Skip to Content
bookmark.land
Api reference

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/:format

Scope: export

Formats: json, csv, html

Response:

{
  "data": {
    "jobId": "job_abc123"
  }
}

Check Job Status

GET /jobs/:id

Scope: 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
  }
}
FieldTypeDescription
typestringexport_json, export_csv, export_html or import_html
statusstringSee the table below
progressobjectprocessed items so far, and total once it's known
createdAtnumberWhen the job was created (Unix milliseconds)

Job statuses:

StatusDescription
pendingJob created, waiting to start
runningProcessing in progress
completedDone. Exports add downloadReady and artifactExpiresAt; imports add result
failedJob failed. See error

Poll until the status is completed or failed. Polling every few seconds is fine.

A completed export adds:

FieldTypeDescription
downloadReadybooleantrue while the file can be downloaded
artifactExpiresAtnumberWhen 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.codeMeaning
JOB_CANCELEDThe job was canceled, for example because the account is being deleted
JOB_TIMED_OUTAn import was reserved but not started within its 10-minute window
JOB_FAILEDAnything else. error.message says what went wrong

Download the Export

POST /jobs/:id/download

Scope: 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 collection field in JSON and CSV is the full path joined with / (for example Design/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.json

Import

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:

  1. Reserve an import job
  2. Get an upload URL
  3. Upload the file to that URL
  4. Claim the upload
  5. Start the import

Reserve an Import Job

POST /import/reserve

Scope: import

Body (all fields optional):

{
  "targetCollectionId": "col_xyz",
  "flattenDeep": true,
  "skipDuplicates": true
}
FieldTypeDescription
targetCollectionIdstringCollection to import into. Must be yours and not in the trash
flattenDeepbooleanFolders 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
skipDuplicatesbooleanSkip 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-url

Scope: 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-upload

Scope: 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/start

Scope: 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
    }
  }
}
FieldDescription
totalBookmarks found in the file
importedBookmarks saved, including ones restored from your trash because the same URL was there
duplicatesURLs already in your library. With skipDuplicates, these weren't imported; without it, a second copy was saved and also counted in imported
skippedBookmarks not saved for any other reason: an invalid URL, a URL being permanently deleted, or the plan's bookmark limit
quotaLimitedPresent (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"

On this page