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

# Request KB Source Upload URL

> Creates a KB source record and returns a presigned S3 PUT URL for file upload. After uploading the file, call confirm-upload to validate and trigger indexing. Supported file types: PDF, Markdown, HTML, plain text. Maximum file size: 100 MB.



## OpenAPI

````yaml post /knowledge-base/sources/upload
openapi: 3.0.1
info:
  title: Attention Service V2
  description: Attention Service API V2
  termsOfService: https://www.attention.com/terms-of-use
  contact:
    name: Attention Team
    url: https://docs.attention.com/welcome
    email: support@attention.com
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
  version: 1.8.0
servers:
  - url: https://api.attention.tech/v2
security:
  - APIKeyHeader: []
paths:
  /knowledge-base/sources/upload:
    post:
      tags:
        - Knowledge Base
      summary: Request KB Source Upload URL
      description: >-
        Creates a KB source record and returns a presigned S3 PUT URL for file
        upload. After uploading the file, call confirm-upload to validate and
        trigger indexing. Supported file types: PDF, Markdown, HTML, plain text.
        Maximum file size: 100 MB.
      operationId: requestKBSourceUpload
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RequestKBSourceUploadRequest'
          application/vnd.api+json:
            schema:
              $ref: '#/components/schemas/RequestKBSourceUploadRequest'
        required: true
      responses:
        '201':
          description: Upload URL generated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RequestKBSourceUploadResponse'
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/RequestKBSourceUploadResponse'
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Valid API key required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/Error'
        default:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    RequestKBSourceUploadRequest:
      type: object
      properties:
        title:
          maxLength: 500
          type: string
          description: >-
            Title of the KB source. Optional — if omitted, the server attempts
            to extract the title from PDF metadata, falling back to 'Untitled
            upload'.
      example:
        title: Competitive Analysis 2025.pdf
    RequestKBSourceUploadResponse:
      type: object
      properties:
        source_id:
          type: string
          description: UUID of the created KB source
        upload_url:
          type: string
          description: Presigned S3 PUT URL for uploading the file
      example:
        source_id: f7e8d9c0-b1a2-3456-7890-abcdef123456
        upload_url: >-
          https://s3.amazonaws.com/bucket/kb-sources/org-uuid/source-uuid?X-Amz-Algorithm=AWS4-HMAC-SHA256&...
    Error:
      type: object
      properties:
        id:
          type: string
          description: A unique identifier for the error.
        status:
          type: string
          description: >-
            The HTTP status code applicable to this problem, expressed as a
            string value.
        code:
          type: string
          description: An application-specific error code, expressed as a string value.
        title:
          type: string
          description: A short, human-readable summary of the problem.
        detail:
          type: string
          description: >-
            A human-readable explanation specific to this occurrence of the
            problem.
        source:
          type: object
          properties:
            pointer:
              type: string
            parameter:
              type: string
        meta:
          type: object
          properties: {}
      example:
        id: not_found_error
        status: '404'
        code: '404'
        title: Not Found Error
        detail: The requested resource was not found
        source:
          pointer: /data/attributes/id
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      name: Authorization
      in: header

````