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

# Upload an agent file

> Write a file into a personal CREAO agent's file space at a relative path.



## OpenAPI

````yaml /developer-api/developer-v1.openapi.yaml post /v1/agents/{agent_id}/files
openapi: 3.1.0
info:
  title: CREAO CLI
  version: 1.0.0
  description: |
    Create, update, and run personal CREAO agents from your backend through
    CREAO CLI with Account API keys. The `/v1` API uses stable `agent_id`,
    `conversation_id`, and `run_id` identifiers and is served from
    `developer.creao.ai`.
servers:
  - url: https://developer.creao.ai
    description: Production
security:
  - bearerAuth: []
  - apiKeyQuery: []
tags:
  - name: Agents
    description: >-
      Create, list, get, update, and edit personal agents for the authenticated
      account.
  - name: Agent Memory
    description: >-
      Read, overwrite, and clear long-term memory (playbooks) for a personal
      agent.
  - name: Agent Files
    description: List, download, and delete files in a personal agent's skill file space.
  - name: Product Profile
    description: Once-per-account Super Agent persona and brand context.
  - name: Agent Runs
    description: >-
      Create, stream, fetch, and list runs for created personal agents. Super
      Agent rows are excluded. `usage.models` is present only for Super
      Agent–allowlisted accounts.
  - name: Super Agent
    description: >-
      Chat with CREAO Super Agent from your backend. Same public NDJSON render
      protocol as Agent Runs. Requires an allowlisted account. `usage.models` is
      present only for Super Agent–allowlisted accounts.
  - name: Account
    description: Read the calling account's platform-wallet balance and CREAO CLI spend.
  - name: Workspaces
    description: Create and list personal workspaces, and add or remove personal agents.
  - name: Workspace Files
    description: Upload, list, download, and delete files in a personal workspace.
  - name: Secrets
    description: Add, update, and list account secret keys. Values are write-only.
  - name: Skills
    description: Install, list, and enable account-level Agent Brain skills.
  - name: Rooms
    description: >-
      Read team rooms, post messages as the key's owner, and stream room events.
      The key acts as its owner.
paths:
  /v1/agents/{agent_id}/files:
    post:
      tags:
        - Agent Files
      summary: Upload an agent file
      description: |
        Write one file into the agent's file space at a relative `path`, such
        as `references/style-guide.md` or `scripts/analyze.py`. Folders are
        kept, so the file is mounted in runs at that same path under the
        agent's folder and a `SKILL.md` that references the path finds it.
        Uploading to a path that already holds a file replaces it and returns
        `200`; a new file returns `201`. `path` defaults to the uploaded file
        name. `SKILL.md` and `config.yaml` at the root are part of the agent
        definition: update them with `skill_content` and `config_content` on
        Update an agent. Each file can be up to 20 MB and an agent holds at
        most 50 files. Uploads and deletes share an hourly budget of 300.
      operationId: uploadAgentFile
      parameters:
        - name: agent_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - file
              properties:
                file:
                  type: string
                  format: binary
                path:
                  type: string
                  maxLength: 512
                  description: |
                    Relative path inside the agent, using `/` between folders.
                    Defaults to the uploaded file name. Characters outside the
                    safe file-name set, such as spaces, become `_`; the
                    response `name` is the stored path. `..` segments are
                    refused.
                  example: references/style-guide.md
      responses:
        '200':
          description: The file at this path was replaced.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentFile'
        '201':
          description: File created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentFile'
        '400':
          description: Invalid multipart body, path, or file count.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                reservedPath:
                  value:
                    error: AGENT_FILE_PATH_RESERVED
                invalidPath:
                  value:
                    error: INVALID_AGENT_FILE_PATH
                fileLimit:
                  value:
                    error: AGENT_FILE_LIMIT_REACHED
        '401':
          $ref: '#/components/responses/AuthenticationRequired'
        '402':
          description: The account has used all of its plan's storage.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                storageQuota:
                  value:
                    error: TEAM_STORAGE_QUOTA_EXCEEDED
        '404':
          description: Agent not found for this account.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '413':
          $ref: '#/components/responses/FileTooLarge'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  schemas:
    AgentFile:
      type: object
      required:
        - id
        - name
        - mime_type
        - size_bytes
        - sha256
        - created_at
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        mime_type:
          type: string
        size_bytes:
          oneOf:
            - type: integer
            - type: 'null'
        sha256:
          oneOf:
            - type: string
            - type: 'null'
        created_at:
          type: string
          format: date-time
    ErrorResponse:
      type: object
      additionalProperties: true
      required:
        - error
      properties:
        error:
          type: string
          description: Stable machine-readable error code.
        message:
          type: string
          description: Debug message. Do not rely on this field in production clients.
        available:
          type: number
          description: Available credits, when returned for credit errors.
        required:
          type: number
          description: Required credits, when returned for credit errors.
        retryAfterSeconds:
          type: integer
          description: Retry delay, when returned for hourly cap errors.
        reason:
          type: string
          description: >-
            A readable explanation on `400` and `409` room errors. Do not branch
            on it.
        candidates:
          type: array
          description: >-
            Members a `ROOM_MENTION_AMBIGUOUS` name matches. Resend with one of
            their ids in `mentions` to pick it.
          items:
            type: object
            properties:
              member_id:
                type: string
                format: uuid
              kind:
                type: string
                enum:
                  - user
                  - agent
              name:
                oneOf:
                  - type: string
                  - type: 'null'
  responses:
    AuthenticationRequired:
      description: Missing, malformed, revoked, or unknown Account API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            missingKey:
              value:
                error: AUTHENTICATION_REQUIRED
    FileTooLarge:
      description: Uploaded file exceeds the account size limit.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            fileTooLarge:
              value:
                error: FILE_TOO_LARGE
    RateLimited:
      description: Account-level or IP-level rate limit exceeded.
      headers:
        Retry-After:
          description: Seconds to wait before retrying.
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            rateLimited:
              value:
                error: RATE_LIMITED
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: cr_sk
      description: Account API key from Developer Console. Keys start with `cr_sk_`.
      x-default: cr_sk_your_key_here
    apiKeyQuery:
      type: apiKey
      in: query
      name: creao-api-key
      description: |
        Account API key passed as a query parameter, for platforms that cannot
        set a custom Authorization header. The bearerAuth header takes
        precedence when both are present.
      x-default: cr_sk_your_key_here

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.