SubblySubbly
Log inGet started
  • Get started
  • Developer resources
Private API reference
Docs
Information
    Base URLAuthenticationPaginationErrors
Customer
    Get list of customersCreate a customerGet customer by IDUpdate a customerDelete a customerChange a customer's store credit balanceCreate a customer noteUpdate a customer noteDelete a customer note
Address
    Create an addressUpdate an addressDelete an address
Pickup Info
    Get list of pickup infoCreate pickup infoUpdate pickup infoDelete pickup info
Subscription
    Get list of subscriptionsCreate a subscriptionGet subscription by IDUpdate a subscriptionCancel a subscriptionUndo cancellationPause a subscriptionResume a subscriptionSkip renewals until a dateReactivate a cancelled or expired subscriptionSwitch the subscription to another plan by starting overChange the plans of the subscription's itemsUpdate a subscription's shipping address and methodUpdate a subscription's payment methodUpdate a subscription's survey preferencesCreate a subscription itemShow a subscription itemUpdate a subscription itemRemove a subscription itemUpdate a subscription item's preferencesUpdate a subscription item's bundleChange the plan of a subscription itemChange the variant of a one-time itemApply a discount to a subscription itemRemove a subscription item discountApply a discount to a subscriptionRemove a subscription discount
Invoice
    Get list of invoicesGet invoice by IDSchedule the next payment for invoiceVoid an invoiceForgive an invoiceMark an invoice as paid
Order
    Get list of ordersGet order by IDUpdate an orderShip an orderCancel an orderMark an order as pendingArchive an orderMark an order as a future shipmentSync order shipping items
Payment Method
    Create a payment methodGet payment method by IDDelete a payment method
Transaction
    Get list of transactionsGet transaction by ID
Cancellation
    Get shop cancellation reasons
Product
    Get list of productsGet product by IDGet variant by IDUpdate variantGet plan by IDUpdate planCreate subscription productUpdate subscription productPublish subscription productUnpublish subscription productArchive subscription productSync subscription product metadataCreate one-time productUpdate one-time productPublish one-time productUnpublish one-time productArchive one-time productSync one-time product metadataCreate variantArchive variantBatch create/update/archive variantsCreate planArchive plan
Survey
    Get survey by IDGet list of surveys
Bundle
    Get list of bundlesCreate a new bundleGet bundle by IDUpdate a bundleGet list of bundle itemsCreate a bundle itemBatch create bundle itemsGet bundle item by IDUpdate a bundle itemDelete a bundle itemGet list of bundle groupsPublish a bundleUnpublish a bundleArchive a bundleSync bundle metadataCreate a bundle planGet bundle plan by IDUpdate a bundle planArchive a bundle plan
Tag
    Get list of tags
Metafield
    Get shop's metafieldsCreate a new metadataUpdate the metadata
Funnel
    Get list of funnelsGet funnel by ID
Option
    Get list of options
Country
    Get list of countries
Inventory
    Get list of inventory itemsCreate a new inventory itemGet inventory item by IDUpdate an inventory itemArchive an inventory itemGet list of inventory groupsCreate a new inventory groupGet inventory group by IDUpdate an inventory group
Coupon
    Get list of couponsCreate a couponGet coupon by IDUpdate a couponArchive a coupon
Product Collection
    Get list of product collectionsCreate a product collectionGet product collection by IDUpdate a product collectionPublish a product collectionUnpublish a product collectionArchive a product collectionGet list of collection groups with itemsSync collection items

Product Collection

Private Product Collection API endpoints

Endpoints
  • GET/products/collections
  • POST/products/collections
  • GET/products/collections/{collection_id}
  • PUT/products/collections/{collection_id}
  • POST/products/collections/{collection_id}/publish
  • POST/products/collections/{collection_id}/unpublish
  • POST/products/collections/{collection_id}/archive
  • GET/products/collections/{collection_id}/items
  • POST/products/collections/{collection_id}/items

Get list of product collections

GET /products/collections

Query parameters

pageoptionalinteger

Page number for pagination

per_pageoptionalinteger

Items per page

ids[]optionalinteger[]

Filter by collection IDs

slugs[]optionalstring[]

Filter by collection slugs

publishedoptionalboolean

Filter by published status

typeoptionalstring | null

Filter by collection type

sort[field]optionalstring

