TanqoryDocs

Tanqory AI for apps

Run Tanqory AI generators from your app's server, paid from the store's AI credits up to the limit the merchant sets.

Your app can ask Tanqory AI for content, such as a summary of a product's reviews. The store pays with its own AI credits, up to a limit the merchant controls for your app. You never hold a model key and never pay for the model.

Ask for the scope

Add write_ai_generations to your app's scopes in Configuration, then select Save version. It lets your app run the generators open to apps, and nothing else: no chat, no store data. Ask for the read scope a generator names too (review_summary needs read_products).

The merchant sees the scope on the install page, with the most AI credits your app may use each credit period (100 by default). Only an owner, or a staff member allowed to manage AI spend, can grant it.

Call it from your server only

Send tanqoryExtAiGenerate to the Admin API with your app's access token, from your own server. Never call it from a browser or put the token in a page.

GraphQL
mutation {
  tanqoryExtAiGenerate(
    generator: "review_summary"
    idempotencyKey: "reviews-8f2c41a0-v12"
    input: {
      productTitle: "Linen shirt"
      language: "en"
      reviews: [
        { rating: 5, title: "Great fit", body: "Soft linen, true to size." }
        { rating: 2, body: "Shrank after a warm wash." }
      ]
    }
  ) {
    result { output credits replayed }
    userErrors { code message field }
  }
}

An offline token works for the store. An online token, acting for a staff member, works only when that member may use AI and make changes in the store.

Run one tanqoryExtAiGenerate per request. tanqoryExtAiGenerators lists the generators your app may run, with their input and output schemas.

Derive the key from the content

idempotencyKey names the request: 8 to 128 letters, digits, _ or -. Build it from what you send, such as the product id and a version of its reviews (reviews-<productId>-v12), not from the time or a random value.

  • The same key with the same input returns the stored result at no cost (replayed: true).
  • The same key with a different input is refused with the error code idempotency_key_reused. You never get another request's result. Use a new key.
  • A result is kept for 30 days. A replay after that answers the error code replay_unavailable: send it again with a new key.

The review_summary generator

Input:

FieldTypeLimit
productTitlestring, optional255 characters
reviewslist of { rating, title, body }1 to 200 reviews; rating 1 to 5; title optional, 200 characters; body 4,000 characters; 60,000 characters of titles and text in all
languagestring, optionala BCP 47 tag, such as en or th

Send no customer names, emails or other personal details: the input has no field for them, so leave them out of the review text too. What you send goes to Tanqory's AI provider to write the result.

Output:

FieldTypeLimit
summaryplain text600 characters
proslist of short phrases5
conslist of short phrases5

The output never holds a web address, an email address, a phone number, HTML or Markdown: an answer that does is withheld with REFUSED. Still escape the text when you show it, and label it as AI-generated on the storefront.

What each error means

CodeWhyWhat to do
ACCESS_DENIEDThe token lacks write_ai_generations or the generator's scope; the generator is not open to apps; the merchant or Tanqory turned AI off for your appAsk for the scope; tell the merchant they can turn AI on in Settings > Apps
SPEND_LIMIT_REACHEDYour app reached its limit for the credit period, or the store reached its own limitTell the merchant: an owner or admin can raise your app's limit in Settings > Apps. It starts again next period
INSUFFICIENT_CREDITSThe store has no AI credits leftTell the merchant they can buy credits on Settings > Billing > AI usage
THROTTLEDToo many requests from your app in this store in the last minute, three already running, or the day's requests on a partner's development stores are used upWait and retry with the same key
INVALIDThe input breaks the schemaFix the field named in field
REFUSEDThe answer did not pass Tanqory's output checksRetry later with a new key
UNAVAILABLETanqory AI is paused or not reachableRetry later with the same key

Nothing is charged for a request refused before the model runs. A refused answer (REFUSED) used the model and is charged.

Development stores

On your development stores the same rules and real billing apply, from the store's trial credits. All your development stores together share a daily number of AI requests.

Built from commit 0cac88ece6de · API version 2026-10