API Reference

Everything you need to integrate Skawr search into your application. Base URL: https://api.skawr.com

Getting Started

Sign up at skawr.com/search/import, then paste your store URL or upload a CSV to index your products. You'll get an API key immediately.

Authentication

Every request carries an API key in the X-API-Key header. Each store gets a pair, created in the dashboard under API Keys: • Public key (pk_...): safe to put in a web page or app. It can search and autocomplete and nothing else, whatever your plan includes. You can restrict it to your own website's origins. • Secret key (sk_...): for your server only. It can do everything your plan includes: upload documents, read usage and analytics, configure SkawrBot. Never ship it to a browser or a mobile app. Lost a secret key? Rotate it in the dashboard; the old one stops working.

Autocomplete

GET/api/v1/autocomplete

Get instant search suggestions as users type.

Headers
X-API-Key: pk_your_public_key
Request
json
GET /api/v1/autocomplete?q=ipho&limit=5
Response
json
{
  "suggestions": [
    "iPhone 15 Pro",
    "iPhone 15 Pro Max",
    "iPhone case",
    "iPhone charger"
  ]
}

Upload Documents

POST/api/v1/saas/indices/{index}/documents

Add or update documents in your search index, up to 1,000 per request. Search matches text in title, description and category, and semantic search is built from title, description and brand. Put your text in those fields: a document whose text lives anywhere else (for example name.ar or a nested array) is stored but cannot be found. If none of the documents you upload has any of them, the response says so in warnings.

Headers
X-API-Key: sk_your_secret_key (secret key required)
Content-Type: application/json
Request
json
{
  "documents": [
    {
      "id": "prod_001",
      "title": "Samsung Galaxy S24 Ultra",
      "description": "256GB, titanium black, 200MP camera",
      "category": "Phones",
      "brand": "Samsung",
      "price": 4699,
      "currency": "SAR",
      "image_url": "https://...",
      "product_url": "https://..."
    }
  ]
}
Response
json
{
  "successful_uploads": 1,
  "failed_uploads": 0,
  "skipped_uploads": 0,
  "message": "Uploaded 1 documents to 'products'",
  "searchable_uploads": 1,
  "embeddable_uploads": 1,
  "warnings": []
}

Upload Warnings

warnings[]in the upload response

An upload can be accepted and still be unusable, so the response carries warnings. Each one has a stable code you can switch on, and a message meant for a person. no_searchable_text: not one document has a title, description or category holding text, so search will not find any of them. no_embeddable_text: not one document has text in the fields this index builds its semantic search from, so no document got a vector. Both fire only when the count is zero. A partial upload reports its searchable_uploads and embeddable_uploads counts and stays quiet.

Headers
X-API-Key: sk_your_secret_key (secret key required)
Response
json
{
  "successful_uploads": 100,
  "failed_uploads": 0,
  "skipped_uploads": 0,
  "message": "Uploaded 100 documents to 'products'",
  "searchable_uploads": 0,
  "embeddable_uploads": 0,
  "warnings": [
    {
      "code": "no_searchable_text",
      "message": "100 documents indexed, but none of them has a title, description or category field with text in it, so search will not find them. Your text appears to be in name.ar. Map your text into those fields and upload again."
    }
  ]
}

Usage & Limits

GET/api/v1/saas/usage

Check your current usage against your plan limits.

Headers
X-API-Key: sk_your_secret_key
Request
json
GET /api/v1/saas/usage
Response
json
{
  "plan": "Growth",
  "products_indexed": 12847,
  "products_limit": 50000,
  "searches_this_month": 23419,
  "searches_limit": 500000
}

SkawrBot

SkawrBot is a Q&A chat assistant you embed on your storefront. Shoppers ask questions in plain language, and it answers from a built-in FAQ set plus any custom FAQ pairs you configure. For product questions, it falls back to a search over your index. By default it makes no external AI calls, so replies stay fast and predictable. A store can also turn on the shopping assistant, which answers product questions with a language model grounded in the store's own catalogue and policies. SkawrBot is on every plan, alongside SkawrBar and the Skawr Search Widget. Each plan is sized for 500 conversations a month on Growth, 2,000 on Pro and 6,000 on Scale, and a conversation counts once, when its first answer runs. Going over changes nothing for shoppers and adds no charge. Embed it with a single script tag, the same way as the other storefront widgets. Use your public key (pk_...), which is safe to expose in the browser. The widget loads its settings from GET /api/v1/skawrbot/config and sends shopper messages to POST /api/v1/skawrbot/message.

