> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://help.sigmacomputing.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://help.sigmacomputing.com/_mcp/server.

# Create a source swap policy

POST https://api.sigmacomputing.com/v2/sourceSwapPolicies
Content-Type: application/json

Create a source swap policy.

  **Beta**: Creating 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 **connectionId** to use as the **fromConnectionId** by calling the [/v2/connections](/reference/list-connections) endpoint.
  - Retrieve the **userAttributeId** to use in the **swaps** object by calling the [/v2/user-attributes](/reference/list-user-attributes) endpoint.
  

Reference: https://help.sigmacomputing.com/reference/create-source-swap-policy

## Authentication

- OAuth2 — send the obtained token as `Authorization: Bearer <token>`

## Servers

- `https://api.sigmacomputing.com` (Server for GCP (US) hosted organizations, default)
- `https://api.sa.gcp.sigmacomputing.com` (Server for GCP (KSA) hosted organizations)
- `https://aws-api.sigmacomputing.com` (Server for AWS US (West) hosted organizations)
- `https://api.us-a.aws.sigmacomputing.com` (Server for AWS US (East) hosted organizations)
- `https://api.ca.aws.sigmacomputing.com` (Server for AWS Canada hosted organizations)
- `https://api.eu.aws.sigmacomputing.com` (Server for AWS Europe (Frankfurt) hosted organizations)
- `https://api.ch.aws.sigmacomputing.com` (Server for AWS Europe (Zurich) hosted organizations)
- `https://api.au.aws.sigmacomputing.com` (Server for AWS Australia and APAC hosted organizations)
- `https://api.uk.aws.sigmacomputing.com` (Server for AWS UK hosted organizations)
- `https://api.in.aws.sigmacomputing.com` (Server for AWS Asia Pacific (Mumbai) hosted organizations)
- `https://api.us.azure.sigmacomputing.com` (Server for Azure US hosted organizations)
- `https://api.eu.azure.sigmacomputing.com` (Server for Azure Europe hosted organizations)
- `https://api.ca.azure.sigmacomputing.com` (Server for Azure Canada hosted organizations)
- `https://api.uk.azure.sigmacomputing.com` (Server for Azure United Kingdom hosted organizations)
- `https://api.au.azure.sigmacomputing.com` (Server for Azure Australia hosted organizations)

## Request

### Body (application/json)

This endpoint expects a sourceSwapPolicies_createSourceSwapPolicy_Request.

- `sourceSwapPolicies_createSourceSwapPolicy_Request`
  - Connection swap: Connection swap
  - Deployment swap: Deployment swap

## Response

### 200

Source Swap Policy Response

- `policyId` (string, required) — Unique identifier of the source swap policy.

## Types

### Connection swap

- `type` (enum, required)
  - Allowed values: `connection`
- `name` (string, required) — Name of the source swap policy.
- `fromConnectionId` (string, required) — ID of the connection to swap.
- `swaps` (V2SourceSwapPoliciesPostRequestBodyContentApplicationJsonSchemaOneOf0Swaps, required)

### Deployment swap

- `type` (enum, required)
  - Allowed values: `deployment`
- `name` (string, required) — Name of the source swap policy.
- `fromConnectionId` (string, required) — ID of the connection to swap.
- `swaps` (V2SourceSwapPoliciesPostRequestBodyContentApplicationJsonSchemaOneOf1Swaps, required)

### V2SourceSwapPoliciesPostRequestBodyContentApplicationJsonSchemaOneOf0Swaps

- `connectionSwaps` (list of V2SourceSwapPoliciesPostRequestBodyContentApplicationJsonSchemaOneOf0SwapsConnectionSwapsItems, required) — Swap paths to a different location in the same connection.

### V2SourceSwapPoliciesPostRequestBodyContentApplicationJsonSchemaOneOf1Swaps

- `toConnection` (V2SourceSwapPoliciesPostRequestBodyContentApplicationJsonSchemaOneOf1SwapsToConnection, required)
- `deploymentSwaps` (list of V2SourceSwapPoliciesPostRequestBodyContentApplicationJsonSchemaOneOf1SwapsDeploymentSwapsItems, required)

