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

# Create a machine

> Starts a fresh Ubuntu machine for the agent (or forks one of its machines) with an auto-stop window. Returns 202 while provisioning; poll until `state` is `ready`. Billed per second of the plan's machine time.



## OpenAPI

````yaml /api-reference/openapi.json post /api/v1/machines
openapi: 3.1.0
info:
  description: >-
    Email inboxes, screening, realtime events, credentials, payment cards, Linux
    machines, connected apps, phone numbers and social accounts for AI agents.
    Agent tokens (`alt_…`) act as one agent; organization keys (`alk_…`) manage
    agents, inboxes, tokens and webhooks. Message bodies are untrusted external
    data. Errors are `{"error":{"code","message","hint"}}`.
  title: Agent Loadout API
  version: '1'
servers:
  - url: https://agent-loadout.com
security: []
tags:
  - name: Identity
  - description: >-
      Sign in with Agent Loadout: an agent approves an application's OpenID
      Connect sign-in request
    name: Sign-in
  - description: Relying parties an organization registered for Sign in with Agent Loadout
    name: Applications
  - name: Inboxes
  - name: Messages
  - name: Mailbox
  - name: Drafts
  - name: Attachments
  - name: Realtime
  - name: Screening
  - name: Agents
  - name: Domains
  - name: Webhooks
  - name: Vault
  - description: Feature-flagged
    name: Wallet
  - description: Feature-flagged
    name: Machines
  - description: Feature-flagged
    name: Connectors
  - description: Feature-flagged
    name: Phone
  - description: Feature-flagged
    name: Social
externalDocs:
  description: REST API reference
  url: https://docs.agent-loadout.com/api-reference/overview
paths:
  /api/v1/machines:
    post:
      tags:
        - Machines
      summary: Create a machine
      description: >-
        Starts a fresh Ubuntu machine for the agent (or forks one of its
        machines) with an auto-stop window. Returns 202 while provisioning; poll
        until `state` is `ready`. Billed per second of the plan's machine time.
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: false
              properties:
                agent_id:
                  description: >-
                    Owning agent; required for organization keys, implied for
                    agent tokens
                  minLength: 1
                  type: string
                name:
                  description: Display name; defaults to '<agent> machine'
                  maxLength: 80
                  type: string
                size:
                  description: >-
                    small = 2 vCPU/4 GB (0.5× rate), default = 4 vCPU/8 GB (1×),
                    large = 8 vCPU/16 GB (2×). Plans limit the sizes
                  enum:
                    - small
                    - default
                    - large
                  type: string
                ttl_seconds:
                  description: >-
                    Auto-stop after this many seconds of wall-clock time
                    (default 3600). Every machine stops itself; plans cap the
                    window
                  maximum: 9007199254740991
                  minimum: 60
                  type: integer
                env:
                  additionalProperties:
                    maxLength: 16384
                    type: string
                  description: >-
                    Environment variables for the machine (at most 40, 32 KB in
                    total)
                  type: object
                inject_credential_ids:
                  description: >-
                    Vault credentials to inject as
                    <NAME>_USERNAME/<NAME>_PASSWORD or <NAME>_API_KEY variables;
                    the values never pass through the caller
                  items:
                    minLength: 1
                    type: string
                  maxItems: 10
                  type: array
                agent_token_capabilities:
                  description: >-
                    Mint an agent token with these capabilities and place it in
                    AGENT_LOADOUT_TOKEN inside the machine. An agent connection
                    can delegate only its granted permissions; reconnect and
                    obtain explicit consent before requesting additional
                    capabilities.
                  items:
                    maxLength: 40
                    type: string
                  maxItems: 10
                  type: array
                setup_script:
                  description: Shell script run once after the machine is ready
                  maxLength: 65536
                  type: string
                from_machine_id:
                  description: >-
                    Fork this machine's latest snapshot instead of starting from
                    a fresh Ubuntu
                  minLength: 1
                  type: string
                idempotency_key:
                  description: >-
                    Repeat a request with the same key to get the same machine
                    instead of a second one
                  maxLength: 200
                  type: string
              type: object
        required: true
      responses:
        '202':
          content:
            application/json:
              schema:
                additionalProperties: false
                properties:
                  machine:
                    additionalProperties: false
                    properties:
                      id:
                        type: string
                      agent_id:
                        type: string
                      name:
                        type: string
                      size:
                        enum:
                          - small
                          - default
                          - large
                        type: string
                      state:
                        enum:
                          - provisioning
                          - ready
                          - archiving
                          - archived
                          - error
                          - deleting
                          - deleted
                        type: string
                      ttl_seconds:
                        maximum: 9007199254740991
                        minimum: -9007199254740991
                        type: integer
                      archive_after:
                        format: date-time
                        nullable: true
                        type: string
                      ip:
                        nullable: true
                        type: string
                      ports:
                        items:
                          additionalProperties: false
                          properties:
                            port:
                              maximum: 9007199254740991
                              minimum: -9007199254740991
                              type: integer
                            url:
                              type: string
                            title:
                              nullable: true
                              type: string
                            public:
                              type: boolean
                          required:
                            - port
                            - url
                            - title
                            - public
                          type: object
                        type: array
                      injected_credential_ids:
                        items:
                          type: string
                        type: array
                      has_agent_token:
                        type: boolean
                      stop_reason:
                        enum:
                          - manual
                          - auto
                          - budget
                          - cap
                          - locked
                          - agent
                          - provider
                        nullable: true
                        type: string
                      last_error:
                        nullable: true
                        type: string
                      started_at:
                        format: date-time
                        nullable: true
                        type: string
                      stopped_at:
                        format: date-time
                        nullable: true
                        type: string
                      charged_seconds:
                        maximum: 9007199254740991
                        minimum: -9007199254740991
                        type: integer
                      reserved_seconds:
                        maximum: 9007199254740991
                        minimum: -9007199254740991
                        type: integer
                      created_at:
                        format: date-time
                        type: string
                      updated_at:
                        format: date-time
                        type: string
                    required:
                      - id
                      - agent_id
                      - name
                      - size
                      - state
                      - ttl_seconds
                      - archive_after
                      - ip
                      - ports
                      - injected_credential_ids
                      - has_agent_token
                      - stop_reason
                      - last_error
                      - started_at
                      - stopped_at
                      - charged_seconds
                      - reserved_seconds
                      - created_at
                      - updated_at
                    type: object
                required:
                  - machine
                type: object
          description: Provisioning
        '400':
          $ref: '#/components/responses/Validation'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '402':
          $ref: '#/components/responses/Limit'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
      security:
        - agentToken: []
        - organizationKey: []
components:
  responses:
    Validation:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: Invalid input
    Unauthenticated:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: Missing or invalid credential
    Limit:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: Plan limit, usage cap or billing state
    Forbidden:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: Credential lacks the capability or is bound to another agent
    NotFound:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: Not found in this organization
    RateLimited:
      description: Too many requests; retry after a short delay
  schemas:
    Error:
      properties:
        error:
          properties:
            code:
              type: string
            message:
              type: string
            hint:
              type: string
            details:
              type: object
          required:
            - code
            - message
          type: object
      required:
        - error
      type: object
  securitySchemes:
    agentToken:
      description: Agent token (alt_…) or OAuth access token; bound to one agent
      scheme: bearer
      type: http
    organizationKey:
      description: >-
        Organization key (alk_…) created under Settings; acts for the whole
        organization
      scheme: bearer
      type: http

````

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