Skip to main content
The access endpoint tells you whether a customer is entitled to use a product — either because they have an active subscription or because they made a confirmed one-time payment. This is the check the AI SDK, LangChain, and UploadThing adapters run automatically, but you can call it directly from your own server-side logic.

Check access

GET /customers/{customer_id}/access/{product_id} Returns whether the customer has access to the product and the reason why.
curl https://api.stellartools.dev/customers/cus_01jx.../access/prod_01jx... \
  -H "x-api-key: YOUR_API_KEY"

Response

{
  "has_access": true,
  "grant": {
    "type": "subscription",
    "subscription_id": "sub_01jx...",
    "status": "active"
  }
}
{
  "has_access": true,
  "grant": {
    "type": "one_time",
    "payment_id": "pay_01jx..."
  }
}
{
  "has_access": false,
  "grant": null
}
has_access
boolean
Whether the customer is entitled to use the product.
grant
object | null
The reason access was granted. null when has_access is false.

SDK usage

The @stellartools/core SDK exposes this as customers.access.verify(customerId, productId):
import { StellarTools } from "@stellartools/core";

const stellar = new StellarTools({ api_key: process.env.STELLAR_TOOLS_API_KEY! });

const { has_access, grant } = await stellar.customers.access.verify("cus_xxx", "prod_xxx");

if (!has_access) {
  throw new Error("Customer does not have access to this product");
}

// grant.type tells you whether it's a subscription or one-time payment
if (grant?.type === "subscription") {
  console.log("Active subscription:", grant.subscription_id);
}