CtrlK
BlogDocsLog inGet started
Tessl Logo
PluginPublic

freshstore/freshstore-site-api

Safely read and change a FreshStore affiliate site through its Site API, covering products, articles, redirects, click analytics and product feeds.

Quality

86%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide
SecuritybySnyk

Medium

Suggest reviewing before use

Overview
Quality
Evals
Security
Files

setup.mdreferences/

Setup: keys, scopes, requests and errors

Get a site API key

The user does this in their site's admin, not you:

  1. Open the site admin and go to Settings > API Keys > Create API Key.
  2. Name the key after the tool that will use it, for example "Claude Code".
  3. Tick only the permissions the job needs (table below), or pick one of the two "AI assistant" presets. The presets tick a sensible set and expire after 90 days.
  4. Optionally set an expiry date.
  5. Copy the key. It is shown once and cannot be shown again.

Keys are per site. There is no account-level key, and the API cannot create keys.

Store the key outside the project, for example in the shell:

export FRESHSTORE_SITE_URL="https://example.com"
export FRESHSTORE_API_KEY="paste-key-here"

If the user keeps it in a .env file, make sure that file is in .gitignore before you write to it.

Base URL

https://{site-domain}/api, using the address the site answers on. Each site has its own API, its own keys and its own rate limit.

Auth and headers

Authorization: Bearer YOUR_API_KEY
User-Agent: FreshStoreAgentSkill/1.0
Content-Type: application/json

A bad, missing or expired key returns 403 {"error":"Forbidden"}, not 401.

The site sits behind a CDN that blocks common HTTP library User-Agents (for example python-requests, curl/, axios/, node-fetch/, Go-http-client/) on site pages, with an HTML "403 Forbidden" page. API calls that carry a key are let through, but always send a named User-Agent anyway: the public GET /api/store/status call carries no key and rejects a library or empty User-Agent.

Scopes

A key holds broad abilities (read, write, or Full Access) and optional per-resource abilities such as products:read or articles:write. GET needs read; POST, PATCH, PUT and DELETE need write. If a key holds any per-resource ability, every call must match one for its path.

Path starts withResource ability
/products, /tags, /feedsproducts
/offersoffers
/categories, /populatorscategories
/brandsbrands
/articles, /imagesarticles
/article-categoriesarticle-categories
/pages, /zonespages
/analyticsanalytics
/settings, /launch-plan, /redirectssettings
/store, /tools, /recommendationsstore
/usersusers

Things that catch people out:

  • The admin offers store:read but no store:write. So the POST /api/store/... calls (Retire Catalogue, Clean, Clear Cache, Rebuild Sitemap, template switch) need a Full Access key, or the broad Write box with no per-resource boxes.
  • The AI assistant presets leave out settings, so they cannot list or change redirects.
  • A missing ability returns 403 with a message such as {"message": "This token does not have access to products."}. Tell the user which box to tick; do not look for another way round.

Narrowest key per job:

JobKey needs
Read products, articles or analyticsproducts:read, articles:read, analytics:read
Add or edit products and offersproducts:read and :write, offers:read and :write, categories:read
Write and schedule articlesarticles:read and :write, plus article-categories:read to find category ids
Fix redirectssettings:read and settings:write
Clean the catalog, retire an old catalogFull Access (they write across many resources and store)
Product feedsproducts:read and :write, categories:read

A write ability does not cover reads on a scoped key: "read before you write" needs the matching read box too.

Rate limit

60 requests a minute, per key, per site. Responses carry X-RateLimit-Limit and X-RateLimit-Remaining. Over the limit: 429 {"error":"Too Many Requests"}. Wait for the minute to roll over. Prefer bulk endpoints (bulk redirects, Amazon link import, CSV import) over one call per row.

Response shape

Success: {"data": ...}. Lists add Laravel pagination:

{
  "data": [],
  "links": { "next": "...?page=2" },
  "meta": { "current_page": 1, "last_page": 10, "per_page": 15, "total": 150 }
}

page (default 1) and per_page (default 15, max 100). GET /api/redirects defaults to 50 a page and returns only meta.total, meta.per_page and meta.current_page.

Booleans on write: JSON true/false, or the strings "true", "false", "1", "0".

Errors

StatusMeaningWhat to do
402not_enough_chips: no AI chips leftStop. Tell the user.
403 JSON {"error":"Forbidden"}Bad, expired or wrong-site keyAsk the user to check the key and site URL
403 JSON with messageKey lacks a scopeName the scope to add
403 HTML pageBlocked at the CDNSet a named User-Agent
404Unknown route or idRe-read the list; do not guess ids
409Site upgrading (retry once after a minute), or a feed run already going (do not retry; wait for the run)See message
422Validation or a business rule refused itRead message and errors, fix the input
429Rate limitWait for the next minute
503 installingSite still being builtWait Retry-After seconds
503 ai_generation_failedAn AI call failedRetry later, or tell the user

Public status check (no key)

curl -sS -A "FreshStoreAgentSkill/1.0" "$FRESHSTORE_SITE_URL/api/store/status"

Returns {"data":{"up":true}}, or up: false with a reason.

SKILL.md

tile.json