Field to sort by. Required whenever any sort[...] key is sent; passing sort[direction] without sort[field] returns 422.

Possible values: id, name.

sort[direction]optionalstring

Sort direction; defaults to asc.

Possible values: asc, desc.

Defaults to "asc".

Returnsobject

Product collections list response

Error responses

422object

A query parameter fails validation. ids[] or slugs[] is not an array of unique values (ids[] integers, slugs up to 80 characters); published is not a boolean; type is over 50 characters; page is below 1; per_page is outside 1 to 100; sort is not an object, sort[field] is missing or not id or name, or sort[direction] is not asc or desc; or expand is not an array.

curl https://api.subbly.co/private/v1/products/collections \ -H 'X-API-KEY: <api-key>'
Response
{ "pagination": { "current_page": 1, "last_page": 2, "from": 1, "to": 1, "total": 20 }, "data": [ { "id": 1, "shop_id": 1, "name": "Summer Collection", "slug": "summer-collection", "type": "subscription", "published": true, "archived": false, "created_at": "2022-04-01T00:00:00.000000Z", "updated_at": "2022-04-01T00:00:00.000000Z" } ] }

Create a product collection

POST /products/collections

Request body

nameRequiredstring
slugRequiredstring

Must be unique among the shop's product collections. A slug already in use returns 422.

typeoptionalstring | null
itemsoptionalobject | null

ReturnsProductCollection

Product collection created

Error responses

422object

name or slug is missing, name is over 255 characters, slug is over 70 characters or already used by a collection of the shop, type is over 50 characters, or an items.create entry has no integer variant_id or a negative position.

curl -X POST https://api.subbly.co/private/v1/products/collections \ -H 'X-API-KEY: <api-key>' \ -H 'Content-Type: application/json' \ -d '{ "name": "name", "slug": "slug", "type": "type", "items": { "create": [ { "variant_id": 1, "position": 0 } ] } }'
Response
{ "id": 1, "shop_id": 1, "name": "Summer Collection", "slug": "summer-collection", "type": "subscription", "published": true, "archived": false, "created_at": "2022-04-01T00:00:00.000000Z", "updated_at": "2022-04-01T00:00:00.000000Z" }

Get product collection by ID

GET /products/collections/{collection_id}

Path parameters

collection_idRequiredinteger

Collection ID

ReturnsProductCollection

Product collection response

Error responses

400object

The collection is archived.

curl https://api.subbly.co/private/v1/products/collections/{collection_id} \ -H 'X-API-KEY: <api-key>'
Response
{ "id": 1, "shop_id": 1, "name": "Summer Collection", "slug": "summer-collection", "type": "subscription", "published": true, "archived": false, "created_at": "2022-04-01T00:00:00.000000Z", "updated_at": "2022-04-01T00:00:00.000000Z" }

Update a product collection

PUT /products/collections/{collection_id}

Path parameters

collection_idRequiredinteger

Collection ID

Request body

nameoptionalstring
slugoptionalstring

Must be unique among the shop's product collections, ignoring this collection itself. A slug used by another collection returns 422.

ReturnsProductCollection

Product collection updated

Error responses

400object

The collection is archived.

curl -X PUT https://api.subbly.co/private/v1/products/collections/{collection_id} \ -H 'X-API-KEY: <api-key>' \ -H 'Content-Type: application/json' \ -d '{ "name": "name", "slug": "slug" }'
Response
{ "id": 1, "shop_id": 1, "name": "Summer Collection", "slug": "summer-collection", "type": "subscription", "published": true, "archived": false, "created_at": "2022-04-01T00:00:00.000000Z", "updated_at": "2022-04-01T00:00:00.000000Z" }

Publish a product collection

POST /products/collections/{collection_id}/publish

Path parameters

collection_idRequiredinteger

Collection ID

ReturnsProductCollection

Product collection published

Error responses

400object

The collection has no items, or the collection is archived.

curl -X POST https://api.subbly.co/private/v1/products/collections/{collection_id}/publish \ -H 'X-API-KEY: <api-key>'
Response
{ "id": 1, "shop_id": 1, "name": "Summer Collection", "slug": "summer-collection", "type": "subscription", "published": true, "archived": false, "created_at": "2022-04-01T00:00:00.000000Z", "updated_at": "2022-04-01T00:00:00.000000Z" }

