# bookmarks.import

`POST /api/public/v1/bookmarks/imports`

Read a browser bookmark export (Netscape bookmark HTML from Chrome, Edge, Firefox …, at most 10 MB) and store its http(s) links as an import (at most 5000). javascript:, data:, file: and other schemes, and addresses with a user name or password, are rejected with a reason; the same file twice is one import.

- Capability: `bookmark.import`
- Command: yes — send a `command_id`; resending the same id and body returns the stored receipt
- MCP tool: `bookmarks_import`

## Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `command_id` | body | string (uuid) | yes | Client-generated UUID for this command. Send the same id (and body) again to get the stored receipt instead of a second change; a different body under the same id is CONFLICT. |
| `name` | body | string | yes | Shown in the library, e.g. "Team links October" (min length 1, max length 120) |
| `html` | body | string | yes | The whole bookmark export file as text (bookmarks.html) (min length 1, max length 10485760) |
| `file_name` | body | string | no | The original file name, for people reading the library (max length 200) |

## Response

`201` with `{ data, replayed: false, correlation_id }` the first time; `200` with `replayed: true` for a repeated `command_id`.

| Field | Type | Always present | Description |
|---|---|---|---|
| `data` | object | yes |  |
| `data.set` | object | yes |  |
| `data.set.id` | string (uuid) | yes |  |
| `data.set.name` | string | yes |  |
| `data.set.source_name` | string | no |  |
| `data.set.links` | integer | yes | (min -9007199254740991, max 9007199254740991) |
| `data.set.folders` | integer | yes | (min -9007199254740991, max 9007199254740991) |
| `data.set.rejected_count` | integer | yes | (min -9007199254740991, max 9007199254740991) |
| `data.set.rejected` | array<object> | no | Up to 50 examples (title and scheme only) |
| `data.set.rejected[].reason` | "unsafe_scheme" \| "invalid_url" \| "credentials" \| "too_long" \| "too_deep" \| "over_limit" | yes |  |
| `data.set.rejected[].title` | string | yes |  |
| `data.set.rejected[].scheme` | string | yes |  |
| `data.set.duplicates_in_file` | integer | yes | (min -9007199254740991, max 9007199254740991) |
| `data.set.sha256` | string | yes |  |
| `data.set.created_at` | string | yes |  |
| `data.set.pending` | integer | yes | Profiles that still wait for (or are applying) this import (min -9007199254740991, max 9007199254740991) |
| `data.set.applied` | integer | yes | (min -9007199254740991, max 9007199254740991) |
| `data.created` | boolean | yes | false: this exact list was already imported |
| `correlation_id` | string (uuid) | yes |  |
| `replayed` | boolean | no | true when this command_id was already applied and the stored receipt came back |

New fields can appear at any time; ignore the ones you do not know.

## Errors

| Code | HTTP | Retryable |
|---|---|---|
| `UNAUTHENTICATED` | 401 | no |
| `FORBIDDEN` | 403 | no |
| `RATE_LIMITED` | 429 | yes |
| `VALIDATION_FAILED` | 422 | no |
| `CONFLICT` | 409 | no |
| `OUTCOME_UNKNOWN` | 202 | yes |
| `DEPENDENCY_UNAVAILABLE` | 503 | yes |
| `UNKNOWN` | 500 | no |

## Example (curl)

```bash
curl -X POST "https://browlix.com/api/public/v1/bookmarks/imports" \
  -H "Authorization: Bearer $BROWLIX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"command_id":"<uuid>","name":"<name>","html":"<html>"}'
```

## Example (TypeScript SDK)

```ts
import { Browlix } from "@browlix/sdk";

const bx = new Browlix({ apiKey: process.env.BROWLIX_API_KEY! });
const reply = await bx.call("bookmarks.import", { body: {"name":"<name>","html":"<html>"} });
console.log(reply.data);
```

## Example (Python)

```python
import os, uuid
import requests

r = requests.post(
    "https://browlix.com/api/public/v1/bookmarks/imports",
    headers={"Authorization": f"Bearer {os.environ['BROWLIX_API_KEY']}"},
    json={"command_id":str(uuid.uuid4()),"name":"<name>","html":"<html>"},
    timeout=60,
)
print(r.status_code, r.json())
```

## Example (MCP)

```json
{
  "method": "tools/call",
  "params": {
    "name": "bookmarks_import",
    "arguments": {
      "name": "<name>",
      "html": "<html>"
    }
  }
}
```
