> ## Documentation Index
> Fetch the complete documentation index at: https://apidocs.neetokb.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Attachments

> Upload images and files to use inside articles.

An attachment is a file, such as an image, that you can use inside an article. For fields and response details, see the [API reference](/api/attachments/create).

## Upload an attachment

This command uploads a file from a public URL or from your computer. Use this when you want an image or document inside an article's HTML content. It needs the Modify articles permission.

```bash theme={"system"}
neetokb attachments create --file ./diagram.png
neetokb attachments create --url https://example.com/diagram.png
```

Give exactly one of `--url` or `--file`. With `--file`, the CLI sends the file as base64 and takes the file name and type from the path unless you pass `--filename` or `--content-type`.

| Flag | Type | Required | Default | Description |
| - | - | - | - | - |
| `--content-type` | `string` | | | MIME type (default: guessed from the --file extension) |
| `--file` | `string` | | | Path of a local file to upload |
| `--filename` | `string` | | | File name to store (default: the base name of --file) |
| `--url` | `string` | | | Public URL of the file to attach |

```json Sample output (--json) theme={"system"}
{
  "data": {
    "id": "c3d4e5f6-1111-2222-3333-444455556666",
    "filename": "diagram.png",
    "content_type": "image/png",
    "byte_size": 20480,
    "blob_url": "https://spinkart.neetokb.com/rails/active_storage/blobs/redirect/eyJfcmFpbHMi/diagram.png",
    "attachable_html": "<figure data-trix-attachment=\"...\"></figure>"
  },
  "breadcrumbs": [
    {
      "label": "Use in article",
      "command": "neetokb articles update <id> --html-content '...<attachable_html>...'"
    }
  ]
}
```

Paste `attachable_html` into the `--html-content` of [`articles create`](/cli-reference/articles#create-an-article) or [`articles update`](/cli-reference/articles#update-an-article). `attachable_html` is `null` for files that are not images. A file that is never used in an article is removed automatically.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.