Unpublish a product collection

POST /products/collections/{collection_id}/unpublish

Path parameters

collection_idRequiredinteger

Collection ID

ReturnsProductCollection

Product collection unpublished

Error responses

400object

The collection is archived.

curl -X POST https://api.subbly.co/private/v1/products/collections/{collection_id}/unpublish \ -H 'X-API-KEY: <api-key>'
Response
{ "id": 1, "shop_id": 1, "name": "Summer Collection", "slug": "summer-collection", "type": "subscription", "published": true, "archived": false, "created_at": "2022-04-01T00:00:00.000000Z", "updated_at": "2022-04-01T00:00:00.000000Z" }

Archive a product collection

POST /products/collections/{collection_id}/archive

Path parameters

collection_idRequiredinteger

Collection ID

ReturnsProductCollection

Product collection archived

Error responses

400object

The collection is archived, so archiving is not idempotent.

curl -X POST https://api.subbly.co/private/v1/products/collections/{collection_id}/archive \ -H 'X-API-KEY: <api-key>'
Response
{ "id": 1, "shop_id": 1, "name": "Summer Collection", "slug": "summer-collection", "type": "subscription", "published": true, "archived": false, "created_at": "2022-04-01T00:00:00.000000Z", "updated_at": "2022-04-01T00:00:00.000000Z" }

Get list of collection groups with items

GET /products/collections/{collection_id}/items

Lists the collection's groups, each with its items. Returns 400 entity_archived if the collection is archived. expand[]: List of relations to expand. product expands the group's parent product. items is always returned; use items.variant to expand each item's variant.

Path parameters

collection_idRequiredinteger

Collection ID

Query parameters

pageoptionalinteger

Page number for pagination

Defaults to 1.

per_pageoptionalinteger

Groups per page; each group carries all of its items.

Defaults to 10.

expand[]optionalstring[]

List of relations to expand in the response. Each expandable field on the response schema names its key, e.g. expand[]=customer. Nested keys use dot notation, e.g. items.product or subscriptions.items. Fields marked as always present are returned without being requested. An expanded list is null, not [], when there are no records. Unknown keys are ignored unless the endpoint says otherwise.

Returnsobject

Collection groups list response

Error responses

400object

The collection is archived (entity_archived).

404object

No collection exists with this ID, or it belongs to another shop.

422object

page is below 1, per_page is outside 1 to 100, or expand is not an array.

curl https://api.subbly.co/private/v1/products/collections/{collection_id}/items \ -H 'X-API-KEY: <api-key>'
Response
{ "pagination": { "current_page": 1, "last_page": 2, "from": 1, "to": 1, "total": 20 }, "data": [ { "id": 1, "collection_id": 1, "product_id": 5, "product": { "id": 1, "bundle_id": 1, "bundle": {}, "bundle_ruleset_id": 1, "bundle_ruleset": {}, "slug": "yellow-t-shirt-with-pokemon-print", "type": "one_time", "name": "Yellow T-shirt with pokemon print", "description": "Yellow T-shirt with pokemon print", "delivery_info": "Free shipping on orders over $100", "collect_shipping_address": true, "gifting_enabled": true, "digital": false, "images": [ {} ], "tags": [ "new", "featured" ], "tags_meta": [], "published": true, "metadata": [ {} ], "created_at": "2022-04-01T00:00:00.000000Z", "updated_at": "2022-04-01T00:00:00.000000Z", "gift_card": false, "gift_card_expiration": null, "funnel_id": 1, "tax_product_code": "tax_product_code", "variants_count": 3, "variants": [ {} ], "options": [ {} ] }, "items": [ { "id": 1, "variant_id": 10, "product_id": 5, "position": 0, "variant": {}, "created_at": "2022-04-01T00:00:00.000000Z", "updated_at": "2022-04-01T00:00:00.000000Z" } ], "created_at": "2022-04-01T00:00:00.000000Z", "updated_at": "2022-04-01T00:00:00.000000Z" } ] }

Sync collection items

POST /products/collections/{collection_id}/items

Create, update, and delete collection items in a single request. Operations run in the order delete, update, create. Returns 400 entity_archived if the collection is archived, and collection_empty if the request would leave a published collection with no items. All three arrays are optional; an empty body is a no-op that returns the current groups. Entries whose id is not part of this collection, and create entries whose variant_id does not resolve to a product, are skipped silently and the request still returns 200. Compare the returned groups against what you sent to confirm.

