API Reference

Last updated on 10 April 2026

Technical reference for OpsPilot's API endpoints, authentication, webhooks, plan limits, and system behavior for developers and store administrators.

Under the Hood.
Authentication flows, webhook events, rate limits, and system architecture for developers.
Workflows list with stats and execution data
Webhooks & Events

Shopify webhook topics, event routing, and how workflows are triggered behind the scenes.

Settings page with integration configuration
Auth & Rate Limits

OAuth 2.0 flow, session management, Shopify API rate limits, and plan-based quotas.

OpsPilot is an embedded Shopify app. End-users access it through the Shopify Admin. This reference is intended for developers and store administrators who need to understand the underlying system behavior, API surface, or integration details.

Authentication & Installation

OAuth 2.0 Flow

OpsPilot uses Shopify's standard OAuth 2.0 for authentication. The flow on install:

User installs from Shopify App Store → redirected to /auth/login with their shop domain
Shopify OAuth flow begins; user authorizes permissions
Callback handled at /auth/*; session created with: shop, accessToken, userId, scope, email, firstName, lastName, accountOwner
User record created or verified in database; webhooks registered for the shop
User redirected to /app/dashboard

Required Shopify Scopes

ScopePurpose
read_checkoutsCheckout Abandoned trigger
read_customersCustomer Created trigger, customer data in variables
read_inventoryInventory Level Updated trigger, inventory KPIs
read_ordersOrder Created/Updated triggers, order data in variables
read_productsProduct Updated trigger, product data in variables
OpsPilot uses online sessions only (no offline access tokens). Sessions are valid for the duration of the Shopify admin session.

API Endpoints

EndpointMethodAuthPurpose
/api/scheduled-workflowsPOSTQSTASH signing key or CRON_SECRET Bearer tokenTrigger scheduled and delayed workflow execution
/api/item-actionsPOSTCORS (Shopify admin surface)Create tasks and notes from Shopify order/product/customer pages via the app extension
/healthGETNoneHealth check — returns 200 OK if the service is running
/readyGETNoneReadiness probe — used by infrastructure to confirm the app is ready to serve traffic
/webhooksPOSTShopify HMAC signatureGeneric Shopify webhook receiver — routes to appropriate handler by topic
/webhooks/app/scopes_updatePOSTShopify HMACRegistered but not yet implemented — scope changes do not trigger any action
/webhooks/app/uninstalledPOSTShopify HMACApp uninstall webhook — removes all sessions for the shop

/api/scheduled-workflows

Triggers the scheduled workflow runner. Called by a cron job or queue service (e.g., QStash). Supports three execution modes:

ModeDescription
scheduledRun all workflows whose cron schedule matches the current time
delayedExecute all delayed actions whose executeAfter timestamp has passed
allRun both scheduled and delayed

/api/item-actions

Allows the Shopify Admin app extension to create tasks and notes directly from order, product, and customer pages inside Shopify. Uses CORS authentication tied to the Shopify admin surface.

Shopify Webhooks

OpsPilot registers the following Shopify webhook topics on installation:

Webhook TopicOpsPilot TriggerNotes
orders/createOrder CreatedFires when any new order is placed
orders/updatedOrder UpdatedFires on status, tag, or fulfillment changes
checkouts/deleteCheckout AbandonedFires when a checkout is abandoned
inventory_levels/updateInventory Level UpdatedFires when inventory quantity changes for a variant
customers/createCustomer CreatedFires when a new customer account is created
products/updateProduct UpdatedFires when any product field is modified
app/uninstalledApp UninstallDeletes all sessions for the shop
app/scopes_updateRegistered but not yet handled
All webhook payloads are verified using Shopify's HMAC signature before processing. Payloads larger than 50 KB are truncated to a summary snapshot before being stored in execution logs.

Plan Limits

FeatureFREESTARTERGROWTH
Active workflows1520
Workflow runs / monthLow (env-configurable)5005,000
Actions per workflow21020
Email action
Slack action
Google Sheets action
Analytics dashboard

New shops automatically receive a 14-day STARTER trial on first install (if not previously used). After the trial, the plan reverts to FREE unless a subscription is active. Plan limits are enforced on every workflow execution — runs over the monthly limit are SKIPPED.

Edge Cases & Special Flows

Workflow Execution Edge Cases

ScenarioBehavior
Payload is not a valid objectWorkflow SKIPPED with warning
Condition schema invalidWorkflow FAILED ("Invalid workflow definition")
Monthly run limit exceededWorkflow SKIPPED — checked before conditions
No active users in shopExecution halted with error
Recursive workflow depth > 2Workflow SKIPPED with warning
All actions filtered by plan/setupWorkflow SKIPPED (not FAILED)
Payload >50KBTruncated to summary (_truncated: true)
Delayed workflow — workflow deleted/disabled before executionAction SKIPPED
Delayed workflow — conditions no longer match at execution timeAction SKIPPED
Nested delay (delay within a delayed action)Re-queued action SKIPPED
Concurrent delayed action workersAtomic row claim prevents double-processing
CREATE_ONCE_PER_ENTITY + entity in closed statusNew task created instead of updating
24h dedup — same fingerprint detectedAction SKIPPED unless forceExecuteDuplicates: true
Aggregate scheduled workflowOne task per entity; entity ID = workflow-aggregate:${workflowId}

Auth & Installation Edge Cases

ScenarioBehavior
App already installed — user re-opensExisting session reused; no new OAuth flow
Uninstall webhook fires multiple timesSafe — checks if session exists before deleting
User re-opens app after uninstallFull OAuth flow restarts
Trial already used on previous installNo auto-trial on re-install
Multiple paid Shopify subscriptionsHighest tier wins
Paid plan in DB but no active Shopify subscriptionTriggers immediate downgrade
Upgrade before scheduled downgrade dateCancels the scheduled downgrade

Email Domain Edge Cases

ScenarioBehavior
Domain already claimed by another shopError returned with owning shop's domain
Race condition on domain claim (P2002)Re-queried to report actual owner
Domain removed while sender email uses itSender email auto-cleared
Domain status stored as "error"Normalized to "pending" in UI
Legacy shop (created before domain locking)Auto-claims used domains via legacy backfill

Task Edge Cases

ScenarioBehavior
Empty or whitespace-only titleRejected
Due date in the pastRejected
Assigned user inactive or from different shopRejected
Bulk delete by non-adminRejected
Auto-archive unit not days or weeksIgnored — no archive performed
Task notes on deleteSoft-deleted, not hard-deleted

Onboarding Behavior

On first install, OpsPilot automatically: