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

# Attach a document to one of the hub's notes

> Attaches a document to one of the hub's notes; note ids come from `notes[].id` in the hub detail. Send the file as padded base64 in `fileBase64`, up to 10,485,760 characters (about 7.5 MB of file data); allowed types are PDF, plain text, CSV, Word (.doc and .docx) and RTF. The file is stored for download only — it is not parsed into the hub's knowledge, so put the text you want the hub to learn in the note's own `text`. A note holds one attachment: a second upload answers 409 `ATTACHMENT_ALREADY_EXISTS`, and there is no replace endpoint. The response does not include a download URL; fetch one with `GET /business/knowledge-hubs/{hubId}/attachments/{noteId}`. Only the hub's owner can upload, and not while the hub is `processing`.

Errors:
- `404` `KNOWLEDGE_HUB_NOT_FOUND` — No hub with that id, it was deleted, or it belongs to another team.
- `404` `NOTE_NOT_FOUND` — No note with that id on this hub.
- `409` `ATTACHMENT_ALREADY_EXISTS` — The note already holds a document; delete the note's attachment first.
- `409` `KNOWLEDGE_HUB_NOT_READY` — The hub is processing a build, update or refresh.
- `403` `KNOWLEDGE_HUB_OWNER_ONLY` — You can read this teammate's hub but only its owner can upload attachments.
- `422` `VALIDATION_FAILED` — Malformed base64, a file over the size cap, an unsupported contentType, or a missing field.
- `500` `UNEXPECTED_ERROR` — The file could not be stored; retry.
- `429` `RATE_LIMITED` — More than 30 knowledge-hub/campaign requests in a minute (or 1000 in a day). Knowledge hubs share the campaigns bucket.

Requires one of the following token scopes: campaigns.



## OpenAPI

````yaml /openapi.json post /business/knowledge-hubs/{hubId}/attachments
openapi: 3.1.0
info:
  title: Fuse Business API
  version: 1.0.0
  description: >-
    External API for lists, campaigns, prospect search and contacts.
    Authenticate with your API token as HTTP Basic. All paths are under /api/v1.
servers:
  - url: https://api.tryfuse.ai/api/v1
    description: Production
security:
  - basicAuth: []
tags:
  - name: Lists
  - name: Custom columns
  - name: Smart columns
  - name: Exports
  - name: Campaigns
  - name: Knowledge hubs
  - name: Analytics
  - name: Website intent
  - name: Account
  - name: Prospect search
  - name: Campaign steps
  - name: Scheduled sends
  - name: Campaign templates
  - name: Agents
  - name: Research
  - name: Company search
  - name: Saved searches
  - name: Folders
  - name: Contacts
paths:
  /business/knowledge-hubs/{hubId}/attachments:
    post:
      tags:
        - Knowledge hubs
      summary: Attach a document to one of the hub's notes
      description: >-
        Attaches a document to one of the hub's notes; note ids come from
        `notes[].id` in the hub detail. Send the file as padded base64 in
        `fileBase64`, up to 10,485,760 characters (about 7.5 MB of file data);
        allowed types are PDF, plain text, CSV, Word (.doc and .docx) and RTF.
        The file is stored for download only — it is not parsed into the hub's
        knowledge, so put the text you want the hub to learn in the note's own
        `text`. A note holds one attachment: a second upload answers 409
        `ATTACHMENT_ALREADY_EXISTS`, and there is no replace endpoint. The
        response does not include a download URL; fetch one with `GET
        /business/knowledge-hubs/{hubId}/attachments/{noteId}`. Only the hub's
        owner can upload, and not while the hub is `processing`.


        Errors:

        - `404` `KNOWLEDGE_HUB_NOT_FOUND` — No hub with that id, it was deleted,
        or it belongs to another team.

        - `404` `NOTE_NOT_FOUND` — No note with that id on this hub.

        - `409` `ATTACHMENT_ALREADY_EXISTS` — The note already holds a document;
        delete the note's attachment first.

        - `409` `KNOWLEDGE_HUB_NOT_READY` — The hub is processing a build,
        update or refresh.

        - `403` `KNOWLEDGE_HUB_OWNER_ONLY` — You can read this teammate's hub
        but only its owner can upload attachments.

        - `422` `VALIDATION_FAILED` — Malformed base64, a file over the size
        cap, an unsupported contentType, or a missing field.

        - `500` `UNEXPECTED_ERROR` — The file could not be stored; retry.

        - `429` `RATE_LIMITED` — More than 30 knowledge-hub/campaign requests in
        a minute (or 1000 in a day). Knowledge hubs share the campaigns bucket.


        Requires one of the following token scopes: campaigns.
      operationId: uploadKnowledgeHubAttachment
      parameters:
        - name: hubId
          in: path
          required: true
          description: >-
            24-character hex id of the knowledge hub (from GET
            /business/knowledge-hubs).
          schema:
            type: string
            description: >-
              24-character hex id of the knowledge hub (from GET
              /business/knowledge-hubs).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                noteId:
                  type: string
                  description: >-
                    24-character hex id of the note to attach the document to; a
                    note holds at most one attachment.
                fileBase64:
                  type: string
                  maxLength: 10485760
                  description: >-
                    Accepted values: standard base64 with padding — alphabet A-Z
                    a-z 0-9 + / and a length that is a multiple of 4. A URL-safe
                    (-_) string, an unpadded one, or one that still carries a
                    data:...;base64, prefix answers 422 VALIDATION_FAILED. The
                    whole JSON request body is capped at 10 MB, which puts the
                    real ceiling at roughly 7.5 MB of file data (base64 is a
                    third larger than the file it encodes). The bytes are stored
                    and handed back by the download endpoint unchanged: nothing
                    reads, extracts or indexes them, so an attachment on its own
                    adds no knowledge to the hub — only the note's text does.
                filename:
                  type: string
                  minLength: 1
                  maxLength: 255
                  description: >-
                    File name stored with the attachment and returned by the
                    download endpoint (1-255 characters). Free text: it is
                    stored verbatim, never parsed, and never checked against
                    contentType or against the note's own filename label — an
                    extension that contradicts contentType is accepted and
                    changes nothing. Give it the real extension anyway, since it
                    is the name whoever opens the download sees.
                contentType:
                  type: string
                  enum:
                    - application/pdf
                    - text/plain
                    - text/csv
                    - application/msword
                    - >-
                      application/vnd.openxmlformats-officedocument.wordprocessingml.document
                    - application/rtf
                  description: >-
                    MIME type of the file: PDF, plain text, CSV, Word (.doc or
                    .docx) or RTF.
              required:
                - noteId
                - fileBase64
                - filename
                - contentType
      responses:
        '201':
          description: Success
          headers:
            RateLimit-Limit:
              schema:
                type: integer
              description: Requests permitted in the current window.
            RateLimit-Remaining:
              schema:
                type: integer
              description: Requests remaining in the current window.
            RateLimit-Reset:
              schema:
                type: integer
              description: Seconds until the current window resets.
          content:
            application/json:
              schema:
                type: object
                required:
                  - attachment
                properties:
                  attachment:
                    type: object
                    required:
                      - noteId
                      - filename
                      - contentType
                      - byteSize
                    properties:
                      noteId:
                        type: string
                        description: The note the document is attached to.
                      filename:
                        type:
                          - string
                          - 'null'
                        description: The file name as stored.
                      contentType:
                        type:
                          - string
                          - 'null'
                        enum:
                          - application/pdf
                          - text/plain
                          - text/csv
                          - application/msword
                          - >-
                            application/vnd.openxmlformats-officedocument.wordprocessingml.document
                          - application/rtf
                          - null
                      byteSize:
                        type:
                          - integer
                          - 'null'
                        description: Size of the stored file in bytes.
              example:
                attachment:
                  noteId: 68a1f8509c41d20014b3ee55
                  filename: positioning.pdf
                  contentType: application/pdf
                  byteSize: 284913
        '400':
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '402':
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - basicAuth: []
components:
  schemas:
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
            param:
              type:
                - string
                - 'null'
            doc_url:
              type:
                - string
                - 'null'
            request_id:
              type:
                - string
                - 'null'
          required:
            - code
            - message
      required:
        - error
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: >-
        Your API token (`af_…`) as the Basic-auth username, with an empty
        password.

````