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

# Create entity with optional components



## OpenAPI

````yaml /openapi.json post /spawn
openapi: 3.1.0
info:
  title: Euca Engine API
  description: >-
    The typed HTTP API for the agent-native game engine. Local server runs
    unauthenticated on localhost:3917.
  license:
    name: ''
  version: 1.1.0
servers:
  - url: http://localhost:3917
security: []
tags:
  - name: World
    description: >-
      Inspect and mutate the live world: status, observe, entities,
      spawn/despawn, reset.
  - name: Simulation
    description: 'Drive the simulation clock: step, play, pause.'
  - name: Rules
    description: 'Rules-as-data: register and list gameplay rules.'
  - name: Gameplay
    description: >-
      Match lifecycle and gameplay actions: games, damage/heal, triggers,
      projectiles, AI, abilities.
  - name: Discovery and ops
    description: 'Operational introspection: world health diagnostics and GPU/engine info.'
  - name: Forks
    description: Counterfactual 'what-if' simulation on deep-cloned worlds.
  - name: Snapshots and probes
    description: Capture, list, and diff labeled world snapshots; probe = advance + assert.
  - name: Scenes and scenarios
    description: Persist scenes to disk and apply/export declarative scenario documents.
  - name: Inventory and economy
    description: >-
      Items, inventories, equipment, and the gold economy: define/give/equip
      items and list a unit inventory.
  - name: Status effects
    description: >-
      Timed buffs/debuffs with stat modifiers and tick effects: apply, list, and
      cleanse.
  - name: Templates and prefabs
    description: >-
      Reusable spawn definitions: named entity templates and registered prefabs
      — create, spawn, and list.
  - name: Assertions and manifest
    description: >-
      Testable expectations and sprint contracts: define/evaluate/list/delete
      assertions and set/read the game manifest.
  - name: Camera and render
    description: >-
      Control the render/editor viewport: camera pose and presets, screenshots,
      per-entity materials, post-processing, and volumetric fog.
  - name: UI and HUD
    description: >-
      Author the in-game HUD overlay: add text and bars, list, and clear
      elements.
  - name: Animation
    description: >-
      Skeletal animation: load clips, play/stop on entities, list the library,
      and attach state machines and montages.
  - name: Audio
    description: Play and stop global or spatial sound sources, and list the active ones.
  - name: Particles
    description: 'Particle emitters: create, stop, and list GPU/CPU emitter entities.'
  - name: Terrain and foliage
    description: Heightmap terrain create/edit and instanced foliage scatter/list.
  - name: Navigation
    description: >-
      Navmesh generation and A* pathfinding: build navmesh, compute paths, and
      set entity path goals.
  - name: Input
    description: >-
      Input bindings and context stack: bind/unbind keys to actions, list
      bindings, and push/pop input contexts.
  - name: Scripting
    description: 'Lua scripting: attach scripts to entities and list scripted entities.'
  - name: Assets
    description: >-
      AI-powered 3D asset generation: start jobs, poll status, and list tasks
      and providers.
  - name: Auth
    description: >-
      Optional session auth for hosted deployments; the local server is
      unauthenticated.
paths:
  /spawn:
    post:
      tags:
        - World
      summary: Create entity with optional components
      operationId: spawn
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SpawnRequest'
        required: true
      responses:
        '201':
          description: Entity spawned.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SpawnResponse'
              example:
                entity_generation: 0
                entity_id: 1
components:
  schemas:
    SpawnRequest:
      type: object
      properties:
        agent_id:
          type:
            - integer
            - 'null'
          format: int32
          minimum: 0
        ai_patrol:
          type:
            - array
            - 'null'
          items:
            type: array
            items:
              type: number
              format: float
          description: AI patrol waypoints as colon-separated "x,y,z:x,y,z"
        building_type:
          type:
            - string
            - 'null'
          description: >-
            Building type (e.g. "tier1_tower", "melee_barracks", "ancient").

            When set, attaches BuildingStats, BackdoorProtection, and
            TowerAggro.
        collider:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/ColliderData'
        color:
          type:
            - string
            - 'null'
        combat:
          type:
            - boolean
            - 'null'
        combat_cooldown:
          type:
            - number
            - 'null'
          format: float
        combat_damage:
          type:
            - number
            - 'null'
          format: float
        combat_range:
          type:
            - number
            - 'null'
          format: float
        combat_speed:
          type:
            - number
            - 'null'
          format: float
        combat_style:
          type:
            - string
            - 'null'
          description: '"melee" (default) or "stationary" (towers)'
        gold:
          type:
            - integer
            - 'null'
          format: int32
          description: Starting gold
        gold_bounty:
          type:
            - integer
            - 'null'
          format: int32
          description: Gold bounty awarded to killer
        health:
          type:
            - number
            - 'null'
          format: float
        lane:
          type:
            - string
            - 'null'
          description: 'Lane assignment for buildings: "top", "mid", or "bot".'
        mesh:
          type:
            - string
            - 'null'
        physics_body:
          type:
            - string
            - 'null'
        player:
          type:
            - boolean
            - 'null'
          description: Mark this entity as the player-controlled hero
        position:
          type:
            - array
            - 'null'
          items:
            type: number
            format: float
        role:
          type:
            - string
            - 'null'
          description: 'Entity role: hero, minion, tower, structure'
        scale:
          type:
            - array
            - 'null'
          items:
            type: number
            format: float
        spawn_point:
          type:
            - integer
            - 'null'
          format: int32
          description: Spawn point for team (marks this entity as a respawn location)
          minimum: 0
        team:
          type:
            - integer
            - 'null'
          format: int32
          minimum: 0
        velocity:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/VelocityData'
        xp_bounty:
          type:
            - integer
            - 'null'
          format: int32
          description: XP bounty awarded to killer
          minimum: 0
    SpawnResponse:
      type: object
      required:
        - entity_id
        - entity_generation
      properties:
        entity_generation:
          type: integer
          format: int32
          minimum: 0
        entity_id:
          type: integer
          format: int32
          minimum: 0
    ColliderData:
      oneOf:
        - type: object
          required:
            - hx
            - hy
            - hz
            - shape
          properties:
            hx:
              type: number
              format: float
            hy:
              type: number
              format: float
            hz:
              type: number
              format: float
            shape:
              type: string
              enum:
                - Aabb
        - type: object
          required:
            - radius
            - shape
          properties:
            radius:
              type: number
              format: float
            shape:
              type: string
              enum:
                - Sphere
        - type: object
          required:
            - radius
            - half_height
            - shape
          properties:
            half_height:
              type: number
              format: float
            radius:
              type: number
              format: float
            shape:
              type: string
              enum:
                - Capsule
        - type: object
          description: >-
            Convex hull, referenced by its registry handle (the geometry itself
            lives

            in the `ConvexHullRegistry`, not the API payload).
          required:
            - hull
            - shape
          properties:
            hull:
              type: integer
              format: int32
              minimum: 0
            shape:
              type: string
              enum:
                - Convex
        - type: object
          description: Static triangle mesh, referenced by its `TriMeshRegistry` handle.
          required:
            - mesh
            - shape
          properties:
            mesh:
              type: integer
              format: int32
              minimum: 0
            shape:
              type: string
              enum:
                - TriMesh
        - type: object
          description: >-
            Compound of convex parts (a convex decomposition), each referenced
            by its

            `ConvexHullRegistry` handle. The geometry lives in the registry, not
            here.
          required:
            - parts
            - shape
          properties:
            parts:
              type: array
              items:
                type: integer
                format: int32
                minimum: 0
            shape:
              type: string
              enum:
                - Compound
    VelocityData:
      type: object
      required:
        - linear
      properties:
        angular:
          type: array
          items:
            type: number
            format: float
        linear:
          type: array
          items:
            type: number
            format: float

````