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

# Create a machine config

> Save a machine config. Its fields are checked against the type's; secret fields are sealed, and a string field may point at a saved store's secret instead. A name already saved is a 409.

> [accordion] Errors
>
> | Status | Meaning |
> | - | - |
> | `400` | Bad request: malformed, a host not allowed, or a browser page from another origin |
> | `401` | The token is missing or wrong |
> | `409` | The id or name is taken, the workspace is busy, or a file changed since it was read |
> | `429` | Past a rate limit, or a new session past max\_sessions |
> | `501` | The server requires accounts; saved configs are kept only on a server of one account |
>
> See [error examples and recovery steps](https://docs.mirage.strukto.ai/api/errors.md). The [complete OpenAPI contract](https://github.com/strukto-ai/mirage/blob/main/docs/openapi.yaml) includes every response schema.


## OpenAPI

````yaml /openapi.yaml post /v1/machines
openapi: 3.2.0
info:
  title: Mirage API
  version: '0.1'
servers:
  - url: http://127.0.0.1:8765
    description: A local server on its default port
security:
  - bearerAuth: []
tags:
  - name: Workspace operations
    x-group: Workspaces
  - name: Workspaces
    x-group: Lifecycle
    parent: Workspace operations
  - name: Sessions
  - name: Shell
    parent: Workspace operations
  - name: VFS
    parent: Workspace operations
  - name: Tools
  - name: Documents
    parent: Workspace operations
  - name: Snapshots
  - name: Templates
  - name: Saved VFS
    x-group: VFS
    parent: Saved configurations
  - name: Saved CLIs
    x-group: CLIs
    parent: Saved configurations
  - name: Saved runtimes
    x-group: Runtimes
    parent: Saved configurations
  - name: Saved machines
    x-group: Machines
    parent: Saved configurations
  - name: Saved configurations
  - name: Policies
  - name: Asks
    parent: Workspace operations
  - name: Lines
    parent: Workspace operations
  - name: Jobs
    parent: Workspace operations
  - name: Processes
    parent: Workspace operations
  - name: Machines
    parent: Workspace operations
  - name: Service
  - name: Daemon
  - name: Auth
paths:
  /v1/machines:
    post:
      tags:
        - Saved machines
      summary: Create a machine config
      description: >-
        Save a machine config. Its fields are checked against the type's; secret
        fields are sealed, and a string field may point at a saved store's
        secret instead. A name already saved is a 409.
      operationId: create_entry_v1_machines_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSavedEntryRequest'
            example:
              name: tools
              type: docker
              fields:
                container: mirage-tools
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SavedEntry'
components:
  schemas:
    CreateSavedEntryRequest:
      type: object
      properties:
        name:
          type: string
          description: >-
            1 to 63 of a-z 0-9 . _ -, starting with a letter or digit. Not
            `types`, and not shaped like an id.
        type:
          type: string
          description: >-
            One of the types its kind's `/types` route lists, such as `GET
            /v1/vfs/types`.
        fields:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/FieldValue'
          description: >-
            The type's config. Secret fields are sealed; a string field may
            point at a saved store instead.
      required:
        - name
        - type
        - fields
    SavedEntry:
      type: object
      properties:
        id:
          type: string
          description: The entry's id; the daemon uses its name.
        name:
          type: string
        kind:
          type: string
          enum:
            - vfs
            - cli
            - runtime
        type:
          type: string
          description: The VFS, CLI or runtime type, such as s3.
        builtin:
          type: boolean
        config:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/FieldValue'
          description: The plain fields. Sealed fields are never answered.
        captures:
          type: array
          items: {}
          description: A runtime's captures; runtimes only.
        created_by:
          type:
            - string
            - 'null'
        created_at:
          type:
            - string
            - 'null'
        updated_at:
          type:
            - string
            - 'null'
        used_by:
          type: integer
          description: How many templates name the entry; in a list only.
      required:
        - id
        - name
        - kind
        - type
        - builtin
        - config
    FieldValue:
      description: >-
        A field's value, or a pointer to a saved store's secret for a string
        field.
      anyOf:
        - type: string
        - type: number
        - type: boolean
        - type: array
          items: {}
        - $ref: '#/components/schemas/SecretPointer'
    SecretPointer:
      type: object
      properties:
        from:
          type: string
          description: The saved store holding the secret.
        ref:
          type: string
          description: The secret in that store.
        key:
          type: string
          description: The key inside that secret whose value the field takes.
      required:
        - from
        - ref
        - key
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        The server's token (MIRAGE_AUTH_TOKEN) or a JWT. A daemon in the default
        local mode with no token accepts requests without one.

````

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