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

# Add Course Sources

> Attach more source URLs/files to a course DURING intake, then rebuild its
document digest.

The course must be `awaiting_brief` (409 `course_not_awaiting_brief` otherwise:
after launch the sources are frozen because scene generation may already be
reading them). URLs are stored as-is (create parity); files are validated by the
same validator create uses and uploaded to R2. The new refs are merged into the
course under its row lock (concurrent add-files are serialized). If the merged
source set differs from the current one, a metered digest rebuild is enqueued.

Bounds: at most `SOURCE_ADD_MAX_REBUILDS` metered builds per course (409
`source_rebuild_cap_reached` beyond it) and a per-client burst limiter (429). The
response carries the updated source lists and the digest status
(`pending` while a rebuild runs, `ready`, or `failed`).



## OpenAPI

````yaml /openapi.yaml post /api/v1/courses/{course_id}/sources
openapi: 3.1.0
info:
  title: Mahara Platform
  description: >
    AI Sales Training Course Generator, a Coursera-style platform.


    ## Authentication


    Every request must carry your API key as a Bearer token:


    `Authorization: Bearer sk_live_your_key_here`


    ## Getting an API key


    API keys are provisioned by our team. They are not self-service, so there is
    no signup page to apply on. To request access, email **sales@myustadia.com**
    and we will issue a key for your account.
  version: 1.0.0
servers: []
security: []
paths:
  /api/v1/courses/{course_id}/sources:
    post:
      tags:
        - B2B Courses v2
      summary: Add Course Sources
      description: >-
        Attach more source URLs/files to a course DURING intake, then rebuild
        its

        document digest.


        The course must be `awaiting_brief` (409 `course_not_awaiting_brief`
        otherwise:

        after launch the sources are frozen because scene generation may already
        be

        reading them). URLs are stored as-is (create parity); files are
        validated by the

        same validator create uses and uploaded to R2. The new refs are merged
        into the

        course under its row lock (concurrent add-files are serialized). If the
        merged

        source set differs from the current one, a metered digest rebuild is
        enqueued.


        Bounds: at most `SOURCE_ADD_MAX_REBUILDS` metered builds per course (409

        `source_rebuild_cap_reached` beyond it) and a per-client burst limiter
        (429). The

        response carries the updated source lists and the digest status

        (`pending` while a rebuild runs, `ready`, or `failed`).
      operationId: add_course_sources_api_v1_courses__course_id__sources_post
      parameters:
        - name: course_id
          in: path
          required: true
          schema:
            type: string
            title: Course Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddSourcesRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    AddSourcesRequest:
      properties:
        source_urls:
          items:
            type: string
          type: array
          title: Source Urls
          description: >-
            Additional source URLs to attach to the course. Stored as-is (create
            parity: URLs are not pre-validated; the SSRF guard is inside the
            scrape path).
        source_files:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Source Files
          description: >-
            Additional source files as {name|filename, base64, content_type}.
            Validated by the SAME validator create uses (type/size/page caps)
            and uploaded to R2.
      type: object
      title: AddSourcesRequest
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````