Creating an API key
Before you start, check two things:- The store’s plan includes API access. Any plan can open More → API Integrations and create a key, but requests with a key created in the app return
401until the store’s Appstle Loyalty plan includes API access. It’s included in the Enterprise plan and available as an add-on on other plans: contact support@appstle.com to add it. Without it, the External APIs card on the API page shows an upgrade notice. Scoped partner tokens don’t need it (see Partner integrations). - You can open API Integrations. The store owner, staff with Full access in Shopify, and staff the owner has authorized can view and create keys. Anyone else sees the message “API keys can only be managed by the store owner or full-access staff.” The owner authorizes staff under More → Advanced Settings → Account Ownership Settings, by adding their user IDs to Specific User IDs or by checking Authorize All Staff Members.
1
Open API Integrations
Log in to your Appstle admin panel and navigate to More → API Integrations. Your keys are in the API Keys section.
2
Create a new key
Click Create API key, enter a Key name that identifies the integration — for example,
Klaviyo sync, Mobile app, or Internal dashboard — choose a Permission (see Key permissions), and click Create. Good names make it easy to audit and revoke keys later.3
Copy the key immediately
The full key value is shown only once. Copy it and store it in your secrets manager or environment variable before leaving the page. If you navigate away without copying it, you must create a new key.
4
Store the key securely
Add the key to your application as an environment variable:Never hard-code the key in source code or commit it to version control.
Key permissions
The Create API key dialog offers two permissions. Read & write is selected by default.
Use Read only for reporting and one-way syncs, such as pulling points balances into a data warehouse. Use Read & write for integrations that change loyalty data, such as adding points or enrolling customers.
A read-only key gets
403 Forbidden on any other method, before the request reaches the endpoint:
403.
Sending the API key
Include your key in theX-API-Key header on every Admin API request.
api_key query parameter, but use the header: URLs end up in logs. The query parameter form:
Key management
You can create up to 10 active API keys per store. Each key has:- A display name you choose at creation time
- A Read only or Read & write permission
- A last-used timestamp so you can identify stale keys
- Individual revocation — revoking one key does not affect others
401 as any wrong key, and Appstle doesn’t issue a replacement, so move your integration to an apst_ key before you revoke it.
When a merchant uninstalls the app, Appstle deletes the store’s app data, including the legacy key and every apst_ key. Requests that send them get the same 401 as any wrong key. Reinstalling doesn’t bring them back: the app issues a new legacy key, and your integration needs a new apst_ key. A reinstall also starts the store on a new Appstle plan, so the new key gets 401 until that plan includes API access (see Creating an API key).
Rotating a key safely
1
Create the replacement key
Go to More → API Integrations and create a new key with the same or updated name.
2
Update your integration
Deploy the new key value to your application and verify it works.
3
Revoke the old key
Return to the dashboard and revoke the old key. Revocation is immediate.
Authentication errors
A request that fails authentication returns401 Unauthorized with Content-Type: application/json:
- Missing key. Send the key in the
X-API-Keyheader on every request. - Unknown key. Check the key for typos and stray whitespace. Each Appstle app issues its own keys, so a key from another Appstle app is unknown here. Uninstalling the app deletes every key, so after a reinstall, create a new key.
- Revoked key. Create a new key and update your integration. A revoked legacy key gets the same response.
- No API access on the plan. Contact support@appstle.com to add API access to the store’s plan. Scoped partner tokens don’t need it.
403 Forbidden instead (see Key permissions). Use a Read & write key. A 403 also means a shop value in the request doesn’t match the key’s store: drop the shop parameter, since your key already identifies the store.
Rate limits
A request over a limit returns429 Too Many Requests. The limits are the per-minute rate limit, five PUT calls in progress at once for the store, and the store’s daily call allowance. Rate limits in the integration guide shows the response for each limit and how to retry it.
Partner integrations
If you are building an app that connects to multiple merchants’ stores, use the Partner Integration Framework instead of asking merchants to share API keys manually. The framework:- Provisions a scoped
apst_token per merchant through the connection handshake - Lets merchants approve, review, and revoke access from their own dashboard
- Bypasses the paid API plan — merchants are never charged for partner API usage
- Revokes tokens automatically when a merchant disconnects or uninstalls Appstle
X-API-Key, exactly like a regular API key. See the Partner integration guide for the complete connection flow.
Storefront API authentication
The Storefront API doesn’t use API keys, and it isn’t Shopify’s Storefront GraphQL API. It serves the customer portal endpoints. Call it from the storefront while the customer is signed in, on the store’s own domain, by default under/apps/loyalty/cp/api/. Shopify’s App Proxy forwards each request to Appstle with the signed-in customer’s identity, so you don’t send a credential yourself. Accept referral offer is an exception: it also works for a shopper who isn’t signed in, because it identifies the friend by the email in the request. A request that isn’t a GET, HEAD or OPTIONS must also send X-Requested-With: XMLHttpRequest, or it gets 401.
See the Storefront API reference in the sidebar for the endpoints.
Next steps
Quickstart
Get a customer’s points and VIP tier, then credit points to their account.
Admin API integration guide
Manage points, enrollment, referrals, rewards and store credits from your server.
Build your own frontend
Show a customer’s points, rewards and referrals in your own theme.
Partner integration
Connect your platform and receive scoped API tokens for merchants.