Embed
html
<script
  src="https://api.skawr.com/static/skawrbot.js"
  data-skawr-key="pk_your_public_key"
  async
></script>

SkawrBot Message

POST/api/v1/skawrbot/message

Answer a shopper message. Matches against your FAQ set first, then falls back to a product search over your index. Configure the greeting, suggested questions, and custom FAQ pairs via POST /api/v1/skawrbot/config.

Headers
X-API-Key: pk_your_public_key
Content-Type: application/json
Request
json
{
  "message": "do you have running shoes?"
}
Response
json
{
  "answer": "Here is what I found in our store. You can also search for more.",
  "matched": true,
  "type": "product",
  "products": [
    {
      "title": "Nike Air Zoom Running Shoes",
      "url": "https://store.example.com/products/air-zoom",
      "image_url": "https://store.example.com/img/air-zoom.jpg"
    }
  ]
}

Use SKAWR from AI tools

Connect a SKAWR store to Claude, ChatGPT or any MCP client, and an AI assistant can search the store's products the same way its own search bar does: SKAWR's relevance judge decides what is shown, nothing the judge rejects is returned, and every product link points at the store's own website. Agents read; they never change anything. There is no access to orders, carts, customers or settings. Create a connection (store owners) In the SKAWR dashboard, open Integrations, then Connect to AI tools, and create a connection. It is a private link you can name and revoke at any time, up to three per store. Available on every plan. • Claude: Customize, Connectors, Add, Add custom connector. Paste the connection link and save. • ChatGPT (web): Plugins, the plus button, Add custom MCP server. Paste the connection link and click Create as a plugin. Then ask in Arabic or English, for example "ابي شامبو للشعر الجاف تحت ١٠٠ ريال". For developers Call the server from your own agent with your public key instead of a connection link: POST https://api.skawr.com/mcp/store Authorization: Bearer pk_your_public_key It speaks MCP over Streamable HTTP (protocol 2025-06-18) and is stateless. The server's instructions tell the agent to answer in the shopper's language, never translate a product title, and say so when the store does not sell something. The tools • store_info: what the store sells, its languages, currency, categories and price range. Call it first. • search_products: search with the store's own relevance judge; returns no_match when nothing fits. • get_product: one product by id. • store_brands: the brands the store carries, and which one a phrase names. • store_knowledge: the store's FAQs, policies, size guides and notes. • compare_products: two to four products side by side; a value the store did not give is null, never a guess. • find_similar: products like one product, optionally in another colour, size, material or a lower price. • search and fetch: the same search and lookup in the shape ChatGPT connectors expect. Every tool returns structured data with a published schema. In ChatGPT, Claude and other hosts that support MCP Apps, search_products, find_similar and compare_products also show product cards with the store's own photos and links; other clients get the same results as text. Limits 60 calls a minute and 2,000 a day per connection. search_products, find_similar and compare_products count as searches against your plan; the lookups are free. An agent's searches wait for the full relevance judge, so expect a few seconds per search. Manage your own store from AI tools (merchants) A second connector is for you rather than your shoppers. It reads your own store: searches and the searches that found nothing, catalogue health, analytics, SkawrBot conversations, plan usage and what is switched on, the plan, subscription and invoices, the team (owner only), API keys as names and dates only, the catalogue sync status and update log, the store activity log (owners and admins only), and the search page, sold-out, recommendation, SkawrBot, notification and time zone settings. It can also ask for changes, which wait for approval in the SKAWR dashboard. You sign in with your SKAWR account, so there is no link or key to copy. • Claude: Customize, Connectors, then the plus button next to Connectors. SKAWR is in the Connectors Directory: open it, click Connect and sign in to SKAWR. If it is not listed, Add, Add custom connector, paste https://mcp.skawr.com/mcp and sign in when asked. • ChatGPT (web): Plugins, the plus button, Add custom MCP server. Paste https://mcp.skawr.com/mcp, choose OAuth, click Create as a plugin, then sign in to SKAWR when asked. OpenAI offers this on ChatGPT Business, Enterprise and Edu; on ChatGPT Pro it can read but not change anything. ChatGPT and Claude are the clients it accepts today. Steps for each: https://skawr.com/search/ai-assistants What it can draft: SkawrBars (create, edit, switch on or off, delete); SkawrBot's greeting, suggested questions and FAQ answers, its Talk to a person settings and what it can do, and switching it or the shopping assistant on or off; your search rules (pins, first or last, hide, synonyms, redirects); the search page switches; where sold-out products go; the recommendation rows; the store's time zone and each email notification; and a catalogue resync (once a day, plus one retry within 12 hours after one that did not finish; a resync cannot be undone). The AI app never applies anything itself: every change returns a preview and a review link, and waits on the Approvals page in the SKAWR dashboard for an owner or admin to approve it. Owners and admins get an email with a Review the change button; it never includes the change's values, a store gets at most 10 an hour and then one summary, and the Requests from AI apps notification setting turns them off. Most applied changes can be undone within 24 hours; an unapproved request expires after 24 hours. Ask for your recent changes to see what was applied. Owner-only requests: for the store's owner it can also ask for a plan change (upgrade, downgrade, monthly or annual billing, cancel at the period end, reactivate), a team change (invite, resend an invite, change a role, remove someone), an API key change (create, rotate, revoke, set a public key's allowed sites) and closing the account. Only the owner approves these, in the dashboard, after signing in again; closing the account also needs the store's name typed, and a new key is shown only in the dashboard, never to the AI app. What it cannot change: card or payment details (it can give a link to the billing page), showing an existing API key, transferring ownership or the owner role, a sign-in email, password or two-step sign-in, switching off the account and billing emails, how search ranks, or stores your account does not belong to. Use the dashboard for those. If your sign-in belongs to several stores, it works on each of them; say which store you mean. Someone with the viewer role can read but not change anything; changes need the owner or admin role. Answers cover up to the last 90 days, and the limits are 60 calls a minute and 2,000 a day. For coding agents https://skawr.com/llms.txt and /llms-full.txt carry these docs in plain text, https://api.skawr.com/.well-known/mcp describes the server, and the skills/skawr-search folder in the SKAWR SDKs repository teaches an agent to integrate SKAWR.

