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

## UI demo video

Watch the same steps in the Polytomic admin console in this [demo video](https://www.loom.com/share/0c1430b76b664223925752928ca3107b?sid=473b84cc-79f7-4d5f-84ea-8796bdea64bb).

## Code

Set your Polytomic API key as an environment variable:

```bash
export POLYTOMIC_API_KEY=YOUR-API-TOKEN
```

This example covers three steps:

1. Create a Salesforce Connection.
2. Create an S3 Connection.
3. Bulk Sync data from Salesforce into S3.

## 1. Create a Salesforce Connection

The following request creates a Salesforce Connection. See the [Salesforce connection configuration](/guides/configuring-your-connections/connections/salesforce) for the required fields.

#### cURL

```bash
curl --request POST  \
     --url https://app.polytomic.com/api/connections \
     --header "accept: application/json"  \
     --header "content-type: application/json"  \
     --header "X-Polytomic-Version: 2025-09-18"   \
     --header "Authorization: Bearer ${POLYTOMIC_API_KEY}"  \
     -d '{"name": "Salesforce Connection","type": "salesforce", "configuration": {"domain": "https://example.my.salesforce.com"}}'
```

#### Python

```python
import os
from polytomic.client import Polytomic

client = Polytomic(
    token=os.getenv("POLYTOMIC_API_KEY"),
)

resp = client.connections.create(
    name="Salesforce Connection",
    configuration={"domain": "https://example.my.salesforce.com"},
    type="salesforce"
)

print(resp.data)
```

#### Typescript

```typescript

import { PolytomicClient } from 'polytomic';

const polytomic = new PolytomicClient({
  token: "POLYTOMIC_API_KEY",
});

polytomic.connections.create({
  name: "Salesforce Connection",
  type: "salesforce",
  configuration: {
     domain: "https://example.my.salesforce.com"
  },

}).then((res) => {
  console.log(res)
})

```

#### Go

```golang

import (
	"context"
	"fmt"

	polytomic "github.com/polytomic/polytomic-go"
	polytomicgoclient "github.com/polytomic/polytomic-go/client"
	"github.com/polytomic/polytomic-go/option"
)

client := polytomicgoclient.NewClient(
    option.WithToken(os.Getenv("POLYTOMIC_API_TOKEN")),
)

resp, err := client.Connections.Create(
    context.TODO(),
    &polytomic.CreateConnectionRequestSchema{
        Name:          "Salesforce Connection",
        Type:          "salesforce",
        Configuration: map[string]any{
          "domain": "https://example.my.salesforce.com",
        },
    },
)
if err != nil {
    panic(err)
}
fmt.Println(resp)
```

Salesforce Connections authenticate with OAuth. Open the URL returned in the `auth_url` field of the response to complete the flow.

> **OAuth redirection**
>
> By default, the API expects `auth_url` to open in a new browser window.
> Set the optional `redirect_url` parameter in the request body to change
> the redirect target.

## 2. Create an S3 Connection

The S3 bucket must be reachable from Polytomic over the network. For details, see the [S3 connection guide](https://docs.polytomic.com/docs/aws-s3-connections).

#### cURL

```bash
     curl --request POST \
     --url https://app.polytomic.com/api/connections \
     --header "accept: application/json" \
     --header "content-type: application/json" \
     --header "X-Polytomic-Version: 2025-09-18"  \
     --header "Authorization: Bearer ${POLYTOMIC_API_KEY}" \
     -d '{
     "name": "S3 Connection",
     "type": "s3",
     "configuration": {
        "aws_access_key_id": "EXAMPLE",
        "aws_secret_access_key": "SECRET",
        "s3_bucket_region": "us-east-1",
        "s3_bucket_name": "my-bucket"
        }
    }'
```

#### Python

```python
import os
from polytomic.client import Polytomic

client = Polytomic(
    token=os.getenv("POLYTOMIC_API_KEY"),
)

resp = client.connections.create(
    name="S3 Connection",
    configuration={
        "aws_access_key_id": "EXAMPLE",
        "aws_secret_access_key": "SECRET",
        "s3_bucket_region": "us-east-1",
        "s3_bucket_name": "my-bucket"
     },
     type="s3"
)

print(resp.data)
```

#### Typescript

```typescript

import { PolytomicClient } from 'polytomic';

const polytomic = new PolytomicClient({
  token: "POLYTOMIC_API_KEY",
});

polytomic.connections.create({
  name: "S3 Connection",
  type: "s3",
  configuration: {
     aws_access_key_id: "EXAMPLE",
     aws_secret_access_key: "SECRET",
     s3_bucket_region: "us-east-1",
     s3_bucket_name: "my-bucket"
  },

}).then((res) => {
  console.log(res)
})

```

#### Go

```golang

import (
	"context"
	"fmt"

	polytomic "github.com/polytomic/polytomic-go"
	polytomicgoclient "github.com/polytomic/polytomic-go/client"
	"github.com/polytomic/polytomic-go/option"
)

client := polytomicgoclient.NewClient(
    option.WithToken(os.Getenv("POLYTOMIC_API_TOKEN")),
)

resp, err := client.Connections.Create(
    context.TODO(),
    &polytomic.CreateConnectionRequestSchema{
        Name:          "S3 Connection",
        Type:          "s3",
        Configuration: map[string]any{
          "aws_access_key_id": "EXAMPLE",
          "aws_secret_access_key": "SECRET",
          "s3_bucket_region": "us-east-1",
          "s3_bucket_name": "my-bucket",
        },
    },
)
if err != nil {
    panic(err)
}
fmt.Println(resp)
```

## 3. Create a Bulk Sync

The following request creates a Bulk Sync that replicates the Salesforce `Account` and `Contact` objects into S3:

\


> **Note**
>
> Omit `schemas` to sync every object on the source.

\


#### cURL

```bash
curl --request POST \
     --url https://app.polytomic.com/api/bulk/syncs \
     --header "accept: application/json" \
     --header "content-type: application/json" \
     --header "X-Polytomic-Version: 2025-09-18" \
     --header "Authorization: Bearer ${POLYTOMIC_API_KEY}" \
     -d '{
          "name": "Salesforce Bulk Sync",
          "source_connection_id": "YOUR-SALESFORCE-CONNECTION-ID",
          "destination_connection_id": "YOUR-S3-CONNECTION-ID",
          "mode": "replicate",
          "default_schedule": {
              "frequency": "continuous"
          },
          "destination_configuration": {
               "format": "csv"
          },
          "schemas": ["Account", "Contact"]
    	}'
```

#### Python

```python

import os
from polytomic.client import Polytomic
from polytomic import BulkSyncDefaultScheduleRequest

client = Polytomic(
    token=os.getenv("POLYTOMIC_API_KEY"),
)

resp = client.bulk_sync.create(
    name="Salesforce Bulk Sync",
    source_connection_id="YOUR-SALESFORCE-CONNECTION-ID",
    destination_connection_id="YOUR-S3-CONNECTION-ID",
    mode="replicate",
    default_schedule=BulkSyncDefaultScheduleRequest(
        frequency="continuous",
    ),
    destination_configuration={
        "format": "csv"
    },
    schemas=["Account", "Contact"]
)

print(resp.data)
```

#### Typescript

```typescript

import { Polytomic, PolytomicClient } from 'polytomic';

const polytomic = new PolytomicClient({
  token: "POLYTOMIC_API_KEY",
});

polytomic.bulkSync.create({
  name: "Salesforce Bulk Sync",
  source_connection_id: "YOUR-SALESFORCE-CONNECTION-ID",
  destination_connection_id: "YOUR-S3-CONNECTION-ID",
  mode: Polytomic.BulkSyncTargetMode.Replicate,
  default_schedule: {
     frequency: Polytomic.ScheduleFrequency.Continuous,
  },
  destination_configuration: {
      format: "csv"
  },
  schemas: ["Account", "Contact"]
}).then((res) => {
     console.log(res)
})

```

#### Go

```golang

import (
	"context"
	"fmt"

	polytomic "github.com/polytomic/polytomic-go"
	polytomicgoclient "github.com/polytomic/polytomic-go/client"
	"github.com/polytomic/polytomic-go/option"
)

client := polytomicgoclient.NewClient(
    option.WithToken(os.Getenv("POLYTOMIC_API_TOKEN")),
)

mode := polytomic.BulkSyncTargetModeReplicate
resp, err := client.BulkSync.Create(
     context.TODO(),
     &polytomic.CreateBulkSyncRequest{
          Name:                    "Salesforce to S3 Sync",
          SourceConnectionID:      "YOUR-SALESFORCE-CONNECTION-ID",
          DestinationConnectionID: "YOUR-S3-CONNECTION-ID",
          Mode:                    &mode,
          DefaultSchedule: &polytomic.BulkSyncDefaultScheduleRequest{
               Frequency: polytomic.ScheduleFrequencyContinuous,
          },
          DestinationConfiguration: map[string]any{
               "format": "csv",
          },
          Schemas: []*polytomic.CreateBulkSyncRequestSchemasItem{
               {String: "Account"},
               {String: "Contact"},
          },
     },
)
if err != nil {
     panic(err)
}
fmt.Println(resp)
```

### Bulk Sync schemas

\


> ℹ️ Retry while schemas cache
>
> Polytomic may take a few moments to cache source schemas after a new
> Connection is created. Until the cache is populated, Bulk Sync creation
> returns:
>
> ```json
> {"status":400,"message":"No schemas found. This can mean that the Polytomic has not cached any schemas yet. Please try again.","metadata":null}
> ```
>
> This request is safe to retry until it returns a `2xx` response.