Create a data source

post/v1/datasets/{datasetId}/sources

Connects a store to a dataset. A shopify-api source reads the store's public catalogue at https://<store>.myshopify.com/products.json. You can pass either the full products.json URL or the bare store origin; the sync worker appends /products.json when the path does not already end with it, drops any query string or fragment, and pages through the catalogue 250 products at a time, up to 25,000 products. A path is kept, so /collections/sale/products.json or /en-ca/products.json syncs that narrower catalogue.

A shopify-storefront source reads the Storefront API with the store's storefront access token, which carries the price's currency and market and, when the token allows it, stock quantities. Send storefrontToken and myshopifyDomain with it, and optionally market, the country whose prices are read (US when left out). On create the store is asked whether the token may read stock quantities, and the answer is stored as config.readsInventory; a store that does not answer counts as no. The token itself is not checked on create; a token the store later refuses is handled by the source's syncs (see sync.fallback and config.tokenRenewedAt). storefrontToken, myshopifyDomain and market are ignored for a shopify-api source.

syncPeriod controls automatic syncing, in minutes. A source is due when at least syncPeriod minutes have passed since its last successful sync (a source that has never synced is due immediately), at which point the scheduler enqueues a sync job for it. After a failed sync the source waits before it is tried again: 5 minutes, doubling with each failure in a row, never longer than syncPeriod. Pass 0 to disable automatic syncing and trigger jobs yourself with Create sync job. Only active sources are scheduled, and only active sources accept manual jobs.

disableGenerativeAssets is accepted but AI-generated thumbnails are currently turned off platform-wide, so the stored value is always true.

Creating a source does not start a sync. Trigger one explicitly, or wait for the scheduler.

The response is 200, not 201.

Private keyapi.v1.datasets.sources.createNo demo

Path parameters

1
datasetIdstring (uuid)required

The dataset the source will feed. Must belong to your organization.

Request body

application/jsonrequired
typestringrequired

Connector type.

One ofshopify-apishopify-storefront
endpointstring (uri)required

Absolute URL of the store's public products.json endpoint, or the store origin. Must parse as a URL.

syncPeriodintegerrequired

Automatic sync interval in minutes. Must be a JSON number: 0 (never sync automatically) or at least 60. Strings are rejected on create.

min: 0
statusstringrequired

Whether the source is scheduled and accepts sync jobs.

One ofactiveinactive
disableGenerativeAssetsboolean

Accepted for forward compatibility; currently always stored as true.

default: true
storefrontTokenstring

shopify-storefront only, and required for it. The store's Storefront API access token.

myshopifyDomainstring

shopify-storefront only, and required for it. The bare host the Storefront API is served from, such as example-store.myshopify.com, with no scheme or path.

marketstring

shopify-storefront only. Uppercase ISO 3166 country code whose prices and currency the catalogue is read in. Defaults to US at sync time.

e.g. "CA"

Response

200The source was created.
successbooleanrequired

Always true on a 2xx response.

DataSourcerequired

A store connection that feeds a dataset. A shopify-api source reads the store's public products.json catalogue and stores only its endpoint. A shopify-storefront source reads the Storefront API and also carries the fields marked Storefront below; its storefront access token is never part of the documented response.

sourceIdstring (uuid)required

Unique identifier of the source. Generated on create.

e.g. "8a4d2f1e-3c5b-4e6a-9d7f-2b1c3d4e5f6a"
datasetIdstring (uuid)required

The dataset this source feeds.

e.g. "3f1c2a9e-6b7d-4c1e-9a2b-1d4e5f6a7b8c"
organizationIdstring (uuid)required

The organization that owns the source.

e.g. "5b7e9c1a-2d4f-4a6b-8c1d-9e2f3a4b5c6d"
typestringrequired

Connector type. shopify-api reads a Shopify store's public products.json; shopify-storefront reads its Storefront API, priced in a chosen market.

One ofshopify-apishopify-storefront
statusstringrequired

active sources are picked up by the scheduler and accept manual sync jobs. inactive sources are ignored by the scheduler and reject manual jobs.

One ofactiveinactive
objectrequired

Scheduling state.

objectrequired

Connector configuration.

createdAtstring (date-time)required

When the source was created.

e.g. "2026-08-01T14:22:09.101Z"
updatedAtstring (date-time)required

When the source was last modified, including scheduler updates to sync.previous.

e.g. "2026-09-11T03:00:12.420Z"

Errors

38

Every error is JSON with a single error string unless noted. Match on the status code; the message is for humans.

400
Request body must be valid JSON.

The request body is not parseable JSON. This response carries no rate-limit headers.

400
Request body must be a JSON object.

The request body is empty, an array, or a JSON scalar. This response carries no rate-limit headers.

404
Dataset not found or does not belong to organization

No dataset with that datasetId belongs to the organization that owns the key. Checked after field validation.

422
type must be one of shopify-api, shopify-storefront

type is missing or is not a known connector type, and it is the only invalid field.

422
storefrontToken is required for a shopify-storefront source

type is shopify-storefront and storefrontToken is missing, empty or not a string, and it is the only invalid field.

422
myshopifyDomain is required for a shopify-storefront source

type is shopify-storefront and myshopifyDomain is missing, empty or not a string, and it is the only invalid field.

422
myshopifyDomain must be a bare host such as example.myshopify.com

type is shopify-storefront and myshopifyDomain carries a scheme, path, port or anything else that is not a host name, and it is the only invalid field.

422
market must be an uppercase ISO-3166 country code

type is shopify-storefront and market is present but not two uppercase letters, and it is the only invalid field.

422
endpoint is required and must be a string

endpoint is missing, empty, or not a string, and it is the only invalid field.

422
endpoint must be a valid URL

endpoint is a string that does not parse as an absolute URL, and it is the only invalid field.

422
syncPeriod is required and must be 0 (Never) or at least 60 minutes

syncPeriod is missing, not a JSON number, or a number between 1 and 59, and it is the only invalid field.

422
status must be "active" or "inactive"

status is missing or not one of the two allowed values, and it is the only invalid field.

422
Validation failed.

More than one field is invalid. details lists one { path, message } entry per invalid field, using the messages above. A single-field failure also carries details, with that field's message as error.

{
  "error": "Validation failed.",
  "details": [
    {
      "path": "type",
      "message": "type must be one of shopify-api, shopify-storefront"
    },
    {
      "path": "syncPeriod",
      "message": "syncPeriod is required and must be 0 (Never) or at least 60 minutes"
    }
  ]
}
curl -X POST "https://stylor.ai/api/v1/datasets/YOUR_DATASET_ID/sources" \
  -H "Authorization: Bearer $STYLOR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "type": "shopify-api",
  "endpoint": "https://example-store.myshopify.com/products.json",
  "syncPeriod": 1440,
  "status": "active"
}'
Response · 200
{
  "success": true,
  "source": {
    "sourceId": "8a4d2f1e-3c5b-4e6a-9d7f-2b1c3d4e5f6a",
    "datasetId": "3f1c2a9e-6b7d-4c1e-9a2b-1d4e5f6a7b8c",
    "organizationId": "5b7e9c1a-2d4f-4a6b-8c1d-9e2f3a4b5c6d",
    "type": "shopify-api",
    "status": "active",
    "sync": {
      "period": 1440,
      "previous": null
    },
    "config": {
      "endpoint": "https://example-store.myshopify.com/products.json",
      "disableGenerativeAssets": true
    },
    "createdAt": "2026-09-12T09:15:41.002Z",
    "updatedAt": "2026-09-12T09:15:41.002Z"
  }
}