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

# Update a source

> Updates a source. Most commonly used to mark a file source ready after upload by setting `file_upload_status` to `COMPLETE`. Only the fields you send are changed. Requires a token with write access.



## OpenAPI

````yaml /openapi-knowledge-base.json put /knowledge-base/sources/{source_id}
openapi: 3.0.3
info:
  title: AnyReach Knowledge Base API
  version: 1.0.0
  description: Manage knowledge bases, their sources, and run retrieval queries.
servers:
  - url: https://api.anyreach.ai
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Knowledge bases
    description: >-
      A knowledge base (a `dataset` in the API) is a collection of embedded
      content an agent can retrieve from.
  - name: Knowledge base sources
    description: Attach and detach sources to a knowledge base.
  - name: Sources
    description: >-
      A source is a file or URL whose content is ingested, chunked, and
      embedded.
paths:
  /knowledge-base/sources/{source_id}:
    put:
      tags:
        - Sources
      summary: Update a source
      description: >-
        Updates a source. Most commonly used to mark a file source ready after
        upload by setting `file_upload_status` to `COMPLETE`. Only the fields
        you send are changed. Requires a token with write access.
      operationId: updateSource
      parameters:
        - name: source_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: The source ID.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SourceUpdateRequest'
            example:
              file_upload_status: COMPLETE
      responses:
        '200':
          description: The updated source.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Source'
        '403':
          $ref: '#/components/responses/Forbidden'
components:
  schemas:
    SourceUpdateRequest:
      type: object
      description: Send only the fields you want to change.
      properties:
        file_upload_status:
          $ref: '#/components/schemas/UploadStatus'
        chunking_strategy:
          $ref: '#/components/schemas/ChunkingStrategy'
        file_size:
          type: integer
        description:
          type: string
    Source:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique source ID.
        organization_id:
          type: string
        type:
          $ref: '#/components/schemas/SourceType'
        name:
          type: string
          description: File name (FILE) or URL (URL).
        domain:
          type: string
          nullable: true
          description: Domain, for URL sources.
        file_upload_status:
          $ref: '#/components/schemas/UploadStatus'
        chunking_strategy:
          $ref: '#/components/schemas/ChunkingStrategy'
        file_size:
          type: integer
          nullable: true
          description: Size in bytes, for file sources.
        description:
          type: string
          nullable: true
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    UploadStatus:
      type: string
      enum:
        - PENDING
        - IN_PROGRESS
        - COMPLETE
        - FAILED
      description: Upload/ingestion status of the source's content.
    ChunkingStrategy:
      type: object
      description: How the source's content is split into chunks before embedding.
      properties:
        method:
          type: string
          enum:
            - fixed
            - structure_based
          description: >-
            fixed splits by size; structure_based splits along the document's
            structure.
        chunk_size:
          type: integer
          default: 1000
          description: Target chunk size (used by the fixed method).
      required:
        - method
    SourceType:
      type: string
      enum:
        - FILE
        - URL
      description: Whether the source is an uploaded file or a crawled URL.
    Error:
      type: object
      properties:
        detail:
          type: string
          example: Dataset not found
  responses:
    Forbidden:
      description: The token's role doesn't grant access to this action.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Personal access token. See Authentication.

````