### V2SourceSwapPoliciesPostRequestBodyContentApplicationJsonSchemaOneOf0SwapsConnectionSwapsItems

- `to` (V2SourceSwapPoliciesPostRequestBodyContentApplicationJsonSchemaOneOf0SwapsConnectionSwapsItemsTo, 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.

### V2SourceSwapPoliciesPostRequestBodyContentApplicationJsonSchemaOneOf1SwapsToConnection

- `swapType` (enum, required) — Specify a user attribute to use the value of the user attribute as the value to swap.
  - Allowed values: `attribute`
- `userAttributeId` (string, required)

### V2SourceSwapPoliciesPostRequestBodyContentApplicationJsonSchemaOneOf1SwapsDeploymentSwapsItems

- `from` (V2SourceSwapPoliciesPostRequestBodyContentApplicationJsonSchemaOneOf1SwapsDeploymentSwapsItemsFrom, required)
- `to` (V2SourceSwapPoliciesPostRequestBodyContentApplicationJsonSchemaOneOf1SwapsDeploymentSwapsItemsTo, required)

### V2SourceSwapPoliciesPostRequestBodyContentApplicationJsonSchemaOneOf0SwapsConnectionSwapsItemsTo

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` (V2SourceSwapPoliciesPostRequestBodyContentApplicationJsonSchemaOneOf0SwapsConnectionSwapsItemsToPath0, 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.
- `path1` (V2SourceSwapPoliciesPostRequestBodyContentApplicationJsonSchemaOneOf0SwapsConnectionSwapsItemsToPath1, 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.
- `path2` (V2SourceSwapPoliciesPostRequestBodyContentApplicationJsonSchemaOneOf0SwapsConnectionSwapsItemsToPath2, optional) — 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.

### V2SourceSwapPoliciesPostRequestBodyContentApplicationJsonSchemaOneOf1SwapsDeploymentSwapsItemsFrom

- `path0` (V2SourceSwapPoliciesPostRequestBodyContentApplicationJsonSchemaOneOf1SwapsDeploymentSwapsItemsFromPath0, required)
- `path1` (V2SourceSwapPoliciesPostRequestBodyContentApplicationJsonSchemaOneOf1SwapsDeploymentSwapsItemsFromPath1, required)
- `path2` (V2SourceSwapPoliciesPostRequestBodyContentApplicationJsonSchemaOneOf1SwapsDeploymentSwapsItemsFromPath2, optional)

### V2SourceSwapPoliciesPostRequestBodyContentApplicationJsonSchemaOneOf1SwapsDeploymentSwapsItemsTo

- `path0` (V2SourceSwapPoliciesPostRequestBodyContentApplicationJsonSchemaOneOf1SwapsDeploymentSwapsItemsToPath0, 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.
- `path1` (V2SourceSwapPoliciesPostRequestBodyContentApplicationJsonSchemaOneOf1SwapsDeploymentSwapsItemsToPath1, 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.
- `path2` (V2SourceSwapPoliciesPostRequestBodyContentApplicationJsonSchemaOneOf1SwapsDeploymentSwapsItemsToPath2, optional) — 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.

### V2SourceSwapPoliciesPostRequestBodyContentApplicationJsonSchemaOneOf0SwapsConnectionSwapsItemsToPath0

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.

- User attribute: User attribute
- Specific path: Specific path
- No changes: No changes

### V2SourceSwapPoliciesPostRequestBodyContentApplicationJsonSchemaOneOf0SwapsConnectionSwapsItemsToPath1

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.

- User attribute: User attribute
- Specific path: Specific path
- No changes: No changes

### V2SourceSwapPoliciesPostRequestBodyContentApplicationJsonSchemaOneOf0SwapsConnectionSwapsItemsToPath2

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.

- User attribute: User attribute
- Specific path: Specific path
- No changes: No changes

### V2SourceSwapPoliciesPostRequestBodyContentApplicationJsonSchemaOneOf1SwapsDeploymentSwapsItemsFromPath0

- No changes: No changes
- Specific path: Specific path

### V2SourceSwapPoliciesPostRequestBodyContentApplicationJsonSchemaOneOf1SwapsDeploymentSwapsItemsFromPath1

- No changes: No changes
- Specific path: Specific path

### V2SourceSwapPoliciesPostRequestBodyContentApplicationJsonSchemaOneOf1SwapsDeploymentSwapsItemsFromPath2

- No changes: No changes
- Specific path: Specific path

### V2SourceSwapPoliciesPostRequestBodyContentApplicationJsonSchemaOneOf1SwapsDeploymentSwapsItemsToPath0

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.

- User attribute: User attribute
- Specific path: Specific path
- No changes: No changes

### V2SourceSwapPoliciesPostRequestBodyContentApplicationJsonSchemaOneOf1SwapsDeploymentSwapsItemsToPath1

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.

- User attribute: User attribute
- Specific path: Specific path
- No changes: No changes

### V2SourceSwapPoliciesPostRequestBodyContentApplicationJsonSchemaOneOf1SwapsDeploymentSwapsItemsToPath2

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.

- User attribute: User attribute
- Specific path: Specific path
- No changes: No changes

### User attribute

- `swapType` (enum, required) — Specify a user attribute to use the value of the user attribute as the value to swap.
  - Allowed values: `attribute`
- `userAttributeId` (string, required)

### Specific path

- `swapType` (enum, required) — Specify the value in the path to swap to
  - Allowed values: `exact`
- `catalogObject` (string, required)

### No changes

- `swapType` (enum, required) — Keep the current path value.
  - Allowed values: `all`

### User attribute

- `swapType` (enum, required) — Specify a user attribute to use the value of the user attribute as the value to swap.
  - Allowed values: `attribute`
- `userAttributeId` (string, required)

### Specific path

- `swapType` (enum, required) — Specify the value in the path to swap to
  - Allowed values: `exact`
- `catalogObject` (string, required)

### No changes

- `swapType` (enum, required) — Keep the current path value.
  - Allowed values: `all`

### User attribute

- `swapType` (enum, required) — Specify a user attribute to use the value of the user attribute as the value to swap.
  - Allowed values: `attribute`
- `userAttributeId` (string, required)

### Specific path

- `swapType` (enum, required) — Specify the value in the path to swap to
  - Allowed values: `exact`
- `catalogObject` (string, required)

### No changes

- `swapType` (enum, required) — Keep the current path value.
  - Allowed values: `all`

### No changes

- `swapType` (enum, required) — Keep the current path value.
  - Allowed values: `all`

### Specific path

- `swapType` (enum, required) — Specify the value in the path to swap to
  - Allowed values: `exact`
- `catalogObject` (string, required)

### No changes

- `swapType` (enum, required) — Keep the current path value.
  - Allowed values: `all`

### Specific path

- `swapType` (enum, required) — Specify the value in the path to swap to
  - Allowed values: `exact`
- `catalogObject` (string, required)

### No changes

- `swapType` (enum, required) — Keep the current path value.
  - Allowed values: `all`

### Specific path

- `swapType` (enum, required) — Specify the value in the path to swap to
  - Allowed values: `exact`
- `catalogObject` (string, required)

### User attribute

- `swapType` (enum, required) — Specify a user attribute to use the value of the user attribute as the value to swap.
  - Allowed values: `attribute`
- `userAttributeId` (string, required)

### Specific path

- `swapType` (enum, required) — Specify the value in the path to swap to
  - Allowed values: `exact`
- `catalogObject` (string, required)

### No changes

- `swapType` (enum, required) — Keep the current path value.
  - Allowed values: `all`

### User attribute

- `swapType` (enum, required) — Specify a user attribute to use the value of the user attribute as the value to swap.
  - Allowed values: `attribute`
- `userAttributeId` (string, required)

### Specific path

- `swapType` (enum, required) — Specify the value in the path to swap to
  - Allowed values: `exact`
- `catalogObject` (string, required)

### No changes

- `swapType` (enum, required) — Keep the current path value.
  - Allowed values: `all`

### User attribute

- `swapType` (enum, required) — Specify a user attribute to use the value of the user attribute as the value to swap.
  - Allowed values: `attribute`
- `userAttributeId` (string, required)

### Specific path

- `swapType` (enum, required) — Specify the value in the path to swap to
  - Allowed values: `exact`
- `catalogObject` (string, required)

### No changes

- `swapType` (enum, required) — Keep the current path value.
  - Allowed values: `all`

## Examples

### Swap tenant connections

**Request**

```json
{
  "fromConnectionId": "9f2a6b1e-4c3d-4a8f-9e21-6d7c8b3a51f0",
  "name": "Tenant Snowflake Swap",
  "swaps": {
    "deploymentSwaps": [],
    "toConnection": {
      "swapType": "attribute",
      "userAttributeId": "e4b7c2a1-9d3f-4e6b-8a2c-5f1d9e3b7a4c"
    }
  },
  "type": "deployment"
}
```

**Response**

```json
{
  "policyId": "2a6f8b3d-5c1e-4a9b-8d3f-7e2c4b6a9f1d"
}
```

**SDK Code**

```python Swap tenant connections
import requests

url = "https://api.sigmacomputing.com/v2/sourceSwapPolicies"

payload = {
    "fromConnectionId": "9f2a6b1e-4c3d-4a8f-9e21-6d7c8b3a51f0",
    "name": "Tenant Snowflake Swap",
    "swaps": {
        "deploymentSwaps": [],
        "toConnection": {
            "swapType": "attribute",
            "userAttributeId": "e4b7c2a1-9d3f-4e6b-8a2c-5f1d9e3b7a4c"
        }
    },
    "type": "deployment"
}
headers = {
    "Authorization": "<token>.",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Swap tenant connections
const url = 'https://api.sigmacomputing.com/v2/sourceSwapPolicies';
const options = {
  method: 'POST',
  headers: {Authorization: '<token>.', 'Content-Type': 'application/json'},
  body: '{"fromConnectionId":"9f2a6b1e-4c3d-4a8f-9e21-6d7c8b3a51f0","name":"Tenant Snowflake Swap","swaps":{"deploymentSwaps":[],"toConnection":{"swapType":"attribute","userAttributeId":"e4b7c2a1-9d3f-4e6b-8a2c-5f1d9e3b7a4c"}},"type":"deployment"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Swap tenant connections
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.sigmacomputing.com/v2/sourceSwapPolicies"

	payload := strings.NewReader("{\n  \"fromConnectionId\": \"9f2a6b1e-4c3d-4a8f-9e21-6d7c8b3a51f0\",\n  \"name\": \"Tenant Snowflake Swap\",\n  \"swaps\": {\n    \"deploymentSwaps\": [],\n    \"toConnection\": {\n      \"swapType\": \"attribute\",\n      \"userAttributeId\": \"e4b7c2a1-9d3f-4e6b-8a2c-5f1d9e3b7a4c\"\n    }\n  },\n  \"type\": \"deployment\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "<token>.")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Swap tenant connections
require 'uri'
require 'net/http'

url = URI("https://api.sigmacomputing.com/v2/sourceSwapPolicies")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = '<token>.'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"fromConnectionId\": \"9f2a6b1e-4c3d-4a8f-9e21-6d7c8b3a51f0\",\n  \"name\": \"Tenant Snowflake Swap\",\n  \"swaps\": {\n    \"deploymentSwaps\": [],\n    \"toConnection\": {\n      \"swapType\": \"attribute\",\n      \"userAttributeId\": \"e4b7c2a1-9d3f-4e6b-8a2c-5f1d9e3b7a4c\"\n    }\n  },\n  \"type\": \"deployment\"\n}"

response = http.request(request)
puts response.read_body
```

```java Swap tenant connections
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.sigmacomputing.com/v2/sourceSwapPolicies")
  .header("Authorization", "<token>.")
  .header("Content-Type", "application/json")
  .body("{\n  \"fromConnectionId\": \"9f2a6b1e-4c3d-4a8f-9e21-6d7c8b3a51f0\",\n  \"name\": \"Tenant Snowflake Swap\",\n  \"swaps\": {\n    \"deploymentSwaps\": [],\n    \"toConnection\": {\n      \"swapType\": \"attribute\",\n      \"userAttributeId\": \"e4b7c2a1-9d3f-4e6b-8a2c-5f1d9e3b7a4c\"\n    }\n  },\n  \"type\": \"deployment\"\n}")
  .asString();
```

```php Swap tenant connections
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.sigmacomputing.com/v2/sourceSwapPolicies', [
  'body' => '{
  "fromConnectionId": "9f2a6b1e-4c3d-4a8f-9e21-6d7c8b3a51f0",
  "name": "Tenant Snowflake Swap",
  "swaps": {
    "deploymentSwaps": [],
    "toConnection": {
      "swapType": "attribute",
      "userAttributeId": "e4b7c2a1-9d3f-4e6b-8a2c-5f1d9e3b7a4c"
    }
  },
  "type": "deployment"
}',
  'headers' => [
    'Authorization' => '<token>.',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Swap tenant connections
using RestSharp;

var client = new RestClient("https://api.sigmacomputing.com/v2/sourceSwapPolicies");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "<token>.");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"fromConnectionId\": \"9f2a6b1e-4c3d-4a8f-9e21-6d7c8b3a51f0\",\n  \"name\": \"Tenant Snowflake Swap\",\n  \"swaps\": {\n    \"deploymentSwaps\": [],\n    \"toConnection\": {\n      \"swapType\": \"attribute\",\n      \"userAttributeId\": \"e4b7c2a1-9d3f-4e6b-8a2c-5f1d9e3b7a4c\"\n    }\n  },\n  \"type\": \"deployment\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Swap tenant connections
import Foundation

let headers = [
  "Authorization": "<token>.",
  "Content-Type": "application/json"
]
let parameters = [
  "fromConnectionId": "9f2a6b1e-4c3d-4a8f-9e21-6d7c8b3a51f0",
  "name": "Tenant Snowflake Swap",
  "swaps": [
    "deploymentSwaps": [],
    "toConnection": [
      "swapType": "attribute",
      "userAttributeId": "e4b7c2a1-9d3f-4e6b-8a2c-5f1d9e3b7a4c"
    ]
  ],
  "type": "deployment"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.sigmacomputing.com/v2/sourceSwapPolicies")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Swap a specific database path

**Request**

```json
{
  "fromConnectionId": "9f2a6b1e-4c3d-4a8f-9e21-6d7c8b3a51f0",
  "name": "Tenant Snowflake Swap - Finance Schema",
  "swaps": {
    "deploymentSwaps": [
      {
        "from": {
          "path0": {
            "catalogObject": "FIN_OPS",
            "swapType": "exact"
          },
          "path1": {
            "swapType": "all"
          }
        },
        "to": {
          "path0": {
            "swapType": "attribute",
            "userAttributeId": "8b3d5c1e-2a6f-4a9b-8d3f-9f1c4a7e2b6d"
          },
          "path1": {
            "swapType": "all"
          }
        }
      }
    ],
    "toConnection": {
      "swapType": "attribute",
      "userAttributeId": "e4b7c2a1-9d3f-4e6b-8a2c-5f1d9e3b7a4c"
    }
  },
  "type": "deployment"
}
```

**Response**

```json
{
  "policyId": "6f1a3c7e-8d2b-4e9f-9a5c-2b6d4f8a1e3c"
}
```

**SDK Code**

```python Swap a specific database path
import requests

url = "https://api.sigmacomputing.com/v2/sourceSwapPolicies"

payload = {
    "fromConnectionId": "9f2a6b1e-4c3d-4a8f-9e21-6d7c8b3a51f0",
    "name": "Tenant Snowflake Swap - Finance Schema",
    "swaps": {
        "deploymentSwaps": [
            {
                "from": {
                    "path0": {
                        "catalogObject": "FIN_OPS",
                        "swapType": "exact"
                    },
                    "path1": { "swapType": "all" }
                },
                "to": {
                    "path0": {
                        "swapType": "attribute",
                        "userAttributeId": "8b3d5c1e-2a6f-4a9b-8d3f-9f1c4a7e2b6d"
                    },
                    "path1": { "swapType": "all" }
                }
            }
        ],
        "toConnection": {
            "swapType": "attribute",
            "userAttributeId": "e4b7c2a1-9d3f-4e6b-8a2c-5f1d9e3b7a4c"
        }
    },
    "type": "deployment"
}
headers = {
    "Authorization": "<token>.",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Swap a specific database path
const url = 'https://api.sigmacomputing.com/v2/sourceSwapPolicies';
const options = {
  method: 'POST',
  headers: {Authorization: '<token>.', 'Content-Type': 'application/json'},
  body: '{"fromConnectionId":"9f2a6b1e-4c3d-4a8f-9e21-6d7c8b3a51f0","name":"Tenant Snowflake Swap - Finance Schema","swaps":{"deploymentSwaps":[{"from":{"path0":{"catalogObject":"FIN_OPS","swapType":"exact"},"path1":{"swapType":"all"}},"to":{"path0":{"swapType":"attribute","userAttributeId":"8b3d5c1e-2a6f-4a9b-8d3f-9f1c4a7e2b6d"},"path1":{"swapType":"all"}}}],"toConnection":{"swapType":"attribute","userAttributeId":"e4b7c2a1-9d3f-4e6b-8a2c-5f1d9e3b7a4c"}},"type":"deployment"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Swap a specific database path
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.sigmacomputing.com/v2/sourceSwapPolicies"

	payload := strings.NewReader("{\n  \"fromConnectionId\": \"9f2a6b1e-4c3d-4a8f-9e21-6d7c8b3a51f0\",\n  \"name\": \"Tenant Snowflake Swap - Finance Schema\",\n  \"swaps\": {\n    \"deploymentSwaps\": [\n      {\n        \"from\": {\n          \"path0\": {\n            \"catalogObject\": \"FIN_OPS\",\n            \"swapType\": \"exact\"\n          },\n          \"path1\": {\n            \"swapType\": \"all\"\n          }\n        },\n        \"to\": {\n          \"path0\": {\n            \"swapType\": \"attribute\",\n            \"userAttributeId\": \"8b3d5c1e-2a6f-4a9b-8d3f-9f1c4a7e2b6d\"\n          },\n          \"path1\": {\n            \"swapType\": \"all\"\n          }\n        }\n      }\n    ],\n    \"toConnection\": {\n      \"swapType\": \"attribute\",\n      \"userAttributeId\": \"e4b7c2a1-9d3f-4e6b-8a2c-5f1d9e3b7a4c\"\n    }\n  },\n  \"type\": \"deployment\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "<token>.")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Swap a specific database path
require 'uri'
require 'net/http'

url = URI("https://api.sigmacomputing.com/v2/sourceSwapPolicies")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = '<token>.'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"fromConnectionId\": \"9f2a6b1e-4c3d-4a8f-9e21-6d7c8b3a51f0\",\n  \"name\": \"Tenant Snowflake Swap - Finance Schema\",\n  \"swaps\": {\n    \"deploymentSwaps\": [\n      {\n        \"from\": {\n          \"path0\": {\n            \"catalogObject\": \"FIN_OPS\",\n            \"swapType\": \"exact\"\n          },\n          \"path1\": {\n            \"swapType\": \"all\"\n          }\n        },\n        \"to\": {\n          \"path0\": {\n            \"swapType\": \"attribute\",\n            \"userAttributeId\": \"8b3d5c1e-2a6f-4a9b-8d3f-9f1c4a7e2b6d\"\n          },\n          \"path1\": {\n            \"swapType\": \"all\"\n          }\n        }\n      }\n    ],\n    \"toConnection\": {\n      \"swapType\": \"attribute\",\n      \"userAttributeId\": \"e4b7c2a1-9d3f-4e6b-8a2c-5f1d9e3b7a4c\"\n    }\n  },\n  \"type\": \"deployment\"\n}"

response = http.request(request)
puts response.read_body
```

```java Swap a specific database path
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.sigmacomputing.com/v2/sourceSwapPolicies")
  .header("Authorization", "<token>.")
  .header("Content-Type", "application/json")
  .body("{\n  \"fromConnectionId\": \"9f2a6b1e-4c3d-4a8f-9e21-6d7c8b3a51f0\",\n  \"name\": \"Tenant Snowflake Swap - Finance Schema\",\n  \"swaps\": {\n    \"deploymentSwaps\": [\n      {\n        \"from\": {\n          \"path0\": {\n            \"catalogObject\": \"FIN_OPS\",\n            \"swapType\": \"exact\"\n          },\n          \"path1\": {\n            \"swapType\": \"all\"\n          }\n        },\n        \"to\": {\n          \"path0\": {\n            \"swapType\": \"attribute\",\n            \"userAttributeId\": \"8b3d5c1e-2a6f-4a9b-8d3f-9f1c4a7e2b6d\"\n          },\n          \"path1\": {\n            \"swapType\": \"all\"\n          }\n        }\n      }\n    ],\n    \"toConnection\": {\n      \"swapType\": \"attribute\",\n      \"userAttributeId\": \"e4b7c2a1-9d3f-4e6b-8a2c-5f1d9e3b7a4c\"\n    }\n  },\n  \"type\": \"deployment\"\n}")
  .asString();
```

```php Swap a specific database path
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.sigmacomputing.com/v2/sourceSwapPolicies', [
  'body' => '{
  "fromConnectionId": "9f2a6b1e-4c3d-4a8f-9e21-6d7c8b3a51f0",
  "name": "Tenant Snowflake Swap - Finance Schema",
  "swaps": {
    "deploymentSwaps": [
      {
        "from": {
          "path0": {
            "catalogObject": "FIN_OPS",
            "swapType": "exact"
          },
          "path1": {
            "swapType": "all"
          }
        },
        "to": {
          "path0": {
            "swapType": "attribute",
            "userAttributeId": "8b3d5c1e-2a6f-4a9b-8d3f-9f1c4a7e2b6d"
          },
          "path1": {
            "swapType": "all"
          }
        }
      }
    ],
    "toConnection": {
      "swapType": "attribute",
      "userAttributeId": "e4b7c2a1-9d3f-4e6b-8a2c-5f1d9e3b7a4c"
    }
  },
  "type": "deployment"
}',
  'headers' => [
    'Authorization' => '<token>.',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Swap a specific database path
using RestSharp;

var client = new RestClient("https://api.sigmacomputing.com/v2/sourceSwapPolicies");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "<token>.");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"fromConnectionId\": \"9f2a6b1e-4c3d-4a8f-9e21-6d7c8b3a51f0\",\n  \"name\": \"Tenant Snowflake Swap - Finance Schema\",\n  \"swaps\": {\n    \"deploymentSwaps\": [\n      {\n        \"from\": {\n          \"path0\": {\n            \"catalogObject\": \"FIN_OPS\",\n            \"swapType\": \"exact\"\n          },\n          \"path1\": {\n            \"swapType\": \"all\"\n          }\n        },\n        \"to\": {\n          \"path0\": {\n            \"swapType\": \"attribute\",\n            \"userAttributeId\": \"8b3d5c1e-2a6f-4a9b-8d3f-9f1c4a7e2b6d\"\n          },\n          \"path1\": {\n            \"swapType\": \"all\"\n          }\n        }\n      }\n    ],\n    \"toConnection\": {\n      \"swapType\": \"attribute\",\n      \"userAttributeId\": \"e4b7c2a1-9d3f-4e6b-8a2c-5f1d9e3b7a4c\"\n    }\n  },\n  \"type\": \"deployment\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Swap a specific database path
import Foundation

let headers = [
  "Authorization": "<token>.",
  "Content-Type": "application/json"
]
let parameters = [
  "fromConnectionId": "9f2a6b1e-4c3d-4a8f-9e21-6d7c8b3a51f0",
  "name": "Tenant Snowflake Swap - Finance Schema",
  "swaps": [
    "deploymentSwaps": [
      [
        "from": [
          "path0": [
            "catalogObject": "FIN_OPS",
            "swapType": "exact"
          ],
          "path1": ["swapType": "all"]
        ],
        "to": [
          "path0": [
            "swapType": "attribute",
            "userAttributeId": "8b3d5c1e-2a6f-4a9b-8d3f-9f1c4a7e2b6d"
          ],
          "path1": ["swapType": "all"]
        ]
      ]
    ],
    "toConnection": [
      "swapType": "attribute",
      "userAttributeId": "e4b7c2a1-9d3f-4e6b-8a2c-5f1d9e3b7a4c"
    ]
  ],
  "type": "deployment"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.sigmacomputing.com/v2/sourceSwapPolicies")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```