Path parameters

collection_idRequiredinteger

Collection ID

Request body

createoptionalobject[]
updateoptionalobject[]
deleteoptionalobject[]
idRequiredinteger

Returnsobject

Collection groups with synced items. Always returns the first page of groups (up to 100) with items expanded. The expand parameter is not supported on this operation, so product is never expanded here; call GET /products/collections/{collection_id}/items to expand it.

Error responses

400object

The collection is archived (entity_archived), or the sync would leave a published collection with no items (collection_empty).

404object

No collection exists with this ID, or it belongs to another shop.

422object

create, update or delete is not an array; a create entry has no integer variant_id; an update or delete entry has no integer id; a group_id is not an integer; or a position is negative.

curl -X POST https://api.subbly.co/private/v1/products/collections/{collection_id}/items \ -H 'X-API-KEY: <api-key>' \ -H 'Content-Type: application/json' \ -d '{ "create": [ { "variant_id": 1, "group_id": 1, "position": 0 } ], "update": [ { "id": 1, "position": 0, "group_id": 1 } ], "delete": [ { "id": 1 } ] }'
Response
{ "pagination": { "current_page": 1, "last_page": 2, "from": 1, "to": 1, "total": 20 }, "data": [ { "id": 1, "collection_id": 1, "product_id": 5, "product": { "id": 1, "bundle_id": 1, "bundle": {}, "bundle_ruleset_id": 1, "bundle_ruleset": {}, "slug": "yellow-t-shirt-with-pokemon-print", "type": "one_time", "name": "Yellow T-shirt with pokemon print", "description": "Yellow T-shirt with pokemon print", "delivery_info": "Free shipping on orders over $100", "collect_shipping_address": true, "gifting_enabled": true, "digital": false, "images": [ {} ], "tags": [ "new", "featured" ], "tags_meta": [], "published": true, "metadata": [ {} ], "created_at": "2022-04-01T00:00:00.000000Z", "updated_at": "2022-04-01T00:00:00.000000Z", "gift_card": false, "gift_card_expiration": null, "funnel_id": 1, "tax_product_code": "tax_product_code", "variants_count": 3, "variants": [ {} ], "options": [ {} ] }, "items": [ { "id": 1, "variant_id": 10, "product_id": 5, "position": 0, "variant": {}, "created_at": "2022-04-01T00:00:00.000000Z", "updated_at": "2022-04-01T00:00:00.000000Z" } ], "created_at": "2022-04-01T00:00:00.000000Z", "updated_at": "2022-04-01T00:00:00.000000Z" } ] }
paginationobject
dataProductCollection[]
createoptionalobject[]
idinteger
shop_idinteger
namestring
slugstring
typestring | null
publishedboolean
archivedboolean
created_atstring

Format: date-time.

updated_atstring

Format: date-time.

idinteger
shop_idinteger
namestring
slugstring
typestring | null
publishedboolean
archivedboolean
created_atstring

Format: date-time.

updated_atstring

Format: date-time.

idinteger
shop_idinteger
namestring
slugstring
typestring | null
publishedboolean
archivedboolean
created_atstring

Format: date-time.

updated_atstring

Format: date-time.

idinteger
shop_idinteger
namestring
slugstring
typestring | null
publishedboolean
archivedboolean
created_atstring

Format: date-time.

updated_atstring

Format: date-time.

idinteger
shop_idinteger
namestring
slugstring
typestring | null
publishedboolean
archivedboolean
created_atstring

Format: date-time.

updated_atstring

Format: date-time.

idinteger
shop_idinteger
namestring
slugstring
typestring | null
publishedboolean
archivedboolean
created_atstring

Format: date-time.

updated_atstring

Format: date-time.

paginationobject
dataProductCollectionGroup[]
variant_idRequiredinteger
group_idoptionalinteger | null

Accepted but ignored on create. New items are always placed in the group for the variant's parent product, creating that group if needed. Use update[].group_id to move an existing item.

positionoptionalinteger | null

Sort position. When omitted or null, defaults to the entry's zero-based index within this create array.

idRequiredinteger
positionoptionalinteger | null
group_idoptionalinteger | null
paginationobject
dataProductCollectionGroup[]