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

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.kosli.com/feedback

```json
{
  "path": "/api-reference/environments/create-or-update-environment",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

# Create or update environment

> Create or update an Environment for an organization.



## OpenAPI

````yaml https://app.kosli.com/api/v2/openapi.json put /environments/{org}
openapi: 3.1.0
info:
  title: Kosli API
  summary: The API for communicating with Kosli
  description: >

    # Authentication 


    When making requests against Kosli API, you can authenticate your requests
    using a bearer token. 

    Set the bearer token in the request Authorization header to a valid API
    key. 

    API Keys can be personal or for service accounts. Check the [service
    accounts
    documentation](https://docs.kosli.com/getting_started/service-accounts/) for
    details. 


    ## Curl example


    ```shell

    curl -H "Authorization: Bearer <<your-api-key>>"
    https://app.kosli.com/api/v2/environments/<<your-org-name>>

    ```
  version: '2.0'
servers:
  - url: https://app.kosli.com/api/v2
    description: EU
  - url: https://app.us.kosli.com/api/v2
    description: US
security:
  - HTTPBearer: []
paths:
  /environments/{org}:
    put:
      tags:
        - Environments
      summary: Create or update environment
      description: Create or update an Environment for an organization.
      operationId: create_env_environments__org__put
      parameters:
        - name: org
          in: path
          required: true
          schema:
            type: string
            title: Org
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateEnvironmentPutInput'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema: {}
      security:
        - HTTPBearer: []
        - HTTPBasic: []
components:
  schemas:
    CreateEnvironmentPutInput:
      properties:
        name:
          type: string
          pattern: ^[a-zA-Z0-9][a-zA-Z0-9\.\-_]*$
          title: Name
        type:
          type: string
          enum:
            - K8S
            - ECS
            - S3
            - lambda
            - server
            - docker
            - azure-apps
            - cloud-run
            - logical
          title: Type
        description:
          type: string
          title: Description
        include_scaling:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Include Scaling
        require_provenance:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Require Provenance
          description: >-
            This field is deprecated and will be removed in a future version.
            Use policies instead.
          deprecated: true
        included_environments:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Included Environments
        policies:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Policies
      additionalProperties: false
      type: object
      required:
        - name
        - type
        - description
      title: CreateEnvironmentPutInput
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````