SDKs & Integrations

Published SDKs, all used with your public key: • JavaScript and TypeScript: @skawr/search on npm (search and autocomplete only) • React Native: @skawr/react-native on npm • Flutter/Dart: skawr_search on pub.dev • Search widget: one script tag, https://cdn.skawr.com/widget/v1/skawr-widget.js with data-key set to your public key. Your SKAWR dashboard builds the snippet for you under Widget. On a server, call the REST API with your secret key from any HTTP client. Server SDKs for JavaScript and PHP are in the SKAWR SDKs repository but are not published to npm or Packagist yet. Native apps: SKAWR has zero-code apps for Salla, Shopify and Zid. The Salla app is live on the Salla App Store at https://s.salla.sa/apps/view/1239496186, the Shopify app on the Shopify App Store at https://apps.shopify.com/skawr-search-companion and the Zid app on the Zid App Market at https://apps.zid.sa/en-sa/apps/8773, where you install it and choose a plan. Once installed, the app indexes the store's catalogue, keeps it in sync, and puts SKAWR behind the theme's own search, with no key or code to paste. SkawrBar and SkawrBot show on the store once you set them up in the dashboard, on the plans that include them. • Shopify: switch on the SKAWR Search app embed in your theme (Themes, Customize, App embeds). Only products a shopper can buy are indexed: active and published to the Online Store. Your plan is billed through Shopify. • Salla: the widget follows your store's default language. A store that installed before this needs to approve the app's updated permissions in Salla; until then the widget stays in Arabic. • Zid: search takes over your theme's own search box. Your plan is billed through Zid in Saudi riyals, with a 14-day free trial and no usage charges: past the plan's limit, SKAWR asks you to upgrade.

Analytics SDK

Product analytics is bundled with your Search SaaS plan. Send events from the browser, your server, or a mobile app, then view them in the dashboard.

The Analytics SDK ships for the platforms you are most likely to use: • @skawr/analytics-react: React and Next.js • @skawr/analytics-web: vanilla browser (no framework) • @skawr/analytics-node: server side (Node) • skawr-analytics: Python (PyPI) • skawr_analytics: Flutter and Dart Every SDK talks to the same ingest API. It sends POST /api/v1/events/track for events, POST /api/v1/events/identify for identity, and POST /api/v1/heatmaps/batch for heatmap interactions. Requests authenticate with the X-API-Key header, and each SDK also sends an X-SDK-Name header (react, web, node, python, or flutter) that shows up as a "by tool" breakdown in the dashboard. The default endpoint is https://analytics-api.skawr.com, which you can override with the endpoint option.

React and Next Quickstart

Wrap your app once in the Skawr provider. Pageviews are captured out of the box, and you opt in to the rest.

Install the package, then wrap your app at the root. Pass your logged-in user through the user prop so the SDK identifies and resets automatically as auth state changes. See the API keys section first: a key used in the browser must be track-only.

