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 the Starter, Subi and Subi Plus plans.
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 or swaps 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.
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.