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

# Create an environment

> Create an environment. Required permissions: `CreateEnvironment, EditEnvironment, UseFileStorage`. *Note:* This is a beta endpoint with known limitations.



## OpenAPI

````yaml /api-specs/6.3/public-api.yaml post /api/environments/beta/environments
openapi: 3.0.3
info:
  title: Domino Public API
  description: Domino Public API Endpoints
  version: 6.2.2
servers: []
security:
  - DominoApiKey: []
  - BearerAuthentication: []
tags:
  - name: AIGateway
  - name: AppInstances
  - name: AppVersions
  - name: Apps
  - name: AsyncPredictions
  - name: AuditTrail
  - name: BillingTag
  - name: BillingTagSettings
  - name: Cost
  - name: CustomMetrics
  - name: DataSource
  - name: DatasetRw
  - name: DeploymentTargets
  - name: Environments
  - name: GenAI
  - name: HardwareTier
  - name: Jobs
  - name: ModelAPI
  - name: ModelAPIVersion
  - name: ModelDeployment
  - name: Organizations
  - name: PPM
  - name: ProjectSharedDatasets
  - name: ProjectTemplates
  - name: Projects
  - name: ProjectsFiles
  - name: RegisteredModels
  - name: ServiceAccounts
  - name: Users
  - name: Workspaces
paths:
  /api/environments/beta/environments:
    post:
      tags:
        - Environments
      summary: Create an environment
      description: >-
        Create an environment. Required permissions: `CreateEnvironment,
        EditEnvironment, UseFileStorage`. *Note:* This is a beta endpoint with
        known limitations.
      operationId: createEnvironment
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NewEnvironmentV1'
        description: Environment to create
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EnvironmentEnvelopeV1'
          description: Success
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
        '404':
          $ref: '#/components/responses/404'
        '500':
          $ref: '#/components/responses/500'
