---
title: "UpsertAutomationsFile"
method: POST
path: "/gitpod.v1.EnvironmentAutomationService/UpsertAutomationsFile"
tags: ["gitpod.v1.EnvironmentAutomationService"]
---

# UpsertAutomationsFile

`POST /gitpod.v1.EnvironmentAutomationService/UpsertAutomationsFile`

Upserts the automations file for the given environment.

 Use this method to:
 - Configure environment automations
 - Update automation settings
 - Manage automation files

 ### Examples

 - Update automations file:

   Updates or creates the automations configuration.

   ```yaml
   environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048"
   automationsFile:
     services:
       web-server:
         name: "Web Server"
         description: "Development web server"
         commands:
           start: "npm run dev"
           ready: "curl -s http://localhost:3000"
         triggeredBy:
           - postDevcontainerStart
     tasks:
       build:
         name: "Build Project"
         description: "Builds the project artifacts"
         command: "npm run build"
         triggeredBy:
           - postEnvironmentStart
   ```

## Request body

- GitpodV1UpsertAutomationsFileRequest
  - `automationsFile` GitpodV1AutomationsFile — WARN: Do not remove any field here, as it will break reading automation yaml files. We error if there are any unknown fields in the yaml (to ensure the yaml is correct), but would break if we removed any fields. This includes marking a field as "reserved" in the proto file, this will also break reading the yaml.
    - `services` object
    - `tasks` object
  - `environmentId` string, uuid

## Response `200`

Success

- GitpodV1UpsertAutomationsFileResponse
  - `updatedServiceIds` string[]
  - `updatedTaskIds` string[]

## Other responses

- `default` — Error

---

[API](https://skmtc.net/gitpod-io/apis/gitpod-v1.md) · [All operations](https://skmtc.net/gitpod-io/apis/gitpod-v1/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/gitpod-io/gitpod-v1/revisions/44d50c2ac284/schema)
