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

# Create an environment

> Creates the environment and its version 1. The spec is validated (harness, model endpoint, egress hosts, env, secrets, MCP servers, skills, permissions) and stored normalized.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/environments
openapi: 3.1.0
info:
  title: Veri API
  description: >-
    REST API for the Veri RL post-training platform. All requests require a
    Bearer API key (`vk_` prefix).
  license:
    name: ''
  version: 0.1.0
servers:
  - url: https://api.veri.studio
    description: Production
security: []
tags:
  - name: Training jobs
    description: Create, monitor, and manage training jobs.
  - name: Datasets
    description: Upload and connect training datasets.
  - name: Deployments
    description: Serve trained models and run inference.
  - name: Volumes
    description: Persistent file storage mounted into jobs.
  - name: Models
    description: Custom model registry deployments serve from.
  - name: Regions
    description: Discover available launch regions.
  - name: GPU
    description: Live GPU availability by provider and region.
  - name: Compatibility
    description: Advisory model and runtime compatibility guidance.
  - name: Code artifacts
    description: Upload custom training script bundles.
  - name: Billing
    description: Credit balance and transaction history.
  - name: API keys
    description: Create and revoke API keys.
  - name: Account
    description: The authenticated caller's identity.
  - name: SSH keys
    description: Manage SSH key pairs for compute access.
  - name: Settings
    description: Account-level integrations (Weights & Biases).
  - name: Metrics
    description: Prometheus metrics export for your own observability stack.
  - name: Public runs
    description: Unauthenticated reads of runs their owners published to Explore.
paths:
  /v1/environments:
    post:
      tags:
        - Environments
      summary: Create an environment
      description: >-
        Creates the environment and its version 1. The spec is validated
        (harness, model endpoint, egress hosts, env, secrets, MCP servers,
        skills, permissions) and stored normalized.
      operationId: create
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EnvironmentCreateRequest'
        required: true
      responses:
        '201':
          description: The environment with version 1
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EnvironmentResponse'
        '400':
          description: Invalid spec, unknown secret or skill, or managed agents disabled
        '404':
          description: model.deployment_id is not a deployment in this workspace
        '409':
          description: An environment with this name already exists
      security:
        - bearerAuth: []
