Skip to content

← Back to home

API quickstart: read your store's sales from your own code

Every store here comes with a REST API. Your website, bot or script asks it a question over HTTPS and gets JSON back: what you sell, who paid, which subscriptions are running, and whether a Discord member has access right now. This page gets you from no key to a working request in a few minutes.

What the API does

The API reads your store's records. It doesn't take payments: buyers pay on your store page, and each product in the API carries a checkout_url you can send them to from your own site. After they pay, the sale shows up in the API with the ID PayPal or Stripe gave it.

Every plan includes the API, the Free plan too. Higher plans allow more requests a minute.

Make a key

  1. In your dashboard, under Developer, click API keys. You need to be the store's owner or a co-owner.
  2. Under Create key, type a Label, such as the name of the site or script that will use it.
  3. Tick Include customer data only if this key should read names, emails and Discord IDs. Checking a member's access (further down) needs it.
  4. Click Create key and copy the key. It starts with glr_ and is shown once. We keep only a scrambled copy, so we can't show it to you again.

A key works for one store. If it leaks, click Revoke beside it and anything using it stops right away.

Your first request

Send the key in the Authorization header. This lists your products:

curl https://glassrelay.com/v1/products/ \
  -H "Authorization: Bearer glr_your_key_here"

The answer, with most fields left out to keep it short:

{
  "count": 1,
  "next": null,
  "previous": null,
  "results": [
    {
      "id": 12,
      "name": "Supporter",
      "active": true,
      "public_code": "k3m9x2aq7d",
      "checkout_url": "https://glassrelay.com/your-store/p/k3m9x2aq7d",
      "roles": [
        {"role_id": "998877665544332211", "role_name": "Supporter", "at_cycle": 1, "keep_after_end": "no"}
      ]
    }
  ]
}

Link your own Buy button to checkout_url. Prices live in their own list, /v1/prices/, because one product can have several (monthly and yearly, say).

Read your payments

This lists every payment recorded since December 1, newest first:

curl "https://glassrelay.com/v1/payments/?date_from=2026-12-01" \
  -H "Authorization: Bearer glr_your_key_here"

One payment from that list, again with some fields left out:

{
  "id": 481,
  "processor": "paypal",
  "processor_transaction_id": "8XY12345AB678901C",
  "amount": "9.9900",
  "currency": "USD",
  "status": "completed",
  "type": "subscription_renewal",
  "product_id": 12,
  "customer_id": 77,
  "subscription_id": 31,
  "created_at": "2026-12-01T14:03:22Z"
}
  • processor_transaction_id is PayPal's or Stripe's own ID for the payment, kept exactly as they sent it, so you can look the same payment up on their side.
  • amount is text, in whole units of the currency: "9.9900" is nine dollars ninety-nine. It is the figure PayPal or Stripe reported. We never work it out ourselves.
  • id is our own number for the row. Times are UTC.

You can also filter by type, status and product_id. The other lists work the same way: /v1/subscriptions/, /v1/refunds/, /v1/disputes/, /v1/customers/ and /v1/storefronts/.

Check whether a Discord member has access

Give it a Discord user ID and it tells you whether that person has paid-for access on your store right now. This one needs a key made with Include customer data ticked.

curl https://glassrelay.com/v1/customers/discord/123456789012345678/access/ \
  -H "Authorization: Bearer glr_your_key_here"
{
  "discord_user_id": "123456789012345678",
  "customer_id": 77,
  "has_access": true,
  "entitlements": [
    {
      "product_id": 12,
      "product_name": "Supporter",
      "status": "active",
      "source": "subscription",
      "granted_at": "2026-11-01T14:03:22Z",
      "expires_at": "2027-01-01T14:03:22Z",
      "subscription_id": 31,
      "subscription_status": "active"
    }
  ]
}

has_access is the yes or no. Add ?product_id=12 to ask about one product. Discord IDs are always sent as text, since they are too long for some languages to hold as a number.

Pages, errors and limits

  • Lists come 50 rows at a time, inside results. count is the total and next is the address of the next page. Ask for up to 200 rows with ?limit=200 and skip ahead with offset.
  • An error is one sentence under detail, such as {"detail": "Invalid token"}. A 401 means the key is wrong, expired or revoked. A 403 means the key was made without Include customer data. A 429 means too many requests in one minute: wait and try again.
  • A filter value we don't know matches nothing. It gives an empty list, never an error.

The full reference

The API reference lists every address, filter and field. Try it live lets you paste a key and send requests from the browser.

Get started free