components:
  schemas:
    NewEnvironmentV1:
      allOf:
        - $ref: '#/components/schemas/NewEnvironmentRevisionV1'
        - properties:
            addBaseDependencies:
              description: Required for creating a new environment
              type: boolean
            description:
              type: string
            duplicateFromEnvironmentId:
              description: >-
                The id of the environment to duplicate. When specifying this
                property, no other properties in the payload must be set.
              type: string
            isCurated:
              type: boolean
            isRestricted:
              description: >-
                Specifies if an environment is restricted. Only users with
                ClassifyEnvironments permission can set this to true
              type: boolean
            name:
              description: Environment name. Required for creating a new environment
              type: string
            orgOwnerId:
              description: >-
                Sets an Organization as the Environment owner. Only used if
                visibility is 'Private', as 'Global' environments don't have
                owners.
              type: string
            rebuildOnBaseChanges:
              $ref: '#/components/schemas/EnvironmentRebuildOnBaseChangesV1'
            visibility:
              $ref: '#/components/schemas/NewEnvironmentVisibilityV1'
          type: object
    EnvironmentEnvelopeV1:
      properties:
        environment:
          $ref: '#/components/schemas/EnvironmentV1'
        metadata:
          $ref: '#/components/schemas/MetadataV1'
      required:
        - environment
        - metadata
      type: object
    NewEnvironmentRevisionV1:
      properties:
        dockerfileInstructions:
          type: string
        environmentVariables:
          items:
            $ref: '#/components/schemas/EnvironmentVariableV1'
          type: array
        image:
          description: Environment revision image. Required for creating a new environment
          type: string
        postRunScript:
          type: string
        postSetupScript:
          type: string
        preRunScript:
          type: string
        preSetupScript:
          type: string
        skipCache:
          type: boolean
        summary:
          type: string
        supportedClusters:
          items:
            $ref: '#/components/schemas/ClusterTypeV1'
          type: array
        tags:
          items:
            type: string
          type: array
        useVpn:
          type: boolean
        workspaceTools:
          items:
            $ref: '#/components/schemas/EnvironmentToolV1'
          type: array
      type: object
    EnvironmentRebuildOnBaseChangesV1:
      description: Whether to build a new revision when the base environment changes.
      enum:
        - never
        - followActive
      type: string
    NewEnvironmentVisibilityV1:
      description: Environment visibility. Required for creating a new environment
      enum:
        - global
        - private
      type: string
    EnvironmentV1:
      properties:
        activeRevisionTags:
          description: The tags on the active revision for this environment
          items:
            type: string
          type: array
        archived:
          description: Whether the environment is archived
          example: false
          type: boolean
        id:
          description: Id of environment
          example: 623132867a0af0281c01a69c
          type: string
        internalTags:
          description: The internal tags specifying if this environment is restricted
          items:
            type: string
          type: array
        isCurated:
          description: Whether or not the environment is curated for a deployment
          type: boolean
        latestRevision:
          $ref: '#/components/schemas/EnvironmentRevisionV1'
        name:
          example: MyOrg
          type: string
        owner:
          $ref: '#/components/schemas/EnvironmentOwnerV1'
        rebuildOnBaseChanges:
          $ref: '#/components/schemas/EnvironmentRebuildOnBaseChangesV1'
        restrictedRevision:
          $ref: '#/components/schemas/EnvironmentRevisionV1'
        selectedRevision:
          $ref: '#/components/schemas/EnvironmentRevisionV1'
        supportedClusters:
          items:
            $ref: '#/components/schemas/ClusterTypeV1'
          type: array
        visibility:
          $ref: '#/components/schemas/EnvironmentVisibilityV1'
      required:
        - id
        - name
        - visibility
        - rebuildOnBaseChanges
        - supportedClusters
        - archived
      type: object
    MetadataV1:
      properties:
        notices:
          description: Notices relating to the request
          items:
            type: string
          type: array
        requestId:
          type: string
      required:
        - requestId
        - notices
      type: object
    FailureEnvelopeV1:
      properties:
        errors:
          description: Errors that caused a request to fail
          items:
            type: string
          type: array
        requestId:
          description: Id used to correlate a request with server actions.
          example: bbd78579-93c4-45ee-a983-0d5c8da6d5b1
          type: string
      required:
        - requestId
        - errors
      type: object
    EnvironmentVariableV1:
      description: Key-value pair that defines an environment variable name and value
      properties:
        key:
          example: USERNAME
          type: string
        value:
          example: my_name
          type: string
      required:
        - key
        - value
      type: object
    ClusterTypeV1:
      description: Type of compute cluster
      enum:
        - dask
        - mpi
        - ray
        - spark
      type: string
    EnvironmentToolV1:
      properties:
        iconUrl:
          description: Url to pull icon image from
          example: /assets/images/workspace-logos/Jupyter.svg
          type: string
        name:
          description: Name of environment tool
          example: Jupyter
          type: string
        proxyConfig:
          $ref: '#/components/schemas/ProxyConfigV1'
        startScripts:
          items:
            description: Scripts to run on workspace start.
            example: echo hello
            type: string
          type: array
        supportedFileExtensions:
          items:
            description: File extensions this tool supports.
            example: .ipynb
            type: string
          type: array
        title:
          description: Title of environment tool.
          example: Jupyter
          type: string
      required:
        - name
        - title
        - startScripts
      type: object
    EnvironmentRevisionV1:
      properties:
        availableTools:
          items:
            $ref: '#/components/schemas/EnvironmentToolV1'
          type: array
        id:
          description: Id of Environment Revision.
          example: 62313cfd7a0af0281c01a6a6
          type: string
        number:
          description: Revision number, increasing sequentially with each revision.
          example: 4
          type: integer
        status:
          $ref: '#/components/schemas/EnvironmentRevisionBuildStatusV1'
      required:
        - id
        - number
        - availableTools
      type: object
    EnvironmentOwnerV1:
      properties:
        id:
          description: Id of owner of an environment.
          example: 6231327c7a0af0281c01a69b
          type: string
        ownerType:
          $ref: '#/components/schemas/EnvironmentOwnerTypeV1'
        username:
          description: Username of owner of an environment.
          example: OrgOwner
          type: string
      required:
        - id
        - username
        - ownerType
      type: object
    EnvironmentVisibilityV1:
      description: >-
        Visibility of an environment. Private Environments are only visible to
        the creating user, whereas Organization owned Environments can be seen
        by all Org members.
      enum:
        - global
        - private
        - organization
      type: string
    ProxyConfigV1:
      properties:
        internalPath:
          description: Path to find workspace at. Used internally.
          example: >-
            /{{ownerUsername}}/{{projectName}}/{{sessionPathComponent}}/{{runId}}/{{#if
            pathToOpen}}tree/{{pathToOpen}}{{/if}}
          type: string
        port:
          description: Port to run this tool on.
          example: 8888
          type: integer
        requireSubdomain:
          description: >-
            Whether workspace requires subdomains. Subdomain workspaces only
            work if deployment is configured to support subdomains. Defaults to
            false.
          example: false
          type: boolean
        rewrite:
          description: If url rewriting is necessary for routing. Defaults to false
          example: false
          type: boolean
      required:
        - internalPath
        - port
      type: object
    EnvironmentRevisionBuildStatusV1:
      description: Status of the build for an Environment Revision.
      enum:
        - queued
        - starting
        - pulling
        - building
        - pushing
        - succeeded
        - failed
        - killed
      type: string
    EnvironmentOwnerTypeV1:
      description: >-
        Type of owner for an Environment. Environments can either be owned by a
        normal user or by an Organization.
      enum:
        - individual
        - organization
      type: string
  responses:
    '400':
      content:
        application/json:
          schema:
            properties:
              error:
                type: string
            type: object
      description: Bad Request
    '401':
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/FailureEnvelopeV1'
      description: >-
        The current user cannot perform this operation because they are not
        logged in
    '403':
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/FailureEnvelopeV1'
      description: The current user is not authorized to perform this operation
    '404':
      content:
        application/json:
          schema:
            properties:
              error:
                type: string
            type: object
      description: Not Found
    '500':
      content:
        application/json:
          schema:
            properties:
              error:
                type: string
            type: object
      description: Internal Server Error
  securitySchemes:
    DominoApiKey:
      in: header
      name: X-Domino-Api-Key
      type: apiKey
    BearerAuthentication:
      in: header
      name: Authorization
      type: apiKey

````