> ## 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.

# Upload attachment

> Upload a file (such as an image, PDF, or document) and get back a link you can use inside an article, so you don't have to embed the full file directly in the article's content, which makes articles large and slow to load. For images, the response also includes `attachable_html`: the image already formatted as ready-to-paste code that you can add straight into the article's `html_content`. Any file you upload but never use in an article is removed automatically.


<Info>Replace `{your-subdomain}` with your workspace's subdomain. <br /> Learn how to find your subdomain in [Workspace subdomain](/getting-started/workspace-subdomain).</Info>


## OpenAPI

````yaml bundled/attachments.yaml POST /attachments
openapi: 3.0.3
info:
  title: NeetoKB Attachments API
  version: 1.0.0
servers:
  - description: NeetoKB API
    url: https://{your-subdomain}.neetokb.com/api/external/v2
    variables:
      your-subdomain:
        default: spinkart
        description: >-
          Replace **spinkart** with your [workspace's
          subdomain](/getting-started/workspace-subdomain).
security: []
paths:
  /attachments:
    post:
      summary: Upload attachment
      description: >
        Upload a file (such as an image, PDF, or document) and get back a link
        you can use inside an article, so you don't have to embed the full file
        directly in the article's content, which makes articles large and slow
        to load. For images, the response also includes `attachable_html`: the
        image already formatted as ready-to-paste code that you can add straight
        into the article's `html_content`. Any file you upload but never use in
        an article is removed automatically.
      parameters:
        - $ref: '#/components/parameters/api_key_header'
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - file
              properties:
                file:
                  type: string
                  format: binary
                  description: >-
                    The file to upload (for example an image, PDF, or document).
                    Maximum size 50 MB.
      responses:
        '201':
          description: Created - File uploaded successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/attachment'
        '401':
          description: Unauthorized - API key is missing or invalid
        '422':
          description: Unprocessable Entity - File is missing or exceeds the size limit
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: File size exceeds the maximum limit of 50 MB.
components:
  parameters:
    api_key_header:
      in: header
      name: X-Api-Key
      description: >-
        Use the X-Api-Key header to provide your workspace API key. Refer to
        [Authentication](/getting-started/authentication) for more information.
      required: true
      schema:
        type: string
        default: your-api-key
  schemas:
    attachment:
      type: object
      properties:
        id:
          type: string
          format: uuid
        key:
          type: string
          example: abcd1234efgh5678ijkl
        filename:
          type: string
          example: logo.png
        content_type:
          type: string
          example: image/png
        byte_size:
          type: integer
          example: 20480
        checksum:
          type: string
          example: Y2hlY2tzdW0xMjM0NQ==
        created_at:
          $ref: '#/components/schemas/date_time_field'
        service_name:
          type: string
          example: amazon
        signed_id:
          type: string
          description: >
            Signed identifier of the uploaded file. You do not pass it directly
            to the article API; it is embedded as `data-blob-id` inside
            `attachable_html`. To use the file in an article, insert
            `attachable_html` (or a `blob_url` `<img>` tag) into the article's
            `html_content`.
        blob_url:
          type: string
          description: >
            Hosted URL of the uploaded file. Use it as the `src` of an `<img>`
            tag in the article HTML. This URL is stable and does not expire; it
            stays valid as long as the file is used in an article.
          example: >-
            https://spinkart.neetokb.com/rails/active_storage/blobs/redirect/eyJfcmFpbHMi/logo.png
        attachable_html:
          type: string
          nullable: true
          description: >
            Editor-ready image markup for images; `null` for non-image files.
            Insert it directly into the article's `html_content`.
    date_time_field:
      type: string
      format: date-time

````