Skip to main content

Writes

Proxy overview

Sequin provisions a read-only sync of your API data. This is to promote a one-way data flow architecture.

Data flows from the API to your Postgres database. Your code or SQL client then reads from the database. To mutate your data, you write to the API through Sequin, via our Proxy. Those mutations are applied simultaneously to both the API and your Sequin database so that they show up in subsequent reads by your code or SQL client.

With this architecture, your code is structured so that you're using SQL for reads but API calls for writes. This gives you the best of both worlds and ensures your database stays in sync with the upstream API.

Commits to both places

Requests made through the proxy are written first to the API. On a successful write, changes are written immediately to your database. The Proxy then returns the full response from the API:

Diagram of Sequin's Proxy write architecture

Write responses

The proxy acts as a reverse proxy to the upstream API. Therefore, the response's status code, headers, and body are all set by the upstream API.

The exception is in certain error situations, when we return one of the following status codes:

  • 504: This is sent by the Sequin proxy if we timed out before reaching the API. This may happen in certain instances where the API is overloaded and not serving requests in time.
  • 502: A 502 may be sent by either the Proxy or by the API. The body will indicate whether the 502 was sent by the Proxy or by the API.
  • 404: A 404 may be sent by either the Proxy or by the API. When it's sent by Sequin, it usually indicates you're using a bad hostname for the API (e.g. using api.hubspot.com instead of api.hubapi.com) or a path not supported by Sequin. The body will indicate whether the 404 was sent by the Proxy or by the API.
  • 403: You'll receive a 403 if there's something wrong with how you've authenticated your request. A 403 may be sent by either the Proxy or by the API. The body will indicate whether the 403 was sent by the Proxy or by the API.

If the API returns a non-2xx status code for your request, the Proxy does not commit the changes to your database.

Rate limit

When you setup a sync on Sequin, you allocate a rate limit for Sequin's sync process. The Proxy shares that rate limit with your sync. Requests made via the Proxy are prioritized over requests made via the sync.

For example, let's say you've allocated 3 requests per second for your Salesforce sync. If in a given second you make 2 requests through the Proxy, that will leave 1 request for that second over for your sync. In this way, the sync slows down slightly to accommodate requests made via the Proxy.

Location

The Proxy is located in the AWS us-west-2 (Oregon) region. We'll be rolling out the Proxy in other regions later this year. Let us know if that interests you!

Example

To find the API root for your Proxy requests, log into app.sequin.io. You'll see a badge, ⚡️ Proxy writes, on your sync. For example, a HubSpot sync might have an API root of https://proxy.sequin.io/PUD9iQVK/api.hubapi.com.

To run your API request through the Sequin Proxy, prepend that URL to before the API URL in your path. For example, to create a HubSpot Contact, the URL https://api.hubapi.com/crm/v3/objects/contacts becomes:

https://proxy.sequin.io/{YOUR_UNIQUE_IDENTIFIER}/api.hubapi.com/crm/v3/objects/contacts

When you write through that URL, changes will be committed to the API and your database at the same time.

Platform guides

To learn how to use the Sequin Proxy for your source, please refer to each source's reference guide: