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

# Register a new agent from a source zip and queue an asynchronous

> Register a new agent from a source zip and queue an asynchronous
build-and-deploy job (poll via `/uploads/{upload_id}` or
`/deploys/{build_id}/stream`). Deployer role required.



## OpenAPI

````yaml /api-reference/openapi.json post /api/agents/upload
openapi: 3.1.0
info:
  title: Nasiko API
  description: >-
    HTTP API for the Nasiko OpenRuntime: agents, coding harnesses, TokenOps,
    routing, MCP, and secrets. Spec is generated from annotated routes; some
    surfaces are documented on the hand-written pages alongside this file.
  license:
    name: ''
  version: 0.1.0
servers: []
security: []
tags:
  - name: secrets
    description: Encrypted per-user agent secrets
  - name: catalog
    description: >-
      Agent catalog: registration, discovery, versions, per-agent secrets, and
      source import
  - name: agents
    description: >-
      Agent lifecycle: deployments, LLM routing config, update/rollback,
      upload-and-deploy
  - name: orchestrator
    description: >-
      A2A dispatch: routing-engine/ReAct orchestrator and direct agent chat,
      plus routing stats
  - name: users
    description: >-
      User management: CRUD, roles, credentials, accessible agents
      (superuser-only)
  - name: usage
    description: Per-user token usage and cost reporting
  - name: observability
    description: Sessions, traces, spans, agent logs, and FinOps reporting
  - name: llm-router
    description: LLM routing presets, provider/model catalog, and tier→model registry
  - name: mcp
    description: >-
      MCP gateway: agent-facing JSON-RPC tool calls, connector
      registration/upload/sharing, credentials & OAuth, and per-agent tool
      permissions
paths:
  /api/agents/upload:
    post:
      tags:
        - agents
      summary: Register a new agent from a source zip and queue an asynchronous
      description: |-
        Register a new agent from a source zip and queue an asynchronous
        build-and-deploy job (poll via `/uploads/{upload_id}` or
        `/deploys/{build_id}/stream`). Deployer role required.
      operationId: upload_and_deploy
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/UploadAndDeployForm'
        required: true
      responses:
        '202':
          description: Build queued
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UploadAndDeployResponse'
        '400':
          description: Missing/invalid name, version_tag, or source zip
        '413':
          description: Upload exceeds 100 MiB limit
components:
  schemas:
    UploadAndDeployForm:
      type: object
      description: >-
        Multipart form for `POST /agents/upload` — a `.zip` `source`/`file`
        field

        (an `AgentCard.json` + `Dockerfile` package) plus agent metadata fields.
      required:
        - source
        - name
      properties:
        env:
          type:
            - string
            - 'null'
          description: JSON object of extra env vars, e.g. `{"FOO":"bar"}`.
        inbound_format:
          type:
            - string
            - 'null'
          description: >-
            `openai` (default) | `anthropic` | `gemini` — which SDK the agent's
            code speaks.
        name:
          type: string
        ports:
          type:
            - string
            - 'null'
          description: Comma-separated container ports (defaults to `8000`).
        source:
          type: string
          format: binary
        version_tag:
          type:
            - string
            - 'null'
        writable:
          type:
            - string
            - 'null'
          description: >-
            `"true"`/`"false"` to mount / not mount a persistent,
            private-per-agent

            directory at `/workspace`. Tri-state: omit the field to keep an
            existing

            agent's stored setting (false for a new agent) — the CLI only sends
            it

            when `--writable` was passed.
        writable_path:
          type:
            - string
            - 'null'
          description: >-
            Container-side mount target for the writable volume
            (`--writable-path`).

            Absolute path; implies `writable`. Omit to keep an existing agent's

            stored path (`/workspace` for a new agent).
    UploadAndDeployResponse:
      type: object
      required:
        - data
        - status_code
        - message
      properties:
        data:
          $ref: '#/components/schemas/UploadQueuedData'
        message:
          type: string
        status_code:
          type: integer
          format: int32
          minimum: 0
    UploadQueuedData:
      type: object
      required:
        - success
        - agent_name
        - agent_id
        - build_id
        - status
        - capabilities_generated
        - orchestration_triggered
        - validation_errors
      properties:
        agent_id:
          type: string
        agent_name:
          type: string
        build_id:
          type: string
        capabilities_generated:
          type: boolean
        orchestration_triggered:
          type: boolean
        status:
          type: string
        success:
          type: boolean
        validation_errors:
          type: array
          items:
            type: string

````