openapi: 3.0.0
info:
  title: Anona Compute API (E2B-compatible routes)
  version: 0.1.0
  description: The E2B-compatible API operations the Anona Compute gateway serves, for use with the E2B SDK.
servers:
- url: https://api.compute.anonalabs.com
tags:
- name: sandboxes
paths:
  /v2/sandboxes:
    post:
      summary: Create sandbox (v2)
      description: 'Create a sandbox from the template. All system communication with the sandbox is secured.


        Anona: `size` (`small`, `medium`, `large` or `xl`) sets the sandbox''s vCPU, memory and disk; an E2B SDK can send
        it as metadata `anona.size` instead. Without it the sandbox runs at its template''s own size, or on Free at the smallest
        size the template allows (Small for `base`). A size below the template''s minimum is `400` `sandbox_size_not_available`,
        and one above your plan''s largest size is `403` `plan_limit_exceeded`; the first sandbox at a size the template was
        not built at may get `503` `sandbox_size_preparing` with `Retry-After` while that size is prepared (see Sandbox sizes).
        Over a plan limit on what runs at once (sandboxes, vCPU, or sandboxes at the largest size) is `429` `plan_limit_exceeded`
        with `limit_name`, `limit`, `current` and `plan`. `timeout` also accepts `-1` for no deadline. `lifecycle.onTimeout:
        pause` (sent by the SDK as `autoPause`) pauses instead of deleting. A sandbox without a deadline reports `endAt` `9999-12-31T23:59:59Z`.
        `network.egressProxy`, `volumeMounts`, `iam` and `autoPauseMemory: false` are refused with 400, and the `Idempotency-Key`
        header is not supported.'
      parameters: []
      tags:
      - sandboxes
      security:
      - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NewSandboxV2'
      responses:
        '201':
          description: The sandbox was created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Sandbox'
        '401':
          $ref: '#/components/responses/401'
        '400':
          description: Bad request
          headers:
            Should-Retry:
              $ref: '#/components/headers/ShouldRetry'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden
          headers:
            Should-Retry:
              $ref: '#/components/headers/ShouldRetry'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found
          headers:
            Should-Retry:
              $ref: '#/components/headers/ShouldRetry'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: The sandbox is in the wrong state, or the template exists but cannot start a sandbox (error_code `template_not_ready`;
            retrying does not help until it is rebuilt)
          headers:
            Should-Retry:
              $ref: '#/components/headers/ShouldRetry'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too many requests
          headers:
            Should-Retry:
              $ref: '#/components/headers/ShouldRetry'
            Retry-After:
              description: When present, the number of seconds to wait before retrying the request.
              required: false
              schema:
                type: integer
                minimum: 0
              example: 30
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Server error
          headers:
            Should-Retry:
              $ref: '#/components/headers/ShouldRetry'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: Service unavailable
          headers:
            Should-Retry:
              $ref: '#/components/headers/ShouldRetry'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '504':
          description: Backend timeout
          headers:
            Should-Retry:
              $ref: '#/components/headers/ShouldRetry'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '402':
          description: The credit is spent (error_code `credit_exhausted`); top up or change plan
          content: &id001
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    get:
      summary: List sandboxes (v2)
      x-api-group: list
      description: List all sandboxes
      tags:
      - sandboxes
      security:
      - ApiKeyAuth: []
      parameters:
      - name: metadata
        in: query
        description: Metadata query used to filter the sandboxes (e.g. "user=abc&app=prod"). Each key and values must be URL
          encoded.
        required: false
        schema:
          type: string
      - name: state
        in: query
        description: Filter sandboxes by one or more states
        required: false
        schema:
          type: array
          items:
            $ref: '#/components/schemas/SandboxState'
        style: form
        explode: false
      - name: order
        in: query
        description: Sort direction by sandbox start time. Defaults to desc (newest first).
        required: false
        schema:
          $ref: '#/components/schemas/OrderDirection'
      - name: startedAfter
        in: query
        description: Return sandboxes started at or after this timestamp.
        required: false
        schema:
          type: string
          format: date-time
      - name: template
        in: query
        description: Filter sandboxes by a template ID or alias.
        required: false
        schema:
          type: string
      - $ref: '#/components/parameters/paginationNextToken'
      - $ref: '#/components/parameters/paginationLimit'
      responses:
        '200':
          description: Successfully returned all running sandboxes
          headers:
            X-Next-Token:
              $ref: '#/components/headers/XNextToken'
            X-Total-Running:
              $ref: '#/components/headers/XTotalRunning'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ListedSandbox'
        '401':
          $ref: '#/components/responses/401'
        '400':
          $ref: '#/components/responses/400'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
  /sandboxes/{sandboxID}:
    get:
      summary: Sandbox
      description: Get a sandbox by id
      tags:
      - sandboxes
      security:
      - ApiKeyAuth: []
      parameters:
      - $ref: '#/components/parameters/sandboxID'
      responses:
        '200':
          description: Successfully returned the sandbox
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SandboxDetail'
        '404':
          $ref: '#/components/responses/404'
        '401':
          $ref: '#/components/responses/401'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
    delete:
      summary: Kill sandbox
      x-api-group: delete
      description: Kill a sandbox
      tags:
      - sandboxes
      security:
      - ApiKeyAuth: []
      parameters:
      - $ref: '#/components/parameters/sandboxID'
      responses:
        '204':
          description: The sandbox was killed successfully
        '404':
          $ref: '#/components/responses/404'
        '401':
          $ref: '#/components/responses/401'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
  /sandboxes/{sandboxID}/fork:
    post:
      summary: Fork sandbox
      description: 'Fork the sandbox: checkpoint the running sandbox in place (it is briefly paused, snapshotted with its
        full memory state, and resumed on its node, keeping its ID and expiration untouched) and create count new sandboxes
        from that snapshot. Returns one result per requested fork, each carrying either the created sandbox or the error that
        prevented it from starting. A non-201 status means the request failed before any fork was attempted.


        Anona: the sandbox is frozen only while its memory delta is written (about 0.1 s, longer right after it has touched
        a lot of memory) and then keeps running with its own ID and expiration. Each fork is a new sandbox: it takes a slot
        of your concurrent-sandbox limit and is billed like any other sandbox, and the forks inherit the source sandbox''s
        template, metadata, timeout policy and network policy, with the `timeout` of this request. `count` above the room
        left in your plan is not an error for the whole request: the forks that fit are created and each of the others carries
        `429` `plan_limit_exceeded` (with `limit_name`, `limit`, `current` and `plan`) in its own result entry, while a platform
        at capacity reports `503` per fork. A source sandbox that is not running is `409`, and nothing is forked.'
      tags:
      - sandboxes
      security:
      - ApiKeyAuth: []
      parameters:
      - $ref: '#/components/parameters/sandboxID'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SandboxForkRequest'
      responses:
        '201':
          description: The sandbox was snapshotted and the forks were attempted; each entry reports one fork's outcome
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/SandboxForkResult'
        '409':
          $ref: '#/components/responses/409'
        '404':
          $ref: '#/components/responses/404'
        '401':
          $ref: '#/components/responses/401'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
        '503':
          $ref: '#/components/responses/503'
        '507':
          description: Snapshot storage is full (error_code `sandbox_snapshot_storage_full`); retrying does not help
          content: *id001
  /sandboxes/{sandboxID}/timeout:
    post:
      summary: Set sandbox timeout
      description: 'Set the timeout for the sandbox. The sandbox will expire x seconds from the time of the request. Calling
        this method multiple times overwrites the TTL, each time using the current timestamp as the starting point to measure
        the timeout duration.


        Anona: `-1` removes the deadline.'
      security:
      - ApiKeyAuth: []
      tags:
      - sandboxes
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SandboxTimeoutRequest'
      parameters:
      - $ref: '#/components/parameters/sandboxID'
      responses:
        '204':
          description: Successfully set the sandbox timeout
        '401':
          $ref: '#/components/responses/401'
        '404':
          $ref: '#/components/responses/404'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
  /sandboxes/{sandboxID}/refreshes:
    post:
      summary: Refresh sandbox
      description: Refresh the sandbox extending its time to live
      security:
      - ApiKeyAuth: []
      tags:
      - sandboxes
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SandboxRefreshRequest'
      parameters:
      - $ref: '#/components/parameters/sandboxID'
      responses:
        '204':
          description: Successfully refreshed the sandbox
        '401':
          $ref: '#/components/responses/401'
        '404':
          $ref: '#/components/responses/404'
        '429':
          $ref: '#/components/responses/429'
  /sandboxes/{sandboxID}/pause:
    post:
      summary: Pause sandbox
      description: Pause the sandbox
      tags:
      - sandboxes
      security:
      - ApiKeyAuth: []
      parameters:
      - $ref: '#/components/parameters/sandboxID'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SandboxPauseRequest'
      responses:
        '204':
          description: The sandbox was paused successfully and can be resumed
        '409':
          $ref: '#/components/responses/409'
        '404':
          $ref: '#/components/responses/404'
        '401':
          $ref: '#/components/responses/401'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
        '503':
          $ref: '#/components/responses/503'
        '507':
          description: Snapshot storage is full (error_code `sandbox_snapshot_storage_full`); retrying does not help
          content: *id001
  /v2/sandboxes/{sandboxID}/connect:
    post:
      summary: Connect sandbox (v2)
      description: 'Returns sandbox details. If the sandbox is paused, it will be resumed. TTL is only extended. The request
        body is optional; an omitted timeout defaults to 300 seconds.


        Anona: resuming a paused sandbox when no sandbox host has room for it is `503` `sandbox_capacity_unavailable` with
        `Should-Retry: true` and `Retry-After`. The sandbox stays paused and nothing in it is lost; a host is started for
        it, and the same request resumes it once there is room.'
      tags:
      - sandboxes
      security:
      - ApiKeyAuth: []
      parameters:
      - $ref: '#/components/parameters/sandboxID'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConnectSandboxV2'
      responses:
        '200':
          description: The sandbox was already running
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Sandbox'
        '201':
          description: The sandbox was resumed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Sandbox'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '404':
          $ref: '#/components/responses/404'
        '409':
          $ref: '#/components/responses/409'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
        '503':
          $ref: '#/components/responses/503'
        '504':
          $ref: '#/components/responses/504'
  /sandboxes/{sandboxID}/network:
    put:
      summary: Update sandbox network
      description: 'Update the network configuration for a running sandbox. Replaces the current egress rules with the provided
        configuration. Omitting field clears it.


        Anona: the update replaces the sandbox''s policy and goes through the same platform floor and plan limits as a create.
        An update without `allow_internet_access` keeps the sandbox''s current internet setting. `egressProxy` is refused
        with 400, as on create. A rule in `rules` that needs a new credential binding needs the same permission as on create
        (see Networking).'
      security:
      - ApiKeyAuth: []
      tags:
      - sandboxes
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SandboxNetworkUpdateConfig'
      parameters:
      - $ref: '#/components/parameters/sandboxID'
      responses:
        '204':
          description: Successfully updated the sandbox network configuration
        '401':
          $ref: '#/components/responses/401'
        '404':
          $ref: '#/components/responses/404'
        '409':
          $ref: '#/components/responses/409'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
        '400':
          $ref: '#/components/responses/400'
        '403':
          description: Your role or API key may not change this sandbox
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v3/templates:
    post:
      summary: Create template (v3)
      description: 'Create a new template


        Anona builds the image with BuildKit in an isolated builder, adds the Anona runtime layer (envd), pushes it and registers
        it. Every `FROM` is pinned by digest, `EXPOSE 49983` (envd) is refused, and private registry credentials (`fromImageRegistry`)
        are not supported yet.'
      tags:
      - templates
      security:
      - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TemplateBuildRequestV3'
      responses:
        '202':
          description: The build was requested successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplateRequestResponseV3'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
        '409':
          $ref: '#/components/responses/409'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
  /templates/{templateID}/files/{hash}:
    get:
      summary: Template build file upload URL
      description: Get an upload link for a tar file containing build layer files
      tags:
      - templates
      security:
      - ApiKeyAuth: []
      parameters:
      - $ref: '#/components/parameters/templateID'
      - in: path
        name: hash
        required: true
        schema:
          type: string
          pattern: ^[0-9a-f]{64}$
          description: Hash of the files (lowercase hex SHA-256)
      responses:
        '201':
          description: The upload link where to upload the tar file
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplateBuildFileUpload'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '404':
          $ref: '#/components/responses/404'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
  /v2/templates/{templateID}/builds/{buildID}:
    post:
      summary: Start template build (v2)
      description: Start the build
      tags:
      - templates
      security:
      - ApiKeyAuth: []
      parameters:
      - $ref: '#/components/parameters/templateID'
      - $ref: '#/components/parameters/buildID'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TemplateBuildStartV2'
      responses:
        '202':
          description: The build has started
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
  /templates/{templateID}/builds/{buildID}/status:
    get:
      summary: Template build status
      description: Get template build info
      tags:
      - templates
      security:
      - ApiKeyAuth: []
      parameters:
      - $ref: '#/components/parameters/templateID'
      - $ref: '#/components/parameters/buildID'
      - in: query
        name: logsOffset
        schema:
          default: 0
          type: integer
          format: int32
          minimum: 0
        description: Index of the starting build log that should be returned with the template
      - in: query
        name: limit
        schema:
          default: 100
          type: integer
          format: int32
          minimum: 0
          maximum: 100
        description: Maximum number of logs that should be returned
      - in: query
        name: level
        schema:
          $ref: '#/components/schemas/LogLevel'
      responses:
        '200':
          description: Successfully returned the template
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplateBuildInfo'
        '401':
          $ref: '#/components/responses/401'
        '404':
          $ref: '#/components/responses/404'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
  /templates/{templateID}/builds/{buildID}/logs:
    get:
      summary: Template build logs
      description: Get template build logs
      tags:
      - templates
      security:
      - ApiKeyAuth: []
      parameters:
      - $ref: '#/components/parameters/templateID'
      - $ref: '#/components/parameters/buildID'
      - in: query
        name: cursor
        schema:
          type: integer
          format: int64
          minimum: 0
        description: Starting timestamp of the logs that should be returned in milliseconds
      - in: query
        name: limit
        schema:
          default: 100
          type: integer
          format: int32
          minimum: 0
          maximum: 100
        description: Maximum number of logs that should be returned
      - in: query
        name: direction
        schema:
          $ref: '#/components/schemas/LogsDirection'
      - in: query
        name: level
        schema:
          $ref: '#/components/schemas/LogLevel'
      - in: query
        name: source
        schema:
          $ref: '#/components/schemas/LogsSource'
        description: Source of the logs that should be returned from
      responses:
        '200':
          description: Successfully returned the template build logs
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplateBuildLogsResponse'
        '401':
          $ref: '#/components/responses/401'
        '404':
          $ref: '#/components/responses/404'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
  /v2/templates:
    get:
      summary: List templates (v2)
      x-api-group: list
      description: List all templates
      tags:
      - templates
      security:
      - ApiKeyAuth: []
      parameters:
      - in: query
        required: false
        name: teamID
        schema:
          type: string
          description: Identifier of the team, as its UUID or its public project ID (prj_)
      - $ref: '#/components/parameters/paginationNextToken'
      - $ref: '#/components/parameters/paginationLimit'
      responses:
        '200':
          description: Successfully returned all templates
          headers:
            X-Next-Token:
              $ref: '#/components/headers/XNextToken'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Template'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
  /templates/{templateID}:
    get:
      summary: List template builds
      x-api-group: list
      description: List all builds for a template
      tags:
      - templates
      security:
      - ApiKeyAuth: []
      parameters:
      - $ref: '#/components/parameters/templateID'
      - $ref: '#/components/parameters/paginationNextToken'
      - $ref: '#/components/parameters/paginationLimit'
      responses:
        '200':
          description: Successfully returned the template with its builds
          headers:
            X-Next-Token:
              $ref: '#/components/headers/XNextToken'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplateWithBuilds'
        '401':
          $ref: '#/components/responses/401'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
        '404':
          $ref: '#/components/responses/404'
    delete:
      summary: Delete template
      x-api-group: delete
      description: 'Delete a template


        Anona: sandboxes already running from the template keep running; new creates no longer resolve its name.'
      tags:
      - templates
      security:
      - ApiKeyAuth: []
      parameters:
      - $ref: '#/components/parameters/templateID'
      responses:
        '204':
          description: The template was deleted successfully
        '401':
          $ref: '#/components/responses/401'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
        '404':
          $ref: '#/components/responses/404'
  /templates/aliases/{alias}:
    get:
      summary: Check template alias
      description: Check if template with given alias exists
      tags:
      - templates
      security:
      - ApiKeyAuth: []
      parameters:
      - name: alias
        in: path
        required: true
        schema:
          type: string
          description: Template alias
      responses:
        '200':
          description: Successfully queried template by alias
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplateAliasResponse'
        '400':
          $ref: '#/components/responses/400'
        '403':
          $ref: '#/components/responses/403'
        '404':
          $ref: '#/components/responses/404'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
  headers:
    ShouldRetry:
      description: 'Whether the condition behind this error may clear, so that retrying the request could

        succeed. true marks a transient failure such as missing capacity, a rate limit, or a

        creation still in progress: retry after Retry-After when present, otherwise with

        exponential backoff. false marks a failure a retry cannot fix, such as a malformed request

        or a configuration fault, or an outcome that is unknown, where a retry could create a

        second sandbox. Successful responses and errors without an explicit classification omit

        the header.

        '
      required: false
      schema:
        type: boolean
    XNextToken:
      description: Cursor to fetch the next page of results, if more exist
      schema:
        type: string
    XTotalRunning:
      description: 'Number of running sandboxes matching the filters, before pagination is applied. Only present when running
        sandboxes were requested.

        '
      schema:
        type: integer
        format: int32
  parameters:
    buildID:
      name: buildID
      in: path
      required: true
      schema:
        type: string
    paginationLimit:
      name: limit
      in: query
      description: Maximum number of items to return per page
      required: false
      schema:
        type: integer
        format: int32
        minimum: 1
        default: 100
        maximum: 100
    paginationNextToken:
      name: nextToken
      in: query
      description: Cursor to start the list from
      required: false
      schema:
        type: string
    sandboxID:
      name: sandboxID
      in: path
      required: true
      schema:
        type: string
    templateID:
      name: templateID
      in: path
      required: true
      schema:
        type: string
  responses:
    '400':
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '401':
      description: Authentication error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '403':
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '404':
      description: Not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '409':
      description: Conflict
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '429':
      description: Too many requests
      headers:
        Retry-After:
          description: When present, the number of seconds to wait before retrying the request.
          required: false
          schema:
            type: integer
            minimum: 0
          example: 30
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '500':
      description: Server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '503':
      description: Service unavailable
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '504':
      description: Backend timeout
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    AWSRegistry:
      type: object
      required:
      - type
      - awsAccessKeyId
      - awsSecretAccessKey
      - awsRegion
      properties:
        type:
          type: string
          enum:
          - aws
          description: Type of registry authentication
        awsAccessKeyId:
          type: string
          description: AWS Access Key ID for ECR authentication
        awsSecretAccessKey:
          type: string
          description: AWS Secret Access Key for ECR authentication
        awsRegion:
          type: string
          description: AWS Region where the ECR registry is located
    BuildLogEntry:
      required:
      - timestamp
      - message
      - level
      properties:
        timestamp:
          type: string
          format: date-time
          description: Timestamp of the log entry
        message:
          type: string
          description: Log message content
        level:
          $ref: '#/components/schemas/LogLevel'
        step:
          type: string
          description: Step in the build process related to the log entry
    BuildStatusReason:
      required:
      - message
      properties:
        message:
          type: string
          description: Message with the status reason, currently reporting only for error status
        step:
          type: string
          description: Step that failed
        logEntries:
          default: []
          description: Log entries related to the status reason
          type: array
          items:
            $ref: '#/components/schemas/BuildLogEntry'
    CPUCount:
      type: integer
      format: int32
      minimum: 1
      description: CPU cores for the sandbox
    ConnectSandboxV2:
      type: object
      properties:
        timeout:
          description: Timeout in seconds from the current time after which the sandbox should expire
          type: integer
          format: int32
          minimum: 1
          default: 300
        memory:
          type: boolean
          description: 'Defaults to true. When false and the sandbox is paused, resume from disk state only: the sandbox cold-boots
            fresh and any memory in the snapshot is ignored, never modified or deleted. Disk state has crash-recovery semantics
            — writes not flushed before the pause may be lost. A no-op for snapshots that contain no memory. Rejected with
            an error in environments where this capability is not enabled, never silently downgraded to a memory restore.'
    DiskSizeMB:
      type: integer
      format: int32
      minimum: 0
      description: Disk size for the sandbox in MiB
    EnvVars:
      additionalProperties:
        type: string
        description: Environment variables for the sandbox
    EnvdVersion:
      type: string
      description: Version of the envd running in the sandbox
    Error:
      required:
      - code
      - message
      properties:
        code:
          type: integer
          format: int32
          description: Error code
        error_code:
          type: string
          description: 'Machine-readable error code. Not a closed set; the gateway sends plan_limit_exceeded (a plan limit;
            the body also has limit_name, limit, current and plan), rate_limited (a rate limit, with Retry-After), sandbox_quota_exceeded
            (a platform cap that is not a plan limit: fork checkpoints, builds in progress), credit_exhausted (the credit
            is spent), sandbox_snapshot_storage_full (pause and fork cannot store a snapshot; retrying does not help), template_not_found,
            template_not_ready (the template exists but cannot start a sandbox), sandbox_capacity_unavailable, sandbox_engine_starting
            and sandbox_engine_unavailable (retry after Retry-After), sandbox_create_failed (retry), sandbox_create_refused,
            invalid_request and internal_server_error.'
        message:
          type: string
          description: Error
    FromImageRegistry:
      oneOf:
      - $ref: '#/components/schemas/AWSRegistry'
      - $ref: '#/components/schemas/GCPRegistry'
      - $ref: '#/components/schemas/GeneralRegistry'
      discriminator:
        propertyName: type
        mapping:
          aws: '#/components/schemas/AWSRegistry'
          gcp: '#/components/schemas/GCPRegistry'
          registry: '#/components/schemas/GeneralRegistry'
    GCPRegistry:
      type: object
      required:
      - type
      - serviceAccountJson
      properties:
        type:
          type: string
          enum:
          - gcp
          description: Type of registry authentication
        serviceAccountJson:
          type: string
          description: Service Account JSON for GCP authentication
    GeneralRegistry:
      type: object
      required:
      - type
      - username
      - password
      properties:
        type:
          type: string
          enum:
          - registry
          description: Type of registry authentication
        username:
          type: string
          description: Username to use for the registry
        password:
          type: string
          description: Password to use for the registry
    ListedSandbox:
      required:
      - templateID
      - sandboxID
      - clientID
      - startedAt
      - cpuCount
      - memoryMB
      - diskSizeMB
      - endAt
      - state
      - envdVersion
      properties:
        templateID:
          type: string
          description: Identifier of the template from which is the sandbox created
        alias:
          type: string
          description: Alias of the template
        sandboxID:
          type: string
          description: Identifier of the sandbox
        clientID:
          type: string
          deprecated: true
          description: Identifier of the client
        startedAt:
          type: string
          format: date-time
          description: Time when the sandbox was started
        endAt:
          type: string
          format: date-time
          description: Time when the sandbox will expire
        cpuCount:
          $ref: '#/components/schemas/CPUCount'
        memoryMB:
          $ref: '#/components/schemas/MemoryMB'
        diskSizeMB:
          $ref: '#/components/schemas/DiskSizeMB'
        metadata:
          $ref: '#/components/schemas/SandboxMetadata'
        state:
          $ref: '#/components/schemas/SandboxState'
        envdVersion:
          $ref: '#/components/schemas/EnvdVersion'
        volumeMounts:
          type: array
          items:
            $ref: '#/components/schemas/SandboxVolumeMount'
        size:
          type: string
          enum: &id002
          - small
          - medium
          - large
          - xl
          description: 'Anona extension: the sandbox size (vCPU, memory and disk). Absent: the template''s own size.'
    LogLevel:
      type: string
      description: State of the sandbox
      enum:
      - debug
      - info
      - warn
      - error
    LogsDirection:
      type: string
      description: Direction of the logs that should be returned
      enum:
      - forward
      - backward
      x-enum-varnames:
      - LogsDirectionForward
      - LogsDirectionBackward
    LogsSource:
      type: string
      description: Source of the logs that should be returned
      enum:
      - temporary
      - persistent
      x-enum-varnames:
      - LogsSourceTemporary
      - LogsSourcePersistent
    Mcp:
      type: object
      description: MCP configuration for the sandbox
      additionalProperties: {}
      nullable: true
    MemoryMB:
      type: integer
      format: int32
      minimum: 128
      description: Memory for the sandbox in MiB
    MinFreeDiskMb:
      type: integer
      format: int32
      minimum: 0
      description: Requested minimum free space after the template's build steps, in MiB. Omit to use the team's default.
        Set to 0 to request no minimum free-disk growth. The filesystem is never shrunk, including inherited or already-larger
        filesystems. Growth is best effort, so filesystem metadata can leave the available space slightly below the requested
        minimum.
    NewSandboxV2:
      description: Sandbox creation request. All system communication with the sandbox is always secured; the template's envd
        version must support secured access.
      required:
      - templateID
      properties:
        templateID:
          type: string
          description: Identifier of the required template
        timeout:
          type: integer
          format: int32
          minimum: 1
          default: 300
          description: Time to live for the sandbox in seconds.
        autoPause:
          type: boolean
          default: false
          description: Automatically pauses the sandbox after the timeout
        autoPauseMemory:
          type: boolean
          default: true
          description: Controls the snapshot kind taken when the sandbox auto-pauses on timeout (only relevant when autoPause
            is true). When false, the auto-pause drops the in-memory state and persists only the filesystem (a filesystem-only
            snapshot); resuming it cold-boots (reboots) the sandbox from disk. Such a snapshot cannot be auto-resumed by traffic
            and must be resumed explicitly, so it cannot be combined with autoResume. Defaults to true (full memory snapshot).
        autoResume:
          $ref: '#/components/schemas/SandboxAutoResumeConfig'
        allow_internet_access:
          type: boolean
          description: Allow sandbox to access the internet. When set to false, it behaves the same as specifying denyOut
            to 0.0.0.0/0 in the network config.
        network:
          $ref: '#/components/schemas/SandboxNetworkConfig'
        metadata:
          $ref: '#/components/schemas/SandboxMetadata'
        envVars:
          $ref: '#/components/schemas/EnvVars'
        mcp:
          $ref: '#/components/schemas/Mcp'
        iam:
          $ref: '#/components/schemas/SandboxIam'
        volumeMounts:
          type: array
          items:
            $ref: '#/components/schemas/SandboxVolumeMount'
        size:
          type: string
          enum: *id002
          description: 'Anona extension: the sandbox size (vCPU, memory and disk). Absent: the template''s own size.'
    OrderDirection:
      type: string
      description: Sort direction
      default: desc
      enum:
      - asc
      - desc
    Sandbox:
      required:
      - templateID
      - sandboxID
      - clientID
      - envdVersion
      properties:
        templateID:
          type: string
          description: Identifier of the template from which is the sandbox created
        sandboxID:
          type: string
          description: Identifier of the sandbox
        alias:
          type: string
          description: Alias of the template
        clientID:
          type: string
          deprecated: true
          description: Identifier of the client
        envdVersion:
          $ref: '#/components/schemas/EnvdVersion'
        envdAccessToken:
          type: string
          description: Access token used for envd communication
        trafficAccessToken:
          type: string
          nullable: true
          description: Token required for accessing sandbox via proxy.
        domain:
          type: string
          nullable: true
          description: Base domain where the sandbox traffic is accessible
    SandboxAutoResumeConfig:
      type: object
      description: Auto-resume configuration for paused sandboxes.
      required:
      - enabled
      properties:
        enabled:
          $ref: '#/components/schemas/SandboxAutoResumeEnabled'
    SandboxAutoResumeEnabled:
      type: boolean
      description: Auto-resume enabled flag for paused sandboxes. Default false.
      default: false
    SandboxDetail:
      required:
      - templateID
      - sandboxID
      - clientID
      - startedAt
      - cpuCount
      - memoryMB
      - diskSizeMB
      - endAt
      - state
      - envdVersion
      properties:
        templateID:
          type: string
          description: Identifier of the template from which is the sandbox created
        alias:
          type: string
          description: Alias of the template
        sandboxID:
          type: string
          description: Identifier of the sandbox
        clientID:
          type: string
          deprecated: true
          description: Identifier of the client
        startedAt:
          type: string
          format: date-time
          description: Time when the sandbox was started
        endAt:
          type: string
          format: date-time
          description: Time when the sandbox will expire
        envdVersion:
          $ref: '#/components/schemas/EnvdVersion'
        envdAccessToken:
          type: string
          description: Access token used for envd communication
        allowInternetAccess:
          type: boolean
          nullable: true
          description: Whether internet access was explicitly enabled or disabled for the sandbox. Null means it was not explicitly
            set.
        domain:
          type: string
          nullable: true
          description: Base domain where the sandbox traffic is accessible
        cpuCount:
          $ref: '#/components/schemas/CPUCount'
        memoryMB:
          $ref: '#/components/schemas/MemoryMB'
        diskSizeMB:
          $ref: '#/components/schemas/DiskSizeMB'
        metadata:
          $ref: '#/components/schemas/SandboxMetadata'
        state:
          $ref: '#/components/schemas/SandboxState'
        network:
          $ref: '#/components/schemas/SandboxNetworkConfig'
        lifecycle:
          $ref: '#/components/schemas/SandboxLifecycle'
        pauseMode:
          $ref: '#/components/schemas/SandboxPauseMode'
        volumeMounts:
          type: array
          items:
            $ref: '#/components/schemas/SandboxVolumeMount'
        size:
          type: string
          enum: *id002
          description: 'Anona extension: the sandbox size (vCPU, memory and disk). Absent: the template''s own size.'
    SandboxForkRequest:
      type: object
      properties:
        timeout:
          type: integer
          format: int32
          minimum: 0
          default: 15
          description: Time to live for the new forked sandboxes in seconds.
        count:
          type: integer
          format: int32
          minimum: 1
          maximum: 100
          default: 1
          description: Number of forked sandboxes to create. All forks boot from the same snapshot, so the snapshot is captured
            once regardless of count. Each fork succeeds or fails independently; the outcome of each is reported in its entry
            of the response list.
    SandboxForkResult:
      type: object
      description: 'Result of one requested fork. Exactly one of sandbox or error is set: sandbox when the fork started successfully,
        error when it failed to start.'
      properties:
        sandbox:
          $ref: '#/components/schemas/Sandbox'
        error:
          $ref: '#/components/schemas/Error'
    SandboxIam:
      type: object
      description: Sandbox workload identity configuration. A non-empty, valid tokens map enables workload identity for the
        sandbox.
      properties:
        tokens:
          $ref: '#/components/schemas/SandboxIamTokens'
    SandboxIamToken:
      type: object
      required:
      - audience
      - tokenType
      properties:
        audience:
          type: string
          description: Audience of the workload token, stored exactly as provided.
        tokenType:
          type: string
          description: Workload token type.
    SandboxIamTokens:
      type: object
      description: Named workload-token definitions, keyed by a caller-chosen token name.
      additionalProperties:
        $ref: '#/components/schemas/SandboxIamToken'
    SandboxLifecycle:
      type: object
      description: Sandbox lifecycle policy returned by sandbox info.
      required:
      - autoResume
      - onTimeout
      properties:
        autoResume:
          type: boolean
          description: Whether the sandbox can auto-resume.
        onTimeout:
          $ref: '#/components/schemas/SandboxOnTimeout'
    SandboxMetadata:
      additionalProperties:
        type: string
        description: Metadata of the sandbox
    SandboxNetworkConfig:
      type: object
      properties:
        allowPublicTraffic:
          type: boolean
          nullable: true
          description: Whether sandbox URLs accept traffic without the sandbox's traffic access token. When omitted or null
            on create, the project's default applies, which is true unless the project changed it.
        allowOut:
          type: array
          description: 'Destinations to allow: IPv4 addresses, CIDR blocks (e.g. "203.0.113.0/24") and exact host names (e.g.
            "api.example.com"). Allowed entries take precedence over denied entries. Anona: a host name needs public egress
            off (`allow_internet_access: false`, or `0.0.0.0/0` in `denyOut`). Wildcard names such as `*.example.com` are
            refused with 400 (wildcard host names are not supported yet; name exact hosts), and so are names that do not resolve
            yet and destinations in private or reserved ranges, including names that resolve into them. The sandbox''s DNS
            resolvers, 1.1.1.1 and 1.0.0.1, are always allowed.'
          items:
            type: string
        denyOut:
          type: array
          description: List of denied CIDR blocks or IP addresses for egress traffic. Domain names are not supported for deny
            rules.
          items:
            type: string
        dnsServers:
          type: array
          maxItems: 10
          description: 'Anona: sandboxes resolve names through 1.1.1.1 and 1.0.0.1, which are always allowed, and this field
            does not change that or the sandbox''s /etc/resolv.conf. Any other IPv4 address listed here is added to the allowed
            destinations when `allowOut` has a host name and public egress is off; otherwise it is accepted and has no effect.
            The free plan accepts only 1.1.1.1 and 1.0.0.1, and an address in a reserved range is refused with 400.'
          items:
            type: string
        egressProxy:
          type: object
          nullable: true
          description: Not supported on Anona. Any value other than `null` is refused with 400 (`SOCKS5 egress proxies are
            not supported`), on create and on update.
        maskRequestHost:
          type: string
          description: Specify host mask which will be used for all sandbox requests
        httpsPorts:
          type: array
          description: Sandbox ports that serve HTTPS rather than plaintext HTTP. Affects how the proxy reaches the service
            inside the sandbox; the public URL is HTTPS either way. Certificates are not verified, so self-signed ones work.
            The envd port (49983) cannot be listed.
          maxItems: 128
          uniqueItems: true
          items:
            type: integer
            format: uint32
            minimum: 1
            maximum: 65535
        rules:
          type: object
          description: 'Per-host header rules for the sandbox''s outbound HTTPS requests. Anona: each key is one exact host
            name, normalized to lowercase. A wildcard key such as `*.example.com` is refused with 400 (`a wildcard is not
            allowed here; name the exact host`), and so is an IP address. Rules apply to HTTPS only. A rule does not allow
            the host on its own: with public egress off, list the host in `allowOut` too, or the rule is dropped with a warning.
            The host must be on the secret''s allowed hosts (403 otherwise), and a rule that needs a new credential binding
            needs a caller who may create one (403 otherwise); see Networking.'
          additionalProperties:
            type: array
            items:
              $ref: '#/components/schemas/SandboxNetworkRule'
    SandboxNetworkRule:
      type: object
      description: Transform rule applied to egress requests matching a domain pattern.
      properties:
        transform:
          $ref: '#/components/schemas/SandboxNetworkTransform'
    SandboxNetworkTransform:
      type: object
      description: Transformations applied to matching egress requests before forwarding.
      properties:
        headers:
          type: object
          description: 'HTTP headers to set on matching requests; an existing header with the same name is replaced. Anona:
            every value must be one credential vault placeholder, `${vault.<name>}`, optionally after `Bearer ` or `Basic
            `. The egress proxy fills it in on the way out, and the sandbox never sees the value. A literal value is refused
            with 400 (`value must be ${vault.<name>}, optionally prefixed by "Bearer " or "Basic "; literal values are not
            accepted`), as is a value with more than one placeholder and an empty `headers` object (`transform.headers: empty`).
            `Host`, `Content-Length`, `Transfer-Encoding`, `Connection`, `Upgrade`, `TE`, `Trailer`, `Keep-Alive` and `Proxy-*`
            headers cannot be set.'
          additionalProperties:
            type: string
    SandboxNetworkUpdateConfig:
      type: object
      description: Network configuration update for a running sandbox. Replaces the current egress rules with the provided
        configuration. Omitting a field clears it.
      properties:
        allowOut:
          type: array
          description: 'Destinations to allow: IPv4 addresses, CIDR blocks (e.g. "203.0.113.0/24") and exact host names (e.g.
            "api.example.com"). Allowed entries take precedence over denied entries. Anona: a host name needs public egress
            off (`allow_internet_access: false`, or `0.0.0.0/0` in `denyOut`). Wildcard names such as `*.example.com` are
            refused with 400 (wildcard host names are not supported yet; name exact hosts), and so are names that do not resolve
            yet and destinations in private or reserved ranges, including names that resolve into them. The sandbox''s DNS
            resolvers, 1.1.1.1 and 1.0.0.1, are always allowed.'
          items:
            type: string
        denyOut:
          type: array
          description: List of denied CIDR blocks or IP addresses for egress traffic. Domain names are not supported for deny
            rules.
          items:
            type: string
        dnsServers:
          type: array
          maxItems: 10
          description: 'Anona: sandboxes resolve names through 1.1.1.1 and 1.0.0.1, which are always allowed, and this field
            does not change that or the sandbox''s /etc/resolv.conf. Any other IPv4 address listed here is added to the allowed
            destinations when `allowOut` has a host name and public egress is off; otherwise it is accepted and has no effect.
            The free plan accepts only 1.1.1.1 and 1.0.0.1, and an address in a reserved range is refused with 400.'
          items:
            type: string
        egressProxy:
          type: object
          nullable: true
          description: Not supported on Anona. Any value other than `null` is refused with 400 (`SOCKS5 egress proxies are
            not supported`), on create and on update.
        rules:
          type: object
          description: 'Per-host header rules for the sandbox''s outbound HTTPS requests. Anona: each key is one exact host
            name, normalized to lowercase. A wildcard key such as `*.example.com` is refused with 400 (`a wildcard is not
            allowed here; name the exact host`), and so is an IP address. Rules apply to HTTPS only. A rule does not allow
            the host on its own: with public egress off, list the host in `allowOut` too, or the rule is dropped with a warning.
            The host must be on the secret''s allowed hosts (403 otherwise), and a rule that needs a new credential binding
            needs a caller who may create one (403 otherwise); see Networking.'
          additionalProperties:
            type: array
            items:
              $ref: '#/components/schemas/SandboxNetworkRule'
        allow_internet_access:
          type: boolean
          description: Allow sandbox to access the internet. When set to false, it behaves the same as specifying denyOut
            to 0.0.0.0/0 in the network config.
    SandboxOnTimeout:
      type: string
      description: Action taken when the sandbox times out.
      enum:
      - kill
      - pause
    SandboxPauseMode:
      type: string
      description: What the sandbox's latest pause saved. `full` saved the filesystem and the memory, and resuming restores
        the sandbox where it left off. `filesystem` saved only the filesystem, and resuming reboots the sandbox from disk.
        Returned for a paused sandbox once its pause has finished, and omitted while it is still pausing.
      enum:
      - full
      - filesystem
    SandboxPauseRequest:
      type: object
      properties:
        memory:
          type: boolean
          default: true
          description: Whether to capture a full memory snapshot. When false, only the filesystem is persisted and resuming
            the sandbox cold-boots (reboots) it from disk, losing in-memory state, running processes, and open connections.
            Resume it with an explicit request (connect or resume); auto-resume, which can be triggered by arbitrary traffic,
            refuses such a sandbox. Defaults to true.
    SandboxRefreshRequest:
      type: object
      properties:
        duration:
          description: Duration for which the sandbox should be kept alive in seconds
          type: integer
          maximum: 3600
          minimum: 0
    SandboxState:
      type: string
      description: State of the sandbox
      enum:
      - running
      - paused
    SandboxTimeoutRequest:
      type: object
      required:
      - timeout
      properties:
        timeout:
          description: Timeout in seconds from the current time after which the sandbox should expire
          type: integer
          format: int32
          minimum: 0
    SandboxVolumeMount:
      type: object
      properties:
        name:
          type: string
          description: Name of the volume
        path:
          type: string
          description: Path of the volume
      required:
      - name
      - path
    TeamUser:
      required:
      - id
      - email
      properties:
        id:
          type: string
          format: uuid
          description: Identifier of the user
        email:
          type: string
          nullable: true
          deprecated: true
          default: null
          description: Email of the user
    Template:
      required:
      - templateID
      - buildID
      - cpuCount
      - memoryMB
      - diskSizeMB
      - public
      - createdAt
      - updatedAt
      - createdBy
      - lastSpawnedAt
      - spawnCount
      - buildCount
      - envdVersion
      - aliases
      - names
      - buildStatus
      properties:
        templateID:
          type: string
          description: Identifier of the template
        buildID:
          type: string
          description: Identifier of the last successful build for given template
        cpuCount:
          $ref: '#/components/schemas/CPUCount'
        memoryMB:
          $ref: '#/components/schemas/MemoryMB'
        diskSizeMB:
          $ref: '#/components/schemas/DiskSizeMB'
        public:
          type: boolean
          description: Whether the template is public or only accessible by the team
        aliases:
          type: array
          description: Aliases of the template
          deprecated: true
          items:
            type: string
        names:
          type: array
          description: Names of the template (namespace/alias format when namespaced)
          items:
            type: string
        createdAt:
          type: string
          format: date-time
          description: Time when the template was created
        updatedAt:
          type: string
          format: date-time
          description: Time when the template was last updated
        createdBy:
          allOf:
          - $ref: '#/components/schemas/TeamUser'
          nullable: true
        lastSpawnedAt:
          type: string
          nullable: true
          format: date-time
          description: Time when the template was last used
        spawnCount:
          type: integer
          format: int64
          description: Number of times the template was used
        buildCount:
          type: integer
          format: int32
          description: Number of times the template was built
        envdVersion:
          $ref: '#/components/schemas/EnvdVersion'
        buildStatus:
          $ref: '#/components/schemas/TemplateBuildStatus'
        isDefault:
          type: boolean
          description: 'Whether the template is one of the platform''s default templates. A default template owned by another
            team carries zero or null usage fields (`spawnCount`, `buildCount`, `lastSpawnedAt`, `createdBy`).

            '
        description:
          type: string
          description: Description of the template
    TemplateAliasResponse:
      required:
      - templateID
      - public
      properties:
        templateID:
          type: string
          description: Identifier of the template
        public:
          type: boolean
          description: Whether the template is public or only accessible by the team
    TemplateBuild:
      required:
      - buildID
      - status
      - createdAt
      - updatedAt
      - cpuCount
      - memoryMB
      properties:
        buildID:
          type: string
          format: uuid
          description: Identifier of the build
        status:
          $ref: '#/components/schemas/TemplateBuildStatus'
        createdAt:
          type: string
          format: date-time
          description: Time when the build was created
        updatedAt:
          type: string
          format: date-time
          description: Time when the build was last updated
        finishedAt:
          type: string
          format: date-time
          description: Time when the build was finished
        cpuCount:
          $ref: '#/components/schemas/CPUCount'
        memoryMB:
          $ref: '#/components/schemas/MemoryMB'
        diskSizeMB:
          $ref: '#/components/schemas/DiskSizeMB'
        envdVersion:
          $ref: '#/components/schemas/EnvdVersion'
    TemplateBuildFileUpload:
      required:
      - present
      properties:
        present:
          type: boolean
          description: Whether the file is already present in the cache
        url:
          description: Url where the file should be uploaded to
          type: string
        headers:
          description: Request headers that must be sent with the upload request
          type: object
          additionalProperties:
            type: string
    TemplateBuildInfo:
      required:
      - templateID
      - buildID
      - status
      - logs
      - logEntries
      properties:
        logs:
          default: []
          deprecated: true
          description: Build logs (always empty since the V1 build path was removed, use logEntries)
          type: array
          items:
            type: string
        logEntries:
          default: []
          description: Build logs structured
          type: array
          items:
            $ref: '#/components/schemas/BuildLogEntry'
        templateID:
          type: string
          description: Identifier of the template
        buildID:
          type: string
          description: Identifier of the build
        status:
          $ref: '#/components/schemas/TemplateBuildStatus'
        reason:
          $ref: '#/components/schemas/BuildStatusReason'
    TemplateBuildLogsResponse:
      required:
      - logs
      properties:
        logs:
          default: []
          description: Build logs structured
          type: array
          items:
            $ref: '#/components/schemas/BuildLogEntry'
    TemplateBuildRequestV3:
      properties:
        name:
          description: Name of the template. Can include a tag with colon separator (e.g. "my-template" or "my-template:v1").
            If tag is included, it will be treated as if the tag was provided in the tags array.
          type: string
          maxLength: 128
        tags:
          type: array
          description: Tags to assign to the template build
          items:
            type: string
        alias:
          description: Alias of the template. Deprecated, use name instead.
          type: string
          maxLength: 128
          deprecated: true
        teamID:
          deprecated: true
          type: string
          description: Identifier of the team, as its UUID or its public project ID (prj_)
        cpuCount:
          $ref: '#/components/schemas/CPUCount'
        memoryMB:
          $ref: '#/components/schemas/MemoryMB'
        minFreeDiskMb:
          $ref: '#/components/schemas/MinFreeDiskMb'
    TemplateBuildStartV2:
      type: object
      description: Exactly one of fromImage or fromTemplate must be given and non-empty.
      properties:
        fromImage:
          type: string
          minLength: 1
          description: Image to use as a base for the template build
        fromTemplate:
          type: string
          minLength: 1
          description: Template to use as a base for the template build
        fromImageRegistry:
          $ref: '#/components/schemas/FromImageRegistry'
        force:
          default: false
          type: boolean
          description: Whether the whole build should be forced to run regardless of the cache
        steps:
          default: []
          description: List of steps to execute in the template build
          type: array
          items:
            $ref: '#/components/schemas/TemplateStep'
        startCmd:
          description: Start command to execute in the template after the build
          type: string
        readyCmd:
          description: Ready check command to execute in the template after the build
          type: string
    TemplateBuildStatus:
      type: string
      description: Status of the template build
      enum:
      - building
      - waiting
      - ready
      - error
    TemplateRequestResponseV3:
      required:
      - templateID
      - buildID
      - public
      - aliases
      - names
      - tags
      properties:
        templateID:
          type: string
          description: Identifier of the template
        buildID:
          type: string
          description: Identifier of the last successful build for given template
        public:
          type: boolean
          description: Whether the template is public or only accessible by the team
        names:
          type: array
          description: Names of the template
          items:
            type: string
        tags:
          type: array
          description: Tags assigned to the template build
          items:
            type: string
        aliases:
          type: array
          description: Aliases of the template
          deprecated: true
          items:
            type: string
    TemplateStep:
      description: Step in the template build process
      required:
      - type
      properties:
        type:
          type: string
          description: Type of the step
        args:
          default: []
          type: array
          description: Arguments for the step
          items:
            type: string
        filesHash:
          type: string
          pattern: ^[0-9a-f]{64}$
          description: Hash of the files used in the step (lowercase hex SHA-256)
        force:
          default: false
          type: boolean
          description: Whether the step should be forced to run regardless of the cache
    TemplateWithBuilds:
      allOf:
      - $ref: '#/components/schemas/Template'
      - type: object
        required:
        - builds
        properties:
          builds:
            type: array
            description: List of builds for the template
            items:
              $ref: '#/components/schemas/TemplateBuild'