Install
bash
npm install @skawr/analytics-react
# or
pnpm add @skawr/analytics-react
app/layout.tsx
tsx
import { Skawr } from '@skawr/analytics-react'

export default function RootLayout({ children }: { children: React.ReactNode }) {
  // your auth provider: an object with id, email, name, or null when signed out
  const user = useCurrentUser()

  return (
    <html>
      <body>
        <Skawr
          apiKey={process.env.NEXT_PUBLIC_SKAWR_ANALYTICS_KEY!}
          autoPageviews
          autoClicks
          autoForms
          autoErrors
          heatmap
          attribution
          user={user}
        >
          {children}
        </Skawr>
      </body>
    </html>
  )
}
Identify through the user prop
When user is set, the SDK identifies that person. When it goes back to null (sign out), the SDK resets. You do not need to call identify or reset by hand for normal login and logout.

Browser SDK

For sites that do not use React. This is the @skawr/analytics-web equivalent of the React setup.

Use the browser SDK on plain HTML or non-React sites. It mirrors the React configuration: the same apiKey, endpoint, autoPageviews, autoClicks, autoForms, autoErrors, and heatmap options, plus a track call for custom events. The snippet below is illustrative of the browser SDK surface. Confirm the exact export and method names against the @skawr/analytics-web package README, since they can differ slightly from the React provider.

Install
bash
npm install @skawr/analytics-web
Initialize and track (illustrative)
js
import { Skawr } from '@skawr/analytics-web'

const skawr = Skawr.init({
  apiKey: 'ska_your_track_only_key',
  endpoint: 'https://analytics-api.skawr.com',
  autoPageviews: true,
  autoClicks: true,
  autoForms: true,
  autoErrors: true,
  heatmap: true,
})

// custom event
skawr.track('newsletter_signup', { plan: 'growth' })

Node (server side)

Send events from your backend with @skawr/analytics-node.

Use the Node SDK for server-side events, for example a confirmed payment from a webhook. A server-side key is not exposed to browsers, so it may carry the query permission in addition to track. The snippet below is illustrative of the server SDK surface. Confirm the exact constructor and method names against the @skawr/analytics-node package README.

Install
bash
npm install @skawr/analytics-node
Track a server-side event (illustrative)
js
import { Skawr } from '@skawr/analytics-node'

const skawr = new Skawr({
  apiKey: process.env.SKAWR_ANALYTICS_SERVER_KEY, // server key, may include query
  endpoint: 'https://analytics-api.skawr.com',
})

await skawr.track({
  event: 'order_paid',
  userId: 'user_123',
  properties: { value: 4299, currency: 'SAR' },
})

Python and Flutter

Minimal server (Python) and mobile (Flutter) examples.

Install skawr-analytics from PyPI for Python, or add skawr_analytics to pubspec.yaml for Flutter and Dart. The snippets below are illustrative of each SDK surface, including the version pin. Confirm the exact class and method names and the current version against each package README before relying on them.

Python: install
bash
pip install skawr-analytics
Python: track (illustrative)
python
from skawr_analytics import Skawr

skawr = Skawr(api_key="ska_your_server_key", endpoint="https://analytics-api.skawr.com")

skawr.track("order_paid", user_id="user_123", properties={"value": 4299, "currency": "SAR"})
Flutter: pubspec.yaml (illustrative)
yaml
dependencies:
  skawr_analytics: ^0.1.0
Flutter: track (illustrative)
dart
final skawr = Skawr(apiKey: 'ska_your_track_only_key');

skawr.track('order_paid', properties: {'value': 4299, 'currency': 'SAR'});

Getting your API key

Create and scope keys in the dashboard, then follow one rule for browser code.

Create analytics keys in the dashboard under Settings, then API keys. Keys carry permissions. A track key can send events. A query key can also read your analytics data. Scope each key to where it runs. Browser code (React, the browser SDK, mobile apps that ship the key) should use a track-only key. Server code (Node, Python) can use a key that also has query, because it is never exposed to a shopper.

A key used in the browser must be track-only
Never put a key with the query permission in browser code or a mobile bundle. A query key can read your analytics data, so exposing it would let anyone pull your numbers. Use a track-only key on the client and keep query keys on the server.

Autocapture

Capture common interactions without writing tracking calls.

Autocapture records pageviews, clicks, form submits, and JavaScript errors for you. Turn on the streams you want with the autoPageviews, autoClicks, autoForms, and autoErrors props. Clicks on links, buttons, and any element with a data-skawr-track attribute are captured, form submits include non-sensitive fields, and errors come from window error and unhandled rejection handlers.

