---
title: "Update a source swap policy"
method: PATCH
path: "/v2/sourceSwapPolicies/{policyId}"
tags: ["Source swap policies"]
---

# Update a source swap policy

`PATCH /v2/sourceSwapPolicies/{policyId}`

## Request

- Base URL: `https://api.sigmacomputing.com`
- URL: `https://api.sigmacomputing.com/v2/sourceSwapPolicies/{policyId}`
- Auth: HTTP bearer

Update a source swap policy.

  **Beta**: Updating a **Connection** source swap policy is in private beta and must be enabled for your organization. This documentation is subject to the [Beta features](/docs/sigma-product-releases#beta-features) disclaimer.

  ### Usage notes
  - Retrieve the **policyId** by calling the [/v2/sourceSwapPolicies](https://help.sigmacomputing.com/reference/list-source-swap-policies) endpoint.
  - Retrieve the **connectionId** to use as the **fromConnectionId** by calling the [/v2/connections](https://help.sigmacomputing.com/reference/list-connections) endpoint.
  - Retrieve the **userAttributeId** to use in the **swaps** object by calling the [/v2/user-attributes](https://help.sigmacomputing.com/reference/list-user-attributes) endpoint.

## Path parameters

- `policyId` string, required

## Request body

- union: Update source swap policy request
  - SourceSwapPoliciesUpdateSourceSwapPolicyRequest0: Connection swap policy
    - `type` 'connection'
    - `name` string: Name of the source swap policy.
    - `fromConnectionId` string: ID of the connection to swap.
    - `swaps` V2SourceSwapPoliciesPolicyIdPatchRequestBodyContentApplicationJsonSchemaOneOf0Swaps
      - `connectionSwaps` V2SourceSwapPoliciesPolicyIdPatchRequestBodyContentApplicationJsonSchemaOneOf0SwapsConnectionSwapsItems[], required: Swap paths to a different location in the same connection.
        - `to` V2SourceSwapPoliciesPolicyIdPatchRequestBodyContentApplicationJsonSchemaOneOf0SwapsConnectionSwapsItemsTo, required: Specify how to swap each segment of a path to a table in your database, catalog, or project. `path0` is equivalent to a database, catalog, or project. `path` is equivalent to a schema or dataset, and `path2` is equivalent to a table or view.
          - `path0` union, required: The rule used to update this specific path value when the swap is performed. If the specified path (when resolved) does not exist, the swap is not performed.
            - V2SourceSwapPoliciesPolicyIdPatchRequestBodyContentApplicationJsonSchemaOneOf0SwapsConnectionSwapsItemsToPath00
              - …
            - V2SourceSwapPoliciesPolicyIdPatchRequestBodyContentApplicationJsonSchemaOneOf0SwapsConnectionSwapsItemsToPath01
              - …
            - V2SourceSwapPoliciesPolicyIdPatchRequestBodyContentApplicationJsonSchemaOneOf0SwapsConnectionSwapsItemsToPath02
              - …
          - `path1` union, required: The rule used to update this specific path value when the swap is performed. If the specified path (when resolved) does not exist, the swap is not performed.
            - V2SourceSwapPoliciesPolicyIdPatchRequestBodyContentApplicationJsonSchemaOneOf0SwapsConnectionSwapsItemsToPath10
              - …
            - V2SourceSwapPoliciesPolicyIdPatchRequestBodyContentApplicationJsonSchemaOneOf0SwapsConnectionSwapsItemsToPath11
              - …
            - V2SourceSwapPoliciesPolicyIdPatchRequestBodyContentApplicationJsonSchemaOneOf0SwapsConnectionSwapsItemsToPath12
              - …
          - `path2` union: The rule used to update this specific path value when the swap is performed. If the specified path (when resolved) does not exist, the swap is not performed.
            - V2SourceSwapPoliciesPolicyIdPatchRequestBodyContentApplicationJsonSchemaOneOf0SwapsConnectionSwapsItemsToPath20
              - …
            - V2SourceSwapPoliciesPolicyIdPatchRequestBodyContentApplicationJsonSchemaOneOf0SwapsConnectionSwapsItemsToPath21
              - …
            - V2SourceSwapPoliciesPolicyIdPatchRequestBodyContentApplicationJsonSchemaOneOf0SwapsConnectionSwapsItemsToPath22
              - …
  - SourceSwapPoliciesUpdateSourceSwapPolicyRequest1: Deployment swap policy
    - `type` 'deployment'
    - `name` string: Name of the source swap policy.
    - `fromConnectionId` string: ID of the connection to swap.
    - `swaps` V2SourceSwapPoliciesPolicyIdPatchRequestBodyContentApplicationJsonSchemaOneOf1Swaps
      - `toConnection` V2SourceSwapPoliciesPolicyIdPatchRequestBodyContentApplicationJsonSchemaOneOf1SwapsToConnection, required
        - `swapType` 'attribute', required: Specify a user attribute to use the value of the user attribute as the value to swap.
        - `userAttributeId` string, required
      - `deploymentSwaps` V2SourceSwapPoliciesPolicyIdPatchRequestBodyContentApplicationJsonSchemaOneOf1SwapsDeploymentSwapsItems[], required
        - `from` V2SourceSwapPoliciesPolicyIdPatchRequestBodyContentApplicationJsonSchemaOneOf1SwapsDeploymentSwapsItemsFrom, required
          - `path0` union, required
            - V2SourceSwapPoliciesPolicyIdPatchRequestBodyContentApplicationJsonSchemaOneOf1SwapsDeploymentSwapsItemsFromPath00
              - …
            - V2SourceSwapPoliciesPolicyIdPatchRequestBodyContentApplicationJsonSchemaOneOf1SwapsDeploymentSwapsItemsFromPath01
              - …
          - `path1` union, required
            - V2SourceSwapPoliciesPolicyIdPatchRequestBodyContentApplicationJsonSchemaOneOf1SwapsDeploymentSwapsItemsFromPath10
              - …
            - V2SourceSwapPoliciesPolicyIdPatchRequestBodyContentApplicationJsonSchemaOneOf1SwapsDeploymentSwapsItemsFromPath11
              - …
          - `path2` union
            - V2SourceSwapPoliciesPolicyIdPatchRequestBodyContentApplicationJsonSchemaOneOf1SwapsDeploymentSwapsItemsFromPath20
              - …
            - V2SourceSwapPoliciesPolicyIdPatchRequestBodyContentApplicationJsonSchemaOneOf1SwapsDeploymentSwapsItemsFromPath21
              - …
        - `to` V2SourceSwapPoliciesPolicyIdPatchRequestBodyContentApplicationJsonSchemaOneOf1SwapsDeploymentSwapsItemsTo, required
          - `path0` union, required: The rule used to update this specific path value when the swap is performed. If the specified path (when resolved) does not exist, the swap is not performed.
            - V2SourceSwapPoliciesPolicyIdPatchRequestBodyContentApplicationJsonSchemaOneOf1SwapsDeploymentSwapsItemsToPath00
              - …
            - V2SourceSwapPoliciesPolicyIdPatchRequestBodyContentApplicationJsonSchemaOneOf1SwapsDeploymentSwapsItemsToPath01
              - …
            - V2SourceSwapPoliciesPolicyIdPatchRequestBodyContentApplicationJsonSchemaOneOf1SwapsDeploymentSwapsItemsToPath02
              - …
          - `path1` union, required: The rule used to update this specific path value when the swap is performed. If the specified path (when resolved) does not exist, the swap is not performed.
            - V2SourceSwapPoliciesPolicyIdPatchRequestBodyContentApplicationJsonSchemaOneOf1SwapsDeploymentSwapsItemsToPath10
              - …
            - V2SourceSwapPoliciesPolicyIdPatchRequestBodyContentApplicationJsonSchemaOneOf1SwapsDeploymentSwapsItemsToPath11
              - …
            - V2SourceSwapPoliciesPolicyIdPatchRequestBodyContentApplicationJsonSchemaOneOf1SwapsDeploymentSwapsItemsToPath12
              - …
          - `path2` union: The rule used to update this specific path value when the swap is performed. If the specified path (when resolved) does not exist, the swap is not performed.
            - V2SourceSwapPoliciesPolicyIdPatchRequestBodyContentApplicationJsonSchemaOneOf1SwapsDeploymentSwapsItemsToPath20
              - …
            - V2SourceSwapPoliciesPolicyIdPatchRequestBodyContentApplicationJsonSchemaOneOf1SwapsDeploymentSwapsItemsToPath21
              - …
            - V2SourceSwapPoliciesPolicyIdPatchRequestBodyContentApplicationJsonSchemaOneOf1SwapsDeploymentSwapsItemsToPath22
              - …

## Response `200`

Source Swap Policy Response

- SourceSwapPoliciesUpdateSourceSwapPolicyResponse200: Source Swap Policy Response
  - `policyId` string, required: Unique identifier of the source swap policy.

---

[API](https://skmtc.dev/sigmacomputing/apis/sigma-rest-api.md) - [All operations](https://skmtc.dev/sigmacomputing/apis/sigma-rest-api/llms.txt) - [OpenAPI document](https://skmtc.dev/sigmacomputing/apis/sigma-rest-api/revisions/fb6036208c49?raw)
