Askagento API
Install, uninstall, status, recommendations, search, chatbot, BYOK, label, filter, MCP, plan, usage.
Bring-your-own-key (BYOK) LLM credentials
Store or clear a merchant-supplied OpenAI or OpenRouter API key on the install record.
When a BYOK key is stored, POST /chatbot uses that key for inference and does not
debit limits.tokens (the merchant pays their provider directly). Clearing removes the
key and restores the shared AskAgento LLM path with normal token metering.
Providers: openai, openrouter only (OpenAI-compatible chat completions).
Authentication: Send X-Askagento-Site-Id: <site_id> and X-Askagento-Api-Key: <api_key> headers. <api_key> must be the secret key; the public key is rejected with 401.
Bring-your-own-key (BYOK) LLM credentials › Request Body
actionset stores the merchant key; clear removes BYOK credentials from the install record.
providerRequired when action=set.
api_keyMerchant LLM API key. Required when action=set. Never logged by the API.
modelOptional model id for action=set (e.g. gpt-5-mini for OpenAI, or an OpenRouter
model id). When omitted, the chatbot uses the server default (OpenRouter ids are
prefixed with openai/ when needed).
Bring-your-own-key (BYOK) LLM credentials › Responses
BYOK config stored or cleared
statussite_idbyokTrue when a BYOK key is stored after this request; false after clear.
providerPresent when byok is true (the provider just stored).
AI Chatbot
Sends a conversation to a configured chat model.
action=chat — The last user message drives semantic product search against the site's
catalogue (up to 12 matches). Matching products are injected as a system message before the LLM
request. Retrieval does not debit limits.searches. If search or catalogue load fails, the chat
continues without product context.
action=health — Minimal connectivity check: messages is ignored, completion is capped
at 3 tokens, and products_retrieved is always 0. Upstream usage.total_tokens is still
debited from limits.tokens when that limit is tracked (typically a few tokens), unless BYOK
is active (see below).
BYOK — If the site has a merchant key stored via POST /byok, that key is used instead of
the shared AskAgento LLM credentials. Token preflight and limits.tokens debit are skipped
while BYOK is active (usage.billed_tokens is 0).
Token preflight (429 when limits.tokens is present and <= 0) applies when BYOK is not active.
Authentication: Send X-Askagento-Site-Id: <site_id> and X-Askagento-Api-Key: <api_key> headers. <api_key> can be the public key or the secret key; use the public key in browser code and AI agent configs.
AI Chatbot › Request Body
actionchat — full conversation; last user turn drives product retrieval (see POST /chatbot).
health — connectivity probe; messages optional and ignored; max_completion_tokens ignored.
Required when action=chat (non-empty after normalization); omitted or ignored for health. Up to 24 turns; each content truncated to 12 000 chars.
max_completion_tokensAlias max_tokens also accepted; capped at 4096. Ignored when action=health (server uses 3).
AI Chatbot › Responses
Chat reply with usage and limit information
site_idactionlatency_msRound-trip latency to the chat provider in milliseconds
replyText reply from the model
products_retrievedNumber of catalogue products injected as context for action=chat; always 0 for health
limits_tokens_remainingRemaining token quota for the site after this call; null if no quota is set
Auto Filter
Auto Filter pipeline (no LLM). analyze lists attribute names found in the synced catalog;
generate echoes the merchant-selected canonical_filters; upload stores the selection on the catalog snapshot.
Accepts action or filter_action (analyze, generate, upload, export). Optional canonical_filters
is an alias for canonical_attributes.
Authentication: Send X-Askagento-Site-Id: <site_id> and X-Askagento-Api-Key: <api_key> headers. <api_key> must be the secret key; the public key is rejected with 401.
Auto Filter › Request Body
actionfilter_actionAlias for action; supply either action or filter_action.
canonical_filtersAlias for canonical_attributes when generating attribute filters.
Auto Filter › Responses
Filter action result (analyze / generate / upload / export).
site_idmodeactionInstallation status
Retrieve installation metadata.
Authentication: Send X-Askagento-Site-Id: <site_id> and X-Askagento-Api-Key: <api_key> headers. <api_key> must be the secret key; the public key is rejected with 401.
Installation status › Responses
Install status response
site_idinstalled_atstatus_messagestatusInstall plugin
Install the plugin.
Install plugin › Request Body
domainsystemwoocommerce — full catalogue with image + text data.
knowledge_base — text-only Confluence/article chunks for askagento.com chat.
plugin_versionwoocommerce_versiontotal_productsshop_ipOptional IPv4 string for the shop host (plugin may send DNS resolution result).
Install plugin › Responses
Installation accepted for async processing
statussite_idNew site identifier; send it in X-Askagento-Site-Id on every authenticated call.
api_keySecret key; accepted on every authenticated route. Keep it on your server and never expose it in a web page.
public_keyPublic key; accepted only on POST /chatbot, POST /search and POST /mcp. Safe to embed in storefront pages and AI agent configs.
messageInstall verify
Check that a shop can be reached from our servers before sending its catalogue to
POST /install.
Installation reads product pages and images directly from the shop, so a shop that is local, resolves to a private address, or refuses image requests cannot be installed. Calling this first turns that into an immediate, explainable answer instead of a failure part-way through installation.
Send the shop domain and the URL of one product image. The check is a name check, a DNS lookup, and a single image fetch, so it returns in about a second.
verdict is one of:
pass— proceed withPOST /install.blocked— the install cannot succeed as configured;reasonsays why.inconclusive— the shop could not be judged (timeout, rate limit). Offer a retry rather than treating it as a failure.
A blocked verdict is a normal, successful response: the check ran and the answer
is no. Only malformed requests return 4xx.
code | verdict | Meaning |
|---|---|---|
reachable | pass | The shop and its product images can be read. |
local_domain | blocked | A local development address (localhost, .local, .test). |
private_ip | blocked | The domain resolves to a private address. |
dns_unresolved | blocked | The domain does not resolve on the public internet. |
tls_invalid | blocked | The shop's certificate could not be verified. |
password_protected | blocked | The shop asks our servers for a password. |
image_forbidden | blocked | Image requests are refused (hotlink protection or a firewall). |
no_product_images | blocked | No product has an image; products are indexed by their images. |
connection_refused | blocked | The shop refused the connection. |
tls_error | blocked | The TLS handshake with the shop failed. |
unsupported_scheme | blocked | The image URL is not http or https. |
non_standard_port | blocked | The image URL uses a port other than 80 or 443. |
invalid_domain | blocked | No usable shop domain was supplied. |
image_not_found | inconclusive | The sampled image 404s, but the shop answered. |
image_not_an_image | inconclusive | The image URL returned a page, not an image file. |
rate_limited | inconclusive | The shop rate-limited the request. |
timeout | inconclusive | The shop did not answer in time. |
network_error | inconclusive | The shop could not be contacted. |
shop_error | inconclusive | The shop returned a 5xx for the sampled image. |
unexpected_status | inconclusive | The image returned an unexpected status. |
bad_redirect | inconclusive | The shop redirected without a destination. |
too_many_redirects | inconclusive | The image URL redirected too many times. |
Treat unknown codes by their verdict — codes may be added.
No API key: this runs before POST /install issues one.
Install verify › Request Body
domainShop host name, e.g. shop.example.com. A full URL is also accepted.
image_urlURL of one product image, picked at random from the catalogue about to be
installed. Products are indexed by their images, so a catalogue without
one cannot be installed: omitting it yields blocked
(no_product_images).
Install verify › Responses
Reachability verdict (including blocked, which is a normal result)
okTrue only when verdict is pass.
verdictcodeMachine-readable outcome, e.g. reachable, local_domain, private_ip,
dns_unresolved, tls_invalid, password_protected, image_forbidden,
image_not_found, no_product_images, rate_limited, timeout.
reasonSentence suitable for display to the shop administrator.
Per-check detail, in the order the checks ran.
Auto Label
Loads the site's product JSON, then runs analyze (suggest canonical names), generate (LLM proposals stored on products and catalogue), upload (persist generated labels into the catalogue in object storage), or export (download-ready payload). Debiting token quota uses the same mechanism as chat/search.
Modes: attributes, categories, tags. Actions: analyze, generate, upload, export.
Authentication: Send X-Askagento-Site-Id: <site_id> and X-Askagento-Api-Key: <api_key> headers. <api_key> must be the secret key; the public key is rejected with 401.
Auto Label › Request Body
modeactioncanonical_attributescanonical_categoriescanonical_tagsAuto Label › Responses
Success shape varies by mode and action (counts, previews, keys, catalogue upload status).
site_idmodeactionAI Agents & MCP
MCP 2024-11-05 over HTTP. Every request is a JSON-RPC 2.0 POST.
Supported methods:
initialize— server capabilities and protocol version.notifications/initialized— acknowledged silently (empty 200 body).tools/call— execute a tool (see tool list below).tools/list— catalogue of available tools.
tools/call tools (alphabetical):
chat_with_shop— conversational shop assistant (message, optionalhistory); delegates toPOST /chatbotwithaction=chat(product retrieval + LLM). Debitslimits.tokenslike/chatbot.get_catalogue_stats— orientation summary: total and published product count, price range, number of distinct categories and tags, featured and on-sale counts (no arguments). Reads the stored S3 catalogue; no quota debit.get_featured_products— curated product list:list_typeone offeatured(merchant-starred),on_sale(active discounts), ornew_arrivals(sorted bydate_createddescending);limit1–50 (default 12). Reads the stored S3 catalogue; no quota debit.get_product_by_id— full detail for one product by numericproduct_id: title, URL, image, price, categories, tags, description (up to 400 chars). Reads the stored S3 catalogue; no quota debit.get_shop_status— install status, plan, and remaining usage quotas (no arguments).get_similar_products— cross-sell and/or upsell neighbors for oneproduct_id(optionalrecommendation_type,limit). Reads the same precomputed similarity bundle as/recommend/*(install-time catalogue similarity index, no LLM); no quota debit.list_categories— all product categories in the catalogue with name, slug, and product count. No quota debit.list_tags— all product tags in the catalogue with name, slug, and product count. No quota debit.search_products— semantic search bytext,image, orboth(textand/orimage_base64, optionalmodality,limit); debitslimits.searcheswhen tracked.
Successful tool calls and protocol errors (initialize, unknown method, etc.) return HTTP 200 with a
JSON-RPC 2.0 body. Auth and site lookup failures also use HTTP 200 with JSON-RPC error objects
(codes -32001 unauthorized, -32004 site not found) so MCP clients can always parse the envelope.
HTTP 400 is reserved for a non-JSON or non-JSON-RPC request body at the transport layer.
Authentication: Send X-Askagento-Site-Id: <site_id> and X-Askagento-Api-Key: <api_key> headers. <api_key> can be the public key or the secret key; use the public key in browser code and AI agent configs.
AI Agents & MCP › Request Body
jsonrpcmethodOne of: initialize, notifications/initialized, tools/call, tools/list
Request id (omit for notifications)
For tools/call: {"name": "chat_with_shop"|"get_catalogue_stats"|"get_featured_products"|"get_product_by_id"|"get_shop_status"|"get_similar_products"|"list_categories"|"list_tags"|"search_products", "arguments": {...}}
AI Agents & MCP › Responses
JSON-RPC 2.0 response (result or error)
jsonrpcerrorCurrent subscription plan
Returns the current plan slug and display label for the site. Every API capability is available on every plan; the plan sets catalogue capacity and included monthly usage only.
Authentication: Send X-Askagento-Site-Id: <site_id> and X-Askagento-Api-Key: <api_key> headers. <api_key> must be the secret key; the public key is rejected with 401.
Current subscription plan › Responses
Plan response
site_idplanPlan slug (free, basic, pro); null if no plan is set
plan_labelHuman-readable plan label
AI Recommend (cross-sell)
Precomputed cross-sell recommendations for the registered catalogue (stored in object storage). Built during installation from install-time catalogue similarity indexes (no LLM).
Authentication: Send X-Askagento-Site-Id: <site_id> and X-Askagento-Api-Key: <api_key> headers. <api_key> must be the secret key; the public key is rejected with 401.
AI Recommend (cross-sell) › Responses
Recommendations JSON from object storage
site_idgenerated_atISO 8601 timestamp (UTC) with Z suffix
Map of source product id to cross-sell targets (similarity-ranked)
Map of source product id (string) to ranked neighbor list
AI Recommend (upsell)
Precomputed upsell recommendations for the registered catalogue (stored in object storage). Built during installation from install-time catalogue similarity indexes (no LLM).
Authentication: Send X-Askagento-Site-Id: <site_id> and X-Askagento-Api-Key: <api_key> headers. <api_key> must be the secret key; the public key is rejected with 401.
AI Recommend (upsell) › Responses
Recommendations JSON from object storage
site_idgenerated_atISO 8601 timestamp (UTC) with Z suffix
Map of source product id to cross-sell targets (similarity-ranked)
Map of source product id (string) to ranked neighbor list
AI Search
Search endpoint for text and image search.
Omit modality to infer from the body: text only → text, image_base64 only → image,
both present → both. Setting both requires text (≥2 chars) and image_base64.
Prefer setting modality explicitly for MCP contracts so the search mode is declared rather than inferred.
Each successful search debits one from limits.searches when that limit is tracked.
Authentication: Send X-Askagento-Site-Id: <site_id> and X-Askagento-Api-Key: <api_key> headers. <api_key> can be the public key or the secret key; use the public key in browser code and AI agent configs.
AI Search › Request Body
textSearch text, at least 2 characters
image_base64Base64-encoded image bytes. A leading data:image/...;base64, prefix is stripped if present. Never fetched over the network.
modalityOmit to infer from the body: text only → text, image_base64 only → image,
both present → both. Setting both requires text (≥2 chars) and image_base64.
limitAI Search › Responses
Ranked product hits
site_idmodalityqueryEchoed text query when modality is text or both
Update product data
Push the shop's current product catalogue for an installed site (scheduled or manual sync). Stores product JSON in object storage and updates the install record's product-data hash.
Authentication: Send X-Askagento-Site-Id: <site_id> and X-Askagento-Api-Key: <api_key> headers. <api_key> must be the secret key; the public key is rejected with 401.
Update product data › Request Body
systemdomainplugin_versionwoocommerce_versiontotal_productsUpdate product data › Responses
Product data accepted
statussite_idsynced_productsupdate_neededTrue when the catalogue hash changed on this sync (re-embed required). Unchanged-hash syncs do not clear a previously true flag.
messageUninstall plugin
Uninstall the plugin and remove all indexed data for the site.
Authentication: Send X-Askagento-Site-Id: <site_id> and X-Askagento-Api-Key: <api_key> headers. <api_key> must be the secret key; the public key is rejected with 401.
Uninstall plugin › Request Body
systemdomainplugin_versionwoocommerce_versionUninstall plugin › Responses
Uninstall completed
statusUsage limits
Returns the current plan, remaining per-site limits (tokens, searches), the tier-level
maximums, and the catalogue product count against the number of products the plan
indexes. Every API capability is available on every plan; a plan sets only catalogue
capacity and included monthly usage. When the catalogue is larger than the plan
indexes (over_product_limit: true), catalogue-backed endpoints return 403 with
code: product_limit_exceeded until the catalogue is covered by a larger plan or
reduced in size.
Authentication: Send X-Askagento-Site-Id: <site_id> and X-Askagento-Api-Key: <api_key> headers. <api_key> must be the secret key; the public key is rejected with 401.
Usage limits › Responses
Usage response
site_idplanPlan slug; null if no plan is set
plan_labelRemaining monthly plan allowance for this site; null if no limits are tracked. Reset to the tier maximum each billing period. Does not include add-on packs.
Unspent one-time add-on pack credits, omitted keys meaning zero; null when the site has none. These do not expire and are only spent once limits reaches zero, so the site's true remaining balance is limits + pack_units.
Tier-level maximums for the current plan; null if no plan is set. Includes a products field (how many products the plan indexes) in addition to tokens/searches.
product_countNumber of products in the shop's catalogue; null if not yet recorded
max_productsNumber of products the service indexes on the current plan; null if no plan is set.
over_product_limitTrue when the catalogue is larger than the current plan indexes. While true, catalogue-backed endpoints return 403 (code: product_limit_exceeded) until the catalogue is covered by a larger plan or reduced in size.