In Sequin, an instance of a connection to an API is called a sync. Sequin uses a credential (e.g. an access token) to access the API.

Here are some examples of things you can sync:

  • A Salesforce account
  • A HubSpot sandbox
  • A Shopify store
  • A Stripe account

You can create syncs to your API account or to your customers’ API accounts.

When you initially start a sync, Sequin backfills the data from the API to the stream. You can configure how far back in time the backfill goes by setting the max_age_days parameter.

max_age_days
integer

The maximum age of data from the API that will be backfilled.

Once a collection is backfilled, Sequin begins change detection on the data. Inserts, updates, and deletes are detected and published to the stream. This process runs either in real-time or in batch mode.

sync_frequency
string

The frequency at which Sequin will check for changes to the API. continuous or 4h.

Streams

Each sync belongs to a stream. Data from backfills and change-data-capture is stored in a stream for consumption via consumers.

curl https://api.sequin.io/v1/http-consumers/{id}/next?batch_size=10
200 OK
[
  {
    "ack_token": "NjA1",
    "record": {
      "sync_id": "my-sync-id",
      "collection_id" : "stripe:subscription",
      "upstream_id": "sub_tognkns00nj",
      "updated_idx": 2745327037,
      "upstream_created_at": "2024-11-10T18:38:00.070453Z",
      "upstream_updated_at": "2024-11-10T18:38:00.070453Z",
      "data": {
        "id": "sub_tognkns00nj",
        "object": "subscription",
        "billing": "charge_automatically",
        // …
      }
    }
  },
  // ...
]

Management API

Everything you can do in the Sequin console you can do via Sequin’s Management API. This empowers you to write code that starts syncs, manages consumers, or anything else.

You’ll use the Management API if you’re programmatically connecting to your customers’ API accounts. For example, if you’re building a product that syncs data from your customers’ Salesforce accounts to your app, you’ll use the Management API to capture credentials and spin up syncs for each customer.

You can also use the Management API to integrate Sequin into your development and CI/CD workflows.

There’s a lot you can do with the Management API. Here’s a sampling of some common tasks:

List syncs

List all the syncs in your account:

curl --request GET \
  --url https://api.sequin.io/v1/syncs \
  --header 'Authorization: Bearer <YOUR_API_KEY>'

Add a credential

Add a credential to your account:

curl --request POST \
  --url https://api.sequin.io/v1/credentials \
  --header 'Content-Type: application/json' \
           'Authorization: Bearer <YOUR_API_KEY>' \
  --data '{
    "kind": "stripe_oauth2",
    "access_token": "sk_live_7eC39HqLyjWDarjtT1zdp7dc",
    "oauth_app_id": "8ff58ef0-d376-4ae8-b2e2-9f0206aa65b8",
    "metadata": { "custom_property": 42 }
  }'

Create a sync

Create a new sync using the credential you just created:

curl --request POST
  --url https://api.sequin.io/v1/syncs
  --header 'Content-Type: application/json' \
           'Authorization: Bearer <YOUR_API_KEY>' \
  --data '{
    "provider": "stripe",
    "name": "Choam Corp - Stripe Production",
    "collection_ids": ["stripe:customer", "stripe:invoice"],
    "rate_limit": {
      "allowed_requests": 100,
      "interval": 60,
      "max_concurrent_requests": 0
    },
    "credential_id": "8ff58ef0-d376-4ae8-b2e2-9f0206aa65b8",
    "metadata": { "custom_property": 42 }
  }'