xcladeDocs

Merchant Admin GraphQL

Complete guide and operation reference for POST /admin/graphql (31 Queries, 65 Mutations, RBAC & SSE)

Merchant Admin GraphQL (/admin/graphql)

Every xclade store exposes a dedicated Merchant Admin GraphQL surface at:

POST https://{shortId}.api.myxclade.com/admin/graphql

Built natively in Go (gqlgen), /admin/graphql powers the Store Admin Console (/app), back-office automations, ERP syncs, warehouse operations, and @xclade/sdk admin methods.


Key Capabilities

  • 31 Queries & 65 Mutations spanning catalog, pricing, WMS bins & cycle counts, orders, draft orders, fulfillments, refunds, returns, B2B quotes/approvals, analytics, ERP connections, webhooks, RBAC, and batch imports.
  • Fine-Grained RBAC: Every operation is protected by AdminRBACGuard and the @requirePermission schema directive.
  • Live SSE Transport: Supports Server-Sent Events (transport.SSE with 15-second keep-alive pings) alongside POST and GET.
  • Higher Admin Limits: Allows up to 16 MiB payloads (for batch imports), depth 14, 30 aliases, and 75 directives.
  • CSRF Guard: Always enabled on GET operations—send X-Xclade-Request: true or X-GraphQL-Request: true.

Authentication

Authenticate admin requests using any of three supported methods:

  1. Admin JWT Bearer Token — Obtained from adminLogin(email, password) or redeemAdminSso(token):
    Authorization: Bearer eyJhbGciOi...
  2. Merchant Secret API Key (sk_...) — Ideal for server-to-server ERP/CI scripts:
    Authorization: Bearer sk_live_...
  3. Admin Session Cookie — Automatically set for browser sessions inside /app.

Sign In Example

mutation AdminLogin($email: String!, $password: String!) {
  adminLogin(email: $email, password: $password)
}
query AdminMe {
  adminMe {
    id
    email
    first_name
    last_name
    is_super_admin
    policies
    roles {
      id
      name
      slug
      is_system
    }
  }
}

Admin Queries (31)

Identity, Store Configuration & RBAC

QueryDescription
adminMeFetch the authenticated admin user, assigned roles, and effective RBAC policy keys.
storeConfigFetch store name, default currency/region/sales channel/stock location, return window, and metadata.
adminUsersList store administrator accounts and their assigned roles.
rbacRolesList custom and system RBAC roles.
rbacPoliciesList available RBAC permission policies.
publishableKeysList storefront Publishable API Keys (pk_...) and linked sales channels.
salesChannelsList configured sales channels.
taxRegionsList tax regions and default rates.
shippingProfilesList fulfillment shipping profiles.
customerGroupsList customer groups (including B2B contract groups).
vendorsList marketplace vendors.

Catalog, Pricing & Effective-Price Debugger

QueryDescription
adminProductsPaginated SQL-joined catalog list with variant counts, inventory totals, and filters.
adminPriceListsList sale and override price lists.
adminPriceListPageFetch a price list with paginated variant price rows.
resolveEffectivePricesDebug exact effective price resolution for variants given currency, region, customer group, or quantity.

Inventory & Warehouse Management (WMS)

QueryDescription
stockLocationsList warehouses and fulfillment locations.
inventoryLevelsInspect stocked, reserved, and available quantities per location.
adminInventoryItemsPaginated inventory items with SKU and stock summaries.
warehouseBins(location_id)List warehouse storage bins (zone, aisle, rack, shelf, capacity).
cycleCountSessions(location_id)List warehouse physical inventory cycle count sessions.

Orders, Customers, Analytics & Integrations

QueryDescription
adminOrdersPaginated orders & draft orders with status, channel, region, customer, and B2B company filters.
adminCustomersSearchable customer directory with account filters.
analyticsOverview(from, to, currency_code)Revenue, order count, AOV, and conversion metrics.
adminB2BOverviewB2B pipeline metrics across companies, pending quotes, and approvals.
abandonedCartStats(days)Aggregate abandoned cart recovery statistics.
abandonedCarts(limit, offset, stage)List active abandoned carts by recovery stage.
providerConfigsList payment, shipping, search, and verification (e.g. ID Rabbit) provider configs.
erpConnectionsList configured ERP integrations (Zoho, NetSuite, etc.).
webhookEndpointsList tenant outbound webhook subscriptions.
adminQuery / adminFetchQueryGeneric domain query dispatchers used by internal console tooling.

Admin Mutations (65)

Auth, Store Setup, RBAC & Uploads

  • adminLogin, adminLogout, redeemAdminSso
  • createPresignedUpload (direct-to-S3 media upload URLs)
  • updateStoreConfig, upsertRegion, upsertSalesChannel, upsertTaxRegion, upsertShippingOption
  • inviteAdminUser, upsertRbacRole, assignUserRoles
  • createPublishableKey, revokePublishableKey
  • upsertProduct, deleteProduct, upsertCategory, upsertCollection, upsertBrand, upsertVendor
  • moderateReview, reindexSearch (triggers full Typesense catalog reindex)
  • upsertCustomerGroup, upsertCampaign
  • upsertPriceList, deletePriceList, upsertPromotion, deletePromotion

Inventory & Warehouse Management (WMS)

  • upsertStockLocation, adjustInventoryLevel
  • upsertWarehouseBin, startCycleCountSession, completeCycleCountSession

Orders, Fulfillments, Payments, Returns & B2B Quotes

  • createDraftOrder, convertDraftOrder
  • createOrderFulfillment, markFulfillmentShipped, markFulfillmentDelivered
  • captureOrderPayment, refundOrderPayment, cancelOrder
  • stageOrderEdit, confirmOrderEdit, receiveReturn
  • sendQuoteOffer, merchantRejectQuote

Storefront CMS, Providers, ERP & Webhooks

  • updateBrandSettings, upsertNavigationMenu, upsertHeroSlider, updateSeoSettings, upsertAdvertisement, upsertChangelog
  • upsertProviderConfig, verifyProviderConfig
  • upsertErpConnection, triggerErpSync
  • upsertWebhookEndpoint, deleteWebhookEndpoint

High-Throughput Batch Importers

  • importCategoriesBatch, importCollectionsBatch, importProductsBatch, importCustomersBatch, importOrdersBatch
  • adminMutate, adminFetchMutate

Using @xclade/sdk for Admin Operations

import { createXcladeSDK } from '@xclade/sdk';

const admin = createXcladeSDK({
  baseUrl: 'https://{shortId}.api.myxclade.com',
  apiKey: process.env.XCLADE_SECRET_KEY, // sk_live_...
});

const { products, count } = await admin.graphql.listProducts({ limit: 25, offset: 0 });
const overview = await admin.graphql.analyticsOverview({ currency_code: 'usd' });

See the @xclade/sdk guide for complete TypeScript SDK examples.

On this page