components:
  schemas:
    EnvironmentCreateRequest:
      allOf:
        - $ref: '#/components/schemas/EnvironmentSpecInput'
        - type: object
          required:
            - name
          properties:
            name:
              type: string
              description: '`[a-z0-9][a-z0-9_-]{0,63}`, unique per workspace.'
            description:
              type:
                - string
                - 'null'
    EnvironmentResponse:
      type: object
      required:
        - object
        - id
        - name
        - latest_version
        - created_by
        - created_at
        - updated_at
        - version
      properties:
        object:
          type: string
        id:
          type: string
        name:
          type: string
        description:
          type:
            - string
            - 'null'
        latest_version:
          type: integer
          format: int32
        created_by:
          type: string
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        version:
          $ref: '#/components/schemas/EnvironmentVersionResponse'
          description: The latest version unless `?version=` asked for another.
    EnvironmentSpecInput:
      type: object
      description: |-
        The environment spec as submitted. Also the body of
        `POST /v1/environments/{id}/versions`.
      properties:
        harness:
          type:
            - string
            - 'null'
          description: '`claude-code` (the only harness today).'
        model:
          $ref: '#/components/schemas/ModelInput'
          description: Where the harness sends model calls.
        size:
          type:
            - string
            - 'null'
          description: '`small` | `standard` (default) | `large`.'
        egress:
          type:
            - string
            - 'null'
          description: '`restricted` (default) | `unrestricted`.'
        allowed_hosts:
          type: array
          items:
            type: string
          description: Extra hostnames a restricted session may reach.
        env:
          type: object
          description: Plain environment variables for the harness.
          additionalProperties:
            type: string
          propertyNames:
            type: string
        secrets:
          type: array
          items:
            type: string
          description: |-
            Secret names injected as environment variables named after them
            (or attached per host when the secret has a scope_host).
        mcp_servers:
          type: array
          items:
            $ref: '#/components/schemas/McpServerInput'
        skills:
          type: array
          items:
            type: string
          description: 'Skill names, optionally pinned: `name` (latest) or `name@3`.'
        permissions:
          $ref: '#/components/schemas/PermissionsInput'
        idle_timeout_s:
          type:
            - integer
            - 'null'
          format: int64
          description: |-
            Seconds without input before the session snapshots and pauses
            (60 .. 21600, default 900).
    EnvironmentVersionResponse:
      type: object
      required:
        - object
        - environment_id
        - version
        - spec
        - created_by
        - created_at
      properties:
        object:
          type: string
        environment_id:
          type: string
        version:
          type: integer
          format: int32
        spec:
          $ref: '#/components/schemas/EnvironmentSpec'
          description: >-
            The normalized spec: defaults filled, hosts lowercased, skills
            pinned.
        created_by:
          type: string
        created_at:
          type: string
          format: date-time
    ModelInput:
      type: object
      properties:
        deployment_id:
          type:
            - string
            - 'null'
          description: >-
            A Veri deployment in this workspace. Sessions mint a
            deployment-scoped

            model access key for it automatically. Exactly one of
            `deployment_id`

            and `base_url`.
        base_url:
          type:
            - string
            - 'null'
          description: >-
            Any OpenAI-compatible (or Anthropic-compatible, for Claude Code)
            HTTPS

            base URL: your own inference service, or a provider.
        secret:
          type:
            - string
            - 'null'
          description: >-
            Name of the secret holding the API key for `base_url`. Injected by
            the

            sandbox egress intercept on requests to that host only.
    McpServerInput:
      type: object
      required:
        - name
        - url
      properties:
        name:
          type: string
          description: >-
            Short identifier, `[a-z0-9][a-z0-9_-]{0,31}`; becomes the server key
            in

            the harness's MCP config.
        url:
          type: string
          description: HTTPS URL of a streamable-HTTP MCP server.
        secret:
          type:
            - string
            - 'null'
          description: 'Optional secret name sent as `Authorization: Bearer <value>`.'
    PermissionsInput:
      type: object
      properties:
        default:
          type:
            - string
            - 'null'
          description: '`allow` (default) or `deny`: what happens to tools no rule matches.'
        rules:
          type: array
          items:
            $ref: '#/components/schemas/PermissionRuleInput'
          description: Evaluated top to bottom; the last matching rule wins.
    EnvironmentSpec:
      type: object
      required:
        - harness
        - model
        - size
        - egress
        - allowed_hosts
        - env
        - secrets
        - mcp_servers
        - skills
        - permissions
        - idle_timeout_s
      properties:
        harness:
          type: string
        model:
          $ref: '#/components/schemas/ModelSpec'
        size:
          type: string
        egress:
          type: string
        allowed_hosts:
          type: array
          items:
            type: string
        env:
          type: object
          additionalProperties:
            type: string
          propertyNames:
            type: string
        secrets:
          type: array
          items:
            type: string
        mcp_servers:
          type: array
          items:
            $ref: '#/components/schemas/McpServerSpec'
        skills:
          type: array
          items:
            $ref: '#/components/schemas/SkillPin'
        permissions:
          $ref: '#/components/schemas/Permissions'
        idle_timeout_s:
          type: integer
          format: int64
    PermissionRuleInput:
      type: object
      required:
        - tool
        - action
      properties:
        tool:
          type: string
          description: |-
            Tool pattern as the harness understands it (e.g. `Bash`,
            `Bash(git *)`, `Read`, `WebFetch`, `mcp__composio__*`).
        action:
          type: string
          description: >-
            `allow` or `deny`. `ask` (human approval) is not available yet and
            is

            rejected.
    ModelSpec:
      type: object
      properties:
        deployment_id:
          type:
            - string
            - 'null'
        base_url:
          type:
            - string
            - 'null'
        secret:
          type:
            - string
            - 'null'
    McpServerSpec:
      type: object
      required:
        - name
        - url
      properties:
        name:
          type: string
        url:
          type: string
        secret:
          type:
            - string
            - 'null'
    SkillPin:
      type: object
      required:
        - name
        - version
      properties:
        name:
          type: string
        version:
          type: integer
          format: int32
    Permissions:
      type: object
      required:
        - default
        - rules
      properties:
        default:
          type: string
        rules:
          type: array
          items:
            $ref: '#/components/schemas/PermissionRule'
    PermissionRule:
      type: object
      required:
        - tool
        - action
      properties:
        tool:
          type: string
        action:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key
      description: API key with the `vk_` prefix. Create one from the dashboard.

````

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