Script Endpoints

How to create and call Script Endpoints — custom HTTP API URLs hosted on your Sellrn store that external apps and your mobile app can call.

Updated 2026-06-21
scripts
API
endpoints
HTTP
mobile

Script Endpoints are custom HTTP URLs that you create inside Sellrn. Each endpoint runs a script function when called, and returns a JSON response. They are useful for any integration that needs to call your store's backend — POS systems, mobile apps, third-party automation tools, or your own internal dashboards.

Creating an endpoint

  1. Go to Scripts → New script and choose type Endpoint.
  2. Give it a name. The URL is generated from the name (e.g. "Get Stock Levels" → /api/scripts/v1/get-stock-levels).
  3. Write your handler function. It receives a request object and should return a JSON-serializable value.
  4. Click Deploy.

Endpoint URL format

https://yourdomain.com/api/scripts/v1/your-endpoint-name

Or, using your Sellrn subdomain before a custom domain is connected:

https://sellrn.com/s/your-store-slug/api/scripts/v1/your-endpoint-name

Authenticating requests

All Script Endpoint requests must include your script token in the request header:

Authorization: Bearer YOUR_SCRIPT_TOKEN

Find your token in Scripts → Settings → Script token. Keep this secret — rotate it if you suspect it has been exposed.

HTTP methods

Endpoints support GET, POST, PUT, PATCH, and DELETE. Your script handler receives the method, headers, query parameters, and request body. You choose which methods to handle inside the function.

Example: returning stock levels

export default async function handler(request) {
  const { productId } = request.query;
  const product = await sellrn.products.get(productId);
  return {
    productId,
    stock: product.inventory_quantity,
    available: product.inventory_quantity > 0,
  };
}

Calling an endpoint from your mobile app

Script Endpoints are designed to be reusable by the Sellrn Expo mobile app. The endpoint URL and script token are included in the Mobile Manifest, so your app can call them without hardcoding URLs. See "Mobile App Overview" for details.

Rate limits

Script Endpoints are rate-limited to protect your store's infrastructure:

  • 100 requests per minute per endpoint (configurable up to 1,000 on Business plan).
  • Requests over the limit receive a 429 Too Many Requests response.

Viewing logs

Every endpoint call is logged. View request/response logs in Scripts → [endpoint name] → Logs. Logs are retained for 30 days.