Enable the streams you want
tsx
<Skawr
  apiKey={KEY}
  autoPageviews
  autoClicks
  autoForms
  autoErrors
>
  {children}
</Skawr>
Autocapture is opt-in since 0.7.0
As of @skawr/analytics-react 0.7.0, only pageviews are on by default. Clicks, form submits, and errors are opt-in. If you want them, set autoClicks, autoForms, and autoErrors explicitly. On older versions they were on by default.

Named and custom events

Track your own events from code or from markup.

Track custom events three ways. Call track from the useSkawr hook for events tied to an interaction, use useTrackOnMount for an event that should fire once when a component mounts, or add a data-skawr-track attribute to any element to capture it on click. Any data-skawr-* attribute becomes a property, and numbers and booleans are coerced to their primitive types. Name events in lowercase snake_case, for example purchase, newsletter_signup, or listing_clicked. Keep names stable so your reports stay consistent.

Hooks
tsx
import { useSkawr, useTrackOnMount } from '@skawr/analytics-react'

function CheckoutButton({ value }: { value: number }) {
  const { track } = useSkawr()
  return (
    <button onClick={() => track('purchase', { value, currency: 'SAR' })}>
      Buy
    </button>
  )
}

function ArticlePage({ slug }: { slug: string }) {
  useTrackOnMount('article_viewed', { slug }) // fires once on mount
  return <article>...</article>
}
Declarative markup
tsx
<button
  data-skawr-track="listing_clicked"
  data-skawr-listing-id={listing.id}
  data-skawr-price={listing.price}
>
  View listing
</button>
Keep personal data out of event properties
Do: use lowercase snake_case names. Keep properties non-identifying. Use query_length instead of the raw query, reduce URLs to their hostname, and send ids rather than names. Don't: put emails, names, phone numbers, or message text in event properties. Add data-skawr-skip to sensitive inputs so form autocapture leaves them out. Password and file fields are never captured.

Identify and reset

Tie events to a known user after login, and clear identity on logout.

The simplest path in React is the user prop on the Skawr provider: set it after login, clear it on logout, and the SDK identifies and resets for you. If you need to do it by hand, useSkawr returns identify and reset. Call identify with your stable user id after login, and call reset on logout so the next session starts anonymous.

Imperative identify and reset
tsx
import { useSkawr } from '@skawr/analytics-react'

function useAuthAnalytics() {
  const { identify, reset } = useSkawr()

  return {
    onLogin: (user: { id: string; plan: string }) =>
      identify(user.id, { plan: user.plan }),
    onLogout: () => reset(),
  }
}

Heatmaps

Record click, scroll, and optional move interactions.

Set the heatmap prop to true to start the recorder, or pass an object to choose which signals to record. The recorder posts interactions to POST /api/v1/heatmaps/batch. trackMoves is the highest-volume signal, so leave it off unless you need mouse movement, to keep request volume down.

Choose which signals to record
tsx
<Skawr
  apiKey={KEY}
  heatmap={{ trackClicks: true, trackScroll: true, trackMoves: false }}
>
  {children}
</Skawr>
Current caveat: no DOM snapshot yet
The recorder posts interactions but not DOM snapshots. Until snapshot capture ships, the dashboard density grid renders without a page-background image. The interaction data is still recorded and shown.

Verify it works

A short checklist to confirm events are flowing.

Run through this after wiring the SDK: 1. Open your browser developer tools, go to the Network tab, and use your site. Confirm you see POST requests to /api/v1/events/track. 2. Open the analytics dashboard and confirm your SDK appears in the "by tool" breakdown (react, web, node, python, or flutter). 3. If you see nothing, the usual causes are an unset or empty key, a key without the track permission, or autocapture left off. Fix whichever applies and reload.

Troubleshooting

Common symptoms mapped to cause and fix.

No requests in the Network tab: the key is unset or empty. Confirm the environment variable is set at build time and holds a real track key. track requests return 401 or 403: the key lacks the track permission or belongs to the wrong project. Create a track-only key in Settings, then API keys. Clicks, form submits, or errors are missing: autocapture is opt-in since 0.7.0. Set autoClicks, autoForms, and autoErrors on the provider. Events do not appear under your SDK in the dashboard: check the "by tool" breakdown and make sure you are on a current SDK version, which sends the X-SDK-Name header. Heatmap density grid has no background image: this is expected for now, since DOM snapshot capture has not shipped. Interactions are still recorded.