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

# Upload a bundled file

> Create a file record and get a presigned URL for direct upload to cloud storage.

**Two-step upload process:**
1. Call this endpoint to register the file and get a presigned URL
2. PUT the file content directly to the returned `uploadUrl`

**Limits:**
- Maximum 20 files per skill
- File names are sanitized to prevent path traversal
- Duplicate file names within a skill are rejected




## OpenAPI

````yaml /openapi.yaml post /skills/files
openapi: 3.1.0
info:
  title: AsterAgents API
  version: 1.0.0
  description: >
    API for AsterAgents platform operations.


    - **Admin endpoints** (`/admin/*`) require organization admin privileges
    (`org:admin` role)

    - **Agent endpoints** (`/agents`) require agent management permissions or
    `org:admin` role

    - **Knowledge base endpoints** (`/kb/*`) require standard authentication

    - **Skills endpoints** (`/skills/*`) require standard authentication

    - **File endpoints** (`/upload/*`, `/kb/files`, `/skills/files`) require
    standard authentication
  contact:
    name: AsterAgents Support
    url: https://asteragents.com/support
servers:
  - url: https://asteragents.com/api
    description: Production
  - url: http://localhost:3000/api
    description: Local development
security:
  - bearerAuth: []
tags:
  - name: Users
    description: Manage active organization users
  - name: Invitations
    description: Manage organization invitations
  - name: Files
    description: Upload and manage files
  - name: Knowledge Bases
    description: Manage knowledge bases and their files
  - name: Knowledge Base Management
    description: Create, update, and delete knowledge bases
  - name: Agents
    description: Create, update, and delete agents
  - name: Agent Tags
    description: Organize agents with tags
  - name: Tools
    description: Discover the tool catalog available to your organization
  - name: Skills
    description: Manage agent skills
  - name: Skill Files
    description: Manage bundled files for skills
  - name: Conversations
    description: Invoke agents and retrieve conversation history and messages
  - name: Scheduled Tasks
    description: Schedule agents to run automatically on a cron schedule
paths:
  /skills/files:
    post:
      tags:
        - Skill Files
      summary: Upload a bundled file
      description: >
        Create a file record and get a presigned URL for direct upload to cloud
        storage.


        **Two-step upload process:**

        1. Call this endpoint to register the file and get a presigned URL

        2. PUT the file content directly to the returned `uploadUrl`


        **Limits:**

        - Maximum 20 files per skill

        - File names are sanitized to prevent path traversal

        - Duplicate file names within a skill are rejected
      operationId: createSkillFile
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - skillId
                - fileName
                - contentType
              properties:
                skillId:
                  type: integer
                  description: The skill to attach the file to
                fileName:
                  type: string
                  description: >-
                    File name, may include subdirectory (e.g.,
                    `scripts/setup.py`)
                  example: scripts/generate_report.py
                contentType:
                  type: string
                  description: MIME type of the file
                  example: text/x-python
                fileSize:
                  type: integer
                  nullable: true
                  description: File size in bytes (optional)
      responses:
        '201':
          description: File record created with presigned upload URL
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  file:
                    type: object
                    properties:
                      id:
                        type: integer
                      fileId:
                        type: string
                        format: uuid
                      fileName:
                        type: string
                      contentType:
                        type: string
                  uploadUrl:
                    type: string
                    format: uri
                    description: >-
                      Presigned URL for direct file upload (PUT). Expires in 10
                      minutes.
              examples:
                success:
                  value:
                    success: true
                    file:
                      id: 5
                      fileId: a1b2c3d4-e5f6-7890-abcd-ef1234567890
                      fileName: scripts/generate_report.py
                      contentType: text/x-python
                    uploadUrl: https://example.r2.cloudflarestorage.com/...
        '400':
          description: Missing fields, duplicate file name, or file count limit reached
        '404':
          description: Skill not found
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  responses:
    InternalServerError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Internal Server Error
  schemas:
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          example: Bad Request
        details:
          type: array
          items:
            type: object
            additionalProperties: true
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: |
        JWT token from Clerk authentication.

        Must be from a user with `org:admin` role.

````