Skip to content
Cartly Developers

Authentication

Learn about Cartly's authentication methods: Public API, Session, JWT, and OAuth 2.0.

Authentication Methods

MethodUse CaseAuth Header
Public (none)Storefront API — products, collections, searchX-Shop-ID: {shop_id}
Session CookieCustomer accounts — orders, addresses, wishlist__session cookie
JWT BearerAdmin panel — product management, order processingAuthorization: Bearer {token}
OAuth 2.0Third-party apps — marketplace integrationsAuthorization: Bearer {access_token}

OAuth 2.0 Flow

Cartly implements the standard Authorization Code flow per RFC 6749:

  1. Register your app — Create an OAuth app in the Cartly admin with redirect URIs and requested scopes
  2. Authorization request — Redirect merchant to /oauth/authorize
  3. User consent — Merchant approves requested permissions
  4. Token exchange — Exchange authorization code for access + refresh tokens
  5. API access — Use access token in Bearer header

OAuth Scopes

Available permission scopes for OAuth applications

NameTypeRequiredDescription
products:readscopeNoView products and variants
products:writescopeNoCreate, update, and delete products
orders:readscopeNoView orders and order history
orders:writescopeNoUpdate order status and fulfillment
customers:readscopeNoView customer information
customers:writescopeNoCreate and update customers
metafields:readscopeNoView custom metafields
metafields:writescopeNoCreate, update, and delete metafields
webhooks:managescopeNoManage webhook subscriptions
shop:readscopeNoView shop settings and configuration
collections:readscopeNoView product collections
shipping:readscopeNoView shipping zones and rates
analytics:readscopeNoView analytics and reports

Code Examples

bash
# Step 1: Redirect user to authorize
curl "https://cartly.pro/oauth/authorize?\
  client_id=YOUR_CLIENT_ID&\
  redirect_uri=https://yourapp.com/callback&\
  scope=products:read+orders:read&\
  response_type=code"

# Step 2: Exchange code for token
curl -X POST https://cartly.pro/oauth/token \
  -H "Content-Type: application/json" \
  -d '{"grant_type":"authorization_code","code":"AUTH_CODE","client_id":"YOUR_CLIENT_ID","client_secret":"YOUR_SECRET","redirect_uri":"https://yourapp.com/callback"}'