If you hand the job to ChatGPT, Claude or Codex, the agent does well when it reads the real reference first and badly when it guesses the routes. This page gives it both.
1. Make a key and keep it out of the chat
Create the key in the Subi app under Settings, then API keys. Put it in an environment variable named SUBI_API_KEY on the machine or host where the code runs. The agent only needs to know the variable's name. The API is included in every current paid plan and almost every older one; the Free plan offered to new stores today does not include it.
2. Paste this prompt
Fill in the last paragraph with what you want built.
You are connecting a system to the Subi public API (Shopify subscriptions).
Read these before writing code:
- https://subi.co/llms-full.txt
- https://api.subi.co/public/v1.0/schema/
- https://api.subi.co/webhooks/v1.0/schema/
Rules:
- Send the key as an X-Api-Key header. Read it from the environment variable SUBI_API_KEY. Never print it or write it into a file.
- Every path ends with a slash. The base is https://api.subi.co/public/v1.0/.
- Use only the methods in the schema. Lines are edited with PATCH on /subscription-contracts/{id}/lines/ and nothing else.
- At most 60 requests a minute. On 429, wait and retry.
- For webhooks, verify X-Subi-Hmac-Sha256 on the raw body before using it, answer 2xx within 10 seconds, and skip an X-Subi-Event-Id you have seen.
My goal: <describe what the system should do, in one or two sentences>.
Start with one read-only call and show me the answer before you write anything that changes a subscription.
3. Things an agent gets wrong
- It sends a
GETto a contract's/lines/address. That route only acceptsPATCH; the lines come back when you fetch the contract. - It sends
PATCHto the contract address itself. Contracts change through the action routes (cancel, pause, resume, skip, reschedule) and the lines route. - It tries to delete or create a contract, or to change a subscriber. The API has no routes for those.
- It adds a line without a
selling_plan_id. - It leaves off the trailing slash. The API answers with a 301 redirect instead of the data.
- It loops over every page without pausing and hits the limit of 60 requests a minute.
- It writes a status in lowercase. The API spells them in capitals, as below:
status=activeanswers with a 400, andstatus__in=activequietly returns nothing.
An assistant that works in your own tools
Some assistants can call a tool you connect with an OpenAPI file and a key, custom GPTs in ChatGPT among them. Subi's API can be connected that way.
- Make a key in the Subi app under Settings, then API keys (the API comes with every current paid plan and almost every older one), and save it where the assistant keeps its secrets, as an API key sent in the
X-Api-Keyheader. - If the assistant takes an OpenAPI file, give it https://api.subi.co/public/
v1.0/schema/ and addhttps://api.subi.coas its server, in the tool's settings or as a servers entry in the file, since the file lists the paths and not the server. If it does not, paste the prompt above. - Ask it something one call answers.
- How many active subscriptions do I have?
GET /public/v1.0/subscription-contracts/?status=ACTIVE&limit=1, then readcount. - Who renews this week?
?status=ACTIVEand&next_billing_date__gte= &next_billing_date__lte=with the week's start and end, such as2026-10-26T00:00:00Zand2026-11-01T23:59:59Z, and&limit=100for up to 100 at a time. - Which active subscriptions had their last payment fail?
?status=ACTIVE.&last_payment_status=FAILED - Who has paused?
?status=PAUSED.
- How many active subscriptions do I have?
The same key can also cancel, pause or change a subscription, so tell the assistant to ask you before any call that is not a GET.
The status values, as the API spells them: ACTIVE, PAUSED, CANCELLED (two Ls), EXPIRED, FAILED and DEACTIVATED. A last payment is SUCCEEDED or FAILED. If your assistant speaks MCP, the MCP server below (Subi Plus, or an add-on on other paid plans) is the shorter way.
Let your AI client read Subi directly
Subi also has an MCP server, so Claude, ChatGPT or Cursor can read your Subi data without any code from you. It comes with the Subi Plus plan, or as an add-on on other paid plans. Connect it from the app under Settings, then AI clients.
The full guide is on the developers page.