# Overview

The Storelink API lets you work with your stores from your own systems: read and
write products and images, read, create and update orders, read customers,
manage coupons, and read sales analytics.


BASE URL

https://api.store.link/v1

All requests use HTTPS. Request and response bodies are JSON, so send
Content-Type: application/json with any request that has a body.


AUTHENTICATION

Create an API key on your Storelink account page, under Account → API keys
[https://dashboard.store.link/account?tab=api-keys]. Keys start with sl_key_.
Send yours in the Authorization header of every request:

curl 'https://api.store.link/v1/stores' \
  -H 'Authorization: Bearer sl_key_…'

A key acts as you, in every store you can act in. Keep it secret: use it from
your server, never from browser code or a public repository. If a key leaks,
revoke it on the same page and create a new one.


ROLES AND PERMISSIONS

What a key can do in a store is decided by your role in that store, the same as
in the dashboard. GET /stores [https://store.link/help/developer/article/1166]
lists your stores with your role in each.

 * Owner and manager can do everything the API offers.
 * Other roles can do what their permissions in that store allow. Each endpoint
   says what it needs, for example “Your role in the store needs to write
   orders.” A request your role can’t make returns 403 insufficient_permission.

Some endpoints also need a plan that includes the feature, such as coupons or
analytics. Those return 403 plan_upgrade_required, and the message names the
plan the store needs.


STORE IDS

Almost every path starts with /stores/{storeId}. Get the ids from GET /stores
[https://store.link/help/developer/article/1166]. An id your key can’t act in
returns 404 store_not_found.


PAGINATION

List endpoints take page (default 1) and limit (default 25, at most 100) as
query parameters, and return:

{
  "data": [ … ],
  "page": 1,
  "limit": 25,
  "total": 132,
  "has_more": true
}

While has_more is true, ask for the next page.


IDEMPOTENCY

Create an order [https://store.link/help/developer/article/1168] requires an
Idempotency-Key header, and Add a note to an order
[https://store.link/help/developer/article/1168] accepts one. Use any unique
string up to 255 characters, such as a UUID or your own order id. Sending the
same key again returns the result of the first request and does nothing else, so
a retry after a timeout can’t create the order or note twice.


RATE LIMITS

Each key can make 120 requests a minute. Responses carry the standard RateLimit
headers that show how many requests you have left. Over the limit, and after
repeated failed authentication, requests return 429 rate_limited; wait for the
window to reset and try again.


ERRORS

Errors return an HTTP status and a JSON body with a machine-readable code and a
human-readable message:

{
  "error": {
    "code": "invalid_request",
    "message": "items: Too small: expected array to have >=1 items"
  }
}

StatusCodeMeaning400invalid_requestA parameter or the body is invalid. The
message names the field.400invalid_statusThe status isn't one this store's
orders move through.401unauthorizedThe API key is missing, unknown or
revoked.403insufficient_permissionYour role in this store can't do
this.403plan_upgrade_requiredThe store's plan doesn't include this. The message
names the plan it needs.404store_not_foundThis key can't act in a store with
this id.404not_foundNothing with this id in this store, or something the body
names, such as a product or coupon, is not there.409conflictThe write collides
with what the store has, such as a code or slug in
use.422product_sheet_errorStorelink couldn't read or write the store's Product
Sheet in Google Sheets. The message says what to fix.429rate_limitedToo many
requests: 120 a minute per key, and repeated failed
authentication.500internal_errorSomething failed on our side. Try again later.


API REFERENCE

Each part of the API has its own article:

 * Stores [https://store.link/help/developer/article/1166]: the stores your key
   can act in, and each store’s settings.
 * Products [https://store.link/help/developer/article/1167]: list, read, create
   and replace products, sync from the Product Sheet, and upload images.
 * Orders [https://store.link/help/developer/article/1168]: find, read and
   create orders, change their status, and add notes.
 * Customers [https://store.link/help/developer/article/1169]: customers and
   what they ordered.
 * Coupons [https://store.link/help/developer/article/1170]: list, create,
   change and delete discount codes.
 * Analytics [https://store.link/help/developer/article/1171]: sales summaries,
   sales breakdowns and fulfillment.


OPENAPI DOCUMENT

The whole API is also described as an OpenAPI 3.1 document, which you can import
into Postman, Insomnia or a code generator. It needs no API key.

curl 'https://api.store.link/v1/openapi.json'

An interactive reference built from it, where you can try requests, is at
api.store.link/v1/docs [https://api.store.link/v1/docs].