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

# Sync environments from YAML

> Upserts the scoped project's environments from its environments.yaml file and flags the project as YAML-managed.



## OpenAPI

````yaml /api-reference/openapi.generated.json post /api/environments/sync
openapi: 3.1.0
info:
  title: Empirical API
  version: 1.0.0
  description: Programmatic access to Empirical test runs, snoozes, and more.
  contact:
    name: Empirical
    url: https://empirical.run
servers:
  - url: https://api.empirical.run
security:
  - Bearer: []
tags:
  - name: Analytics
    description: Aggregated test-run, test-count and test-case analytics for a project.
  - name: Analytics (Deprecated)
    description: >-
      Legacy analytics endpoints retained for backwards compatibility; prefer
      the v2 equivalents.
  - name: Environments
    description: >-
      Named deployment targets (slug + Playwright project filters) a project's
      tests run against.
  - name: Snoozes
    description: Temporarily suppress known test failures for specific Playwright tests.
  - name: Telemetry
    description: Product telemetry derived from analytics events, scoped to a project.
  - name: Test Cases
    description: >-
      Browse the Playwright test cases synced from a project's repository and
      manage their tags.
paths:
  /api/environments/sync:
    post:
      tags:
        - Environments
      summary: Sync environments from YAML
      description: >-
        Upserts the scoped project's environments from its environments.yaml
        file and flags the project as YAML-managed.
      operationId: syncEnvironments
      responses:
        '200':
          description: Sync succeeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EnvironmentSyncResponse'
        '400':
          description: Invalid environments.yaml.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Project not found or not accessible.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    EnvironmentSyncResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            success:
              type: boolean
              description: Always true on success.
          required:
            - success
          description: Response payload.
      required:
        - data
    ErrorResponse:
      type: object
      properties:
        data:
          nullable: true
          description: Always null for error responses.
        error:
          type: object
          properties:
            message:
              type: string
              description: Human-readable error message.
          required:
            - message
          description: Error details.
      required:
        - data
        - error
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer

````