For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Log inBook a demo
GuidesAPI Reference
GuidesAPI Reference
  • Getting started
    • Introduction
    • IP Whitelisting
    • Obtaining API keys
    • LLMs.txt
    • MCP server
    • Quickstart
    • Native clients
    • Concepts
    • Embedding authentication
    • Multitenancy
    • Versioning
    • Idempotent requests
    • Events
    • Self-hosted option
    • 2025-09-18 Migration Guide
  • Configuring your connections
    • Overview
    • CDC streaming from databases
    • Syncing to custom webhooks
  • Code examples
    • Overview
    • Bulk sync (ELT) from HubSpot to PostgreSQL
    • Bulk sync (ELT) from Salesforce to S3
    • Bulk sync (ELT) from Salesforce to Snowflake
    • Model sync (Reverse ETL) from Snowflake query to Salesforce
    • Model sync (Reverse ETL) from MongoDB to Salesforce
    • Adding users from Snowflake to Salesloft Cadence
    • Adding contacts from Snowflake to Gong Engage
    • Joined model sync from Postgres, Airtable, and Stripe to Hubspot
    • Model sync from MySQL to Snowflake
    • Model sync from Salesforce to Netsuite
    • Querying Salesforce using SOQL
    • Syncing audiences from Snowflake to LinkedIn Ads
    • Syncing contacts from Google Cloud Storage to Salesforce
    • Syncing contacts from Google Cloud Storage to webhooks
    • Transactional calls with LinkedIn Ads audiences
  • Terraform examples
    • Overview
    • Model sync (Reverse ETL) from BigQuery to Salesforce
    • Model sync (Reverse ETL) from BigQuery to LinkedIn Ads
Logo
Log inBook a demo
On this page
  • Setup
  • Making API requests
  • 1. Create a HubSpot Connection
  • 2. Create a PostgreSQL Connection
  • 3. Create a Bulk Sync
Getting started

Quickstart

Was this page helpful?
Previous

Native clients

Next

This quickstart guide illustrates an end-to-end example of setting up a Polytomic sync from HubSpot to a PostgreSQL database.

Setup

Generate an API key in your user settings panel. For more information, see the authentication section.

Making API requests

Set the API token as an environment variable:

export POLYTOMIC_API_KEY=YOUR-API-TOKEN

Replace YOUR-API-TOKEN with the token you just generated.

Make a request to the identity endpoint:

cURL
Python
Typescript
Go
$curl --request GET \
> --url https://app.polytomic.com/api/me \
> --header "accept: application/json" \
> --header "X-Polytomic-Version: 2025-09-18" \
> --header "Authorization: Bearer ${POLYTOMIC_API_KEY}"

1. Create a HubSpot Connection

The following request creates a HubSpot Connection. See the connection configuration reference for the fields each Connection type accepts.

cURL
Python
Typescript
Go
$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": "HubSpot Connection","type": "hubspot", "configuration": {}}'

HubSpot 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 a PostgreSQL Connection

The PostgreSQL server must be network-accessible from Polytomic.

cURL
Python
Typescript
Go
$ 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": "Postgres Connection",
> "type": "postgresql",
> "configuration": {
> "hostname": "localhost",
> "port": 5432,
> "database": "postgres",
> "username": "user",
> "password": "secret"
> }
> }'

Polytomic may take a few moments to cache source schemas after a new Connection is created.

3. Create a Bulk Sync

The following request creates a Bulk Sync that replicates every HubSpot object into Postgres:

cURL
Python
Typescript
Go
$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": "HubSpot Bulk Sync",
> "source_connection_id": "YOUR-HUBSPOT-CONNECTION-ID",
> "destination_connection_id": "YOUR-POSTGRES-CONNECTION-ID",
> "mode": "replicate",
> "default_schedule": {
> "frequency": "continuous"
> },
> "destination_configuration": {
> "schema": "hubspot"
> },
> "schemas": ["contacts", "companies", "deals"]
> }'