---
title: "Publish resources to target environment"
method: POST
path: "/v2/environments/{targetEnvironmentId}/publish"
tags: ["Environments"]
---

# Publish resources to target environment

`POST /v2/environments/{targetEnvironmentId}/publish`

## Request

- Base URL: `https://api.notifly.io`
- URL: `https://api.notifly.io/v2/environments/{targetEnvironmentId}/publish`
- Auth: API key in header `Authorization`

Publishes all workflows and resources from the source environment to the target environment. Optionally specify specific resources to publish or use dryRun mode to preview changes.

## Path parameters

- `targetEnvironmentId` string, required

## Request body

- PublishEnvironmentRequestDto
  - `sourceEnvironmentId` string: Source environment ID to sync from. Defaults to the Development environment if not provided.
  - `dryRun` boolean: Perform a dry run without making actual changes
  - `resources` ResourceToPublishDto[]: Array of specific resources to publish. If not provided, all resources will be published.
    - `resourceType` 'REGULAR' | 'ECHO' | 'BRIDGE', required: Type of the layout
    - `resourceId` string, required: Unique identifier of the resource to publish

## Response `200`

OK

- object
  - `data` PublishEnvironmentResponseDto
    - `results` SyncResultDto[], required: Sync results by resource type
      - `resourceType` 'REGULAR' | 'ECHO' | 'BRIDGE', required: Type of the layout
      - `successful` SyncedWorkflowDto[], required: Successfully synced resources
        - `resourceType` 'REGULAR' | 'ECHO' | 'BRIDGE', required: Type of the layout
        - `resourceId` string, required: Resource ID
        - `resourceName` string, required: Resource name
        - `action` 'created' | 'updated' | 'skipped' | 'deleted', required: Sync action performed
      - `failed` FailedWorkflowDto[], required: Failed resource syncs
        - `resourceType` 'REGULAR' | 'ECHO' | 'BRIDGE', required: Type of the layout
        - `resourceId` string, required: Resource ID
        - `resourceName` string, required: Resource name
        - `error` string, required: Error message
        - `stack` string: Error stack trace
      - `skipped` SkippedWorkflowDto[], required: Skipped resources
        - `resourceType` 'REGULAR' | 'ECHO' | 'BRIDGE', required: Type of the layout
        - `resourceId` string, required: Resource ID
        - `resourceName` string, required: Resource name
        - `reason` string, required: Reason for skipping
      - `totalProcessed` number, required: Total number of resources processed
    - `summary` PublishSummaryDto, required
      - `resources` number, required: Number of resources processed
      - `successful` number, required: Number of successful syncs
      - `failed` number, required: Number of failed syncs
      - `skipped` number, required: Number of skipped resources

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not Found
- `405`: Method Not Allowed
- `409`: Conflict
- `413`: Payload Too Large
- `414`: URI Too Long
- `415`: Unsupported Media Type
- `422`: Unprocessable Entity
- `429`: The client has sent too many requests in a given amount of time.
- `500`: Internal Server Error
- `503`: The server is currently unable to handle the request due to a temporary overload or scheduled maintenance, which will likely be alleviated after some delay.

---

[API](https://skmtc.dev/notifly/apis/notifly-api.md) · [All operations](https://skmtc.dev/notifly/apis/notifly-api/llms.txt) · [OpenAPI document](https://skmtc.dev/notifly/apis/notifly-api/revisions/af909b9e1e57?raw)
