Typed IDs

Thor resource IDs are opaque typed strings shaped like <prefix>_<payload>. The prefix identifies the resource type and lets Thor reject an ID passed to the wrong argument early.

Copy the complete ID returned by GraphQL. Do not generate IDs, parse the payload, infer creation time, or replace one resource prefix with another. Store IDs as strings even if the underlying database uses another representation.

Common prefixes

ResourcePrefixExample
Storestorestore_...
Channel, including a price channelchch_...
Productproductproduct_...
Product variantvidvid_...
Product pricepriceprice_...
Categorycatcat_...
Collectioncolcol_...
Customercuscus_...
Customer groupcusgrpcusgrp_...
Cartcartcart_...
Cart line itemclicli_...
Orderorderorder_...
Order line itemolioli_...
Product discountpdpd_...
Cart discountcart_discountcart_discount_...
Cart discount codecdccdc_...
Cart discount groupcdgcdg_...
Shipping methodsmsm_...
Shipping method ratesmrsmr_...
Shipping zoneszsz_...
Warehousewarehousewarehouse_...
Inventory entryinventoryinventory_...
Payment gatewaypgpg_...
Paymentpaymentpayment_...
Transactiontxntxn_...
Mediamediamedia_...
Metafield definitionmetafieldmetafield_...
API keyapiapi_...

The type name used in prose or GraphQL does not always equal its ID prefix. In particular, product variants use vid_, channels use ch_, and customers use cus_.

Passing IDs between operations

Code in graphql

The GraphQL scalar is usually ID, but the argument still expects the correct Thor type. For example, priceChannelId expects ch_...; a made-up chn_... or a product ID is invalid.

Application guidance

  • Model IDs as opaque strings in TypeScript, databases, URLs, logs, and queues.
  • If your language supports branded types, use them to prevent mixing IDs before the request reaches Thor.
  • Preserve the ID exactly, including prefix, underscore, payload casing, and length.
  • Use IDs rather than mutable names or slugs for durable relationships and predicate targeting.
  • A GraphQL node(id: ...) lookup can resolve several resource types, but a resource-specific mutation input still enforces its expected type.
  • Never put credentials such as Admin bearer tokens or API keys in an ID field. Authentication values are separate from typed resource IDs.