Safely read and change a FreshStore affiliate site through its Site API, covering products, articles, redirects, click analytics and product feeds.
86%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Medium
Suggest reviewing before use
The user does this in their site's admin, not you:
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.
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.
Authorization: Bearer YOUR_API_KEY
User-Agent: FreshStoreAgentSkill/1.0
Content-Type: application/jsonA 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.
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 with | Resource ability |
|---|---|
/products, /tags, /feeds | products |
/offers | offers |
/categories, /populators | categories |
/brands | brands |
/articles, /images | articles |
/article-categories | article-categories |
/pages, /zones | pages |
/analytics | analytics |
/settings, /launch-plan, /redirects | settings |
/store, /tools, /recommendations | store |
/users | users |
Things that catch people out:
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.settings, so they cannot list or change redirects.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:
| Job | Key needs |
|---|---|
| Read products, articles or analytics | products:read, articles:read, analytics:read |
| Add or edit products and offers | products:read and :write, offers:read and :write, categories:read |
| Write and schedule articles | articles:read and :write, plus article-categories:read to find category ids |
| Fix redirects | settings:read and settings:write |
| Clean the catalog, retire an old catalog | Full Access (they write across many resources and store) |
| Product feeds | products: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.
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.
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".
| Status | Meaning | What to do |
|---|---|---|
| 402 | not_enough_chips: no AI chips left | Stop. Tell the user. |
403 JSON {"error":"Forbidden"} | Bad, expired or wrong-site key | Ask the user to check the key and site URL |
403 JSON with message | Key lacks a scope | Name the scope to add |
| 403 HTML page | Blocked at the CDN | Set a named User-Agent |
| 404 | Unknown route or id | Re-read the list; do not guess ids |
| 409 | Site upgrading (retry once after a minute), or a feed run already going (do not retry; wait for the run) | See message |
| 422 | Validation or a business rule refused it | Read message and errors, fix the input |
| 429 | Rate limit | Wait for the next minute |
503 installing | Site still being built | Wait Retry-After seconds |
503 ai_generation_failed | An AI call failed | Retry later, or tell the user |
curl -sS -A "FreshStoreAgentSkill/1.0" "$FRESHSTORE_SITE_URL/api/store/status"Returns {"data":{"up":true}}, or up: false with a reason.