@myapihq/cli 1.0.79 → 1.0.82

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -35,9 +35,9 @@ export async function check(domainArg, flags) {
35
35
  export async function register(domainArg, flags) {
36
36
  const config = requireConfig();
37
37
  const orgId = flags.org || config.default_org;
38
- const domain = domainArg || config.default_domain;
38
+ const domain = domainArg;
39
39
  if (!orgId || !domain)
40
- error("Missing required arguments.\nUsage: myapi domain register <domain> --org <id> [--years <num>]\n(Set defaults: myapi auth config set-org <id> / myapi auth config set-domain <domain>)");
40
+ error("Missing required arguments.\nUsage: myapi domain register <domain> --org <id> [--years <num>]");
41
41
  const years = parseInt(flags.years) || 1;
42
42
  const res = await sdkDomain.registerDomain(config.api_key, orgId, domain, years);
43
43
  success(`Registered ${domain}!`);
@@ -65,18 +65,18 @@ export async function list(flags) {
65
65
  export async function assign(domainArg, flags) {
66
66
  const config = requireConfig();
67
67
  const orgId = flags.org || config.default_org;
68
- const domain = domainArg || config.default_domain;
68
+ const domain = domainArg;
69
69
  if (!orgId || !domain)
70
- error("Missing required arguments.\nUsage: myapi domain assign <domain> --org <id>\n(Set defaults: myapi auth config set-org <id> / myapi auth config set-domain <domain>)");
70
+ error("Missing required arguments.\nUsage: myapi domain assign <domain> --org <id>");
71
71
  await sdkDomain.assignDomain(config.api_key, orgId, domain);
72
72
  success(`Assigned ${domain} to org ${orgId}`);
73
73
  }
74
74
  export async function unassign(domainArg, flags) {
75
75
  const config = requireConfig();
76
76
  const orgId = flags.org || config.default_org;
77
- const domain = domainArg || config.default_domain;
77
+ const domain = domainArg;
78
78
  if (!orgId || !domain)
79
- error("Missing required arguments.\nUsage: myapi domain unassign <domain> --org <id>\n(Set defaults: myapi auth config set-org <id> / myapi auth config set-domain <domain>)");
79
+ error("Missing required arguments.\nUsage: myapi domain unassign <domain> --org <id>");
80
80
  await sdkDomain.unassignDomain(config.api_key, orgId, domain);
81
81
  success(`Unassigned ${domain} from org ${orgId}`);
82
82
  }
@@ -42,16 +42,19 @@ export async function get(id, flags) {
42
42
  const orgId = flags.org || config.default_org;
43
43
  if (!orgId || !id)
44
44
  error("Missing required arguments.\nUsage: myapi funnel get <id> --org <id>\n(Or set defaults via: myapi config set-org <id>)");
45
- const funnel = await sdkFunnel.getFunnel(config.api_key, orgId, id);
45
+ const raw = await sdkFunnel.getFunnel(config.api_key, orgId, id);
46
+ const funnel = raw.funnel ?? raw;
47
+ const subdomain_url = raw.subdomain_url ?? funnel.subdomain_url;
48
+ const domain_url = raw.domain_url ?? funnel.domain_url;
46
49
  if (flags.json) {
47
- printJson(funnel);
50
+ printJson(raw);
48
51
  return;
49
52
  }
50
53
  info(`ID: ${funnel.id}`);
51
- if (funnel.domain_url)
52
- info(`Domain: ${funnel.domain_url}`);
53
- else if (funnel.subdomain_url)
54
- info(`Preview: ${funnel.subdomain_url}`);
54
+ if (domain_url)
55
+ info(`Domain: ${domain_url}`);
56
+ if (subdomain_url)
57
+ info(`Preview: ${subdomain_url}`);
55
58
  if (funnel.created_at)
56
59
  info(`Created: ${formatDate(funnel.created_at)}`);
57
60
  if (funnel.updated_at)
@@ -99,7 +99,7 @@ async function anonymousFlow() {
99
99
  // myapi auth import-key <key> — non-interactively import a raw API key.
100
100
  export async function importKey(apiKey, flags) {
101
101
  if (flags.help || !apiKey) {
102
- info('Usage: myapi auth import-key <api_key> [--install-skills] [--no-skills]\n\nImports an existing API key non-interactively. Use this in CI, Docker, or any\nenvironment where the interactive "myapi auth setup" flow is not practical.\n\nThe key is validated against the API before being saved. Your default org and\nfunnel are auto-detected from the account and written to the local config.\n\nFlags:\n --install-skills Also install the MyAPI skills pack for AI agents after importing\n --no-skills Skip skills installation even if previously installed\n\nExamples:\n myapi auth import-key hqlive_xxxxxxxxxxxxxxxxxxxx\n myapi auth import-key hqlive_xxxxxxxxxxxxxxxxxxxx --install-skills');
102
+ info('Usage: myapi auth import-key <api_key> [--install-skills] [--no-skills]\n\nImports an existing API key non-interactively. Use this in CI, Docker, or any\nenvironment where the interactive "myapi auth setup" flow is not practical.\n\nThe key is validated against the API before being saved. Your default org and\nfunnel are auto-detected from the account and written to the local config.\n\nFlags:\n --install-skills Also install the MyAPI skills pack for AI agents after importing\n --no-skills Skip skills installation even if previously installed\n\nExamples:\n myapi auth import-key hq_live_xxxxxxxxxxxxxxxxxxxx\n myapi auth import-key hq_live_xxxxxxxxxxxxxxxxxxxx --install-skills');
103
103
  return;
104
104
  }
105
105
  const auth = { Authorization: `Bearer ${apiKey}` };
package/dist/index.js CHANGED
@@ -93,7 +93,7 @@ async function main() {
93
93
  await configCmd.run(restArgs[0], restArgs.slice(1), flags);
94
94
  else if (subcommand === 'api-keys') {
95
95
  if (flags.help && !restArgs[0]) {
96
- info('Usage: myapi auth api-keys <subcommand>\n\nManage programmatic API keys for your account. API keys are used to authenticate\nrequests to the MyAPI SDK and REST API.\n\nSubcommands:\n list List all API keys with their IDs and creation dates\n create Create a new API key (the key value is shown once)\n revoke <id> Permanently revoke an API key by ID\n\nExamples:\n myapi auth api-keys list\n myapi auth api-keys create\n myapi auth api-keys revoke hqlive_xxxxxxxxxxxxxxxxxxxx');
96
+ info('Usage: myapi auth api-keys <subcommand>\n\nManage programmatic API keys for your account. API keys are used to authenticate\nrequests to the MyAPI SDK and REST API.\n\nSubcommands:\n list List all API keys with their IDs and creation dates\n create Create a new API key (the key value is shown once)\n revoke <id> Permanently revoke an API key by ID\n\nExamples:\n myapi auth api-keys list\n myapi auth api-keys create\n myapi auth api-keys revoke hq_live_xxxxxxxxxxxxxxxxxxxx');
97
97
  break;
98
98
  }
99
99
  if (!restArgs[0]) {
@@ -166,7 +166,7 @@ async function main() {
166
166
  break;
167
167
  case 'keys':
168
168
  if (!subcommand || (flags.help && !subcommand)) {
169
- info('Usage: myapi keys <subcommand>\n\nManage programmatic API keys for your account. API keys are used to authenticate\nrequests to the MyAPI SDK and REST API.\n\nSubcommands:\n list List all API keys with their IDs and creation dates\n create Create a new API key (the key value is shown once)\n revoke <id> Permanently revoke an API key by ID\n\nExamples:\n myapi keys list\n myapi keys create\n myapi keys revoke hqlive_xxxxxxxxxxxxxxxxxxxx\n\nAlias for: myapi auth api-keys');
169
+ info('Usage: myapi keys <subcommand>\n\nManage programmatic API keys for your account. API keys are used to authenticate\nrequests to the MyAPI SDK and REST API.\n\nSubcommands:\n list List all API keys with their IDs and creation dates\n create Create a new API key (the key value is shown once)\n revoke <id> Permanently revoke an API key by ID\n\nExamples:\n myapi keys list\n myapi keys create\n myapi keys revoke hq_live_xxxxxxxxxxxxxxxxxxxx\n\nAlias for: myapi auth api-keys');
170
170
  break;
171
171
  }
172
172
  if (subcommand === 'create')
@@ -1,116 +1,82 @@
1
1
  ---
2
2
  name: my-api-hq
3
3
  description: >
4
- Core Identity and Billing hub. Manage auth, organizations (get org_id), and billing (checkout/topup).
4
+ Auth, organizations, and billing hub. Start here to get an api_key and org_id — every other service depends on both.
5
5
  ---
6
6
 
7
- # MyApiHQ Skill
8
- Root entry point for the ecosystem. All other skills require an `api_key` and often an `org_id` from here.
7
+ # MyApiHQ
9
8
 
10
- ## Platform Conventions
9
+ The root service. It manages accounts, API keys, organizations, and billing. No other service works without credentials from here.
11
10
 
12
- ### Response Envelope
13
- Every response across all services is wrapped in:
14
- ```json
15
- {
16
- "success": true,
17
- "data": { ... },
18
- "error": null,
19
- "meta": { "request_id": "...", "latency_ms": 12, "service": "...", "version": "v1" }
20
- }
21
- ```
22
- On error, `success` is `false`, `data` is `null`, and `error` contains a string error code or object. Always check `success` before reading `data`.
11
+ ## How It Fits Together
23
12
 
24
- ### Pagination
25
- List endpoints accept `?limit=` and `?offset=` and return `total`, `limit`, `offset` in the body.
13
+ ```
14
+ myapihq ──► org_id + api_key
15
+
16
+ ┌───────┴────────┐
17
+ mydomainapi myfunnelapi
18
+ (domains) (websites)
19
+ ```
26
20
 
27
- ## Authentication & Key Management
21
+ - **mydomainapi** needs an `org_id` to register or manage domains.
22
+ - **myfunnelapi** needs an `org_id` to create funnels; a registered domain makes the funnel live on your custom URL.
28
23
 
29
- You need to go to myapihq.com and register an account. Generate an api key and export it to pass it to the agent (as env).
24
+ ## Quick Start (CLI)
30
25
 
31
- ### Account Login
26
+ ```bash
27
+ myapi auth setup # interactive setup: creates account, generates api_key, sets defaults
28
+ myapi org create --name "Acme" --yes # creates an org and sets it as default
29
+ myapi org list # see all orgs and their IDs
32
30
  ```
33
- POST /hq/account/login
34
- { "email": "...", "password": "..." }
35
- → { "data": { "token": "<JWT>" } }
36
- ```
37
- Errors: `401` wrong password.
38
31
 
39
- **Refresh Token:**
40
- ```
41
- POST /hq/account/refresh
42
- ```
32
+ After `myapi auth setup` your `api_key` and default `org_id` are stored locally. Most commands pick them up automatically.
43
33
 
44
- **Google OAuth:**
45
- - `GET /hq/auth/google/redirect` — Initiates Google OAuth flow.
46
- - `GET /hq/auth/google/callback` — OAuth callback.
34
+ ## Organizations
47
35
 
48
- ### API Key Management
49
- **Generate Persistent Key:**
50
- ```
51
- POST /hq/account/create/key
52
- Authorization: Bearer <JWT from login>
53
- { "name": "MyKey" }
54
- → { "data": { "api_key": "hq_live_...", "id": "...", "prefix": "..." } }
55
- ```
56
- Errors: `401` no auth.
36
+ An org is the container for everything else — domains, funnels, brand settings.
57
37
 
58
- Use `Authorization: Bearer <api_key>` for all subsequent requests across the entire ecosystem.
38
+ | CLI command | What it does |
39
+ |---|---|
40
+ | `myapi org create --name "..."` | Create a new org (add `--yes` to auto-set as default) |
41
+ | `myapi org sync-brand <domain>` | Scrape a live site and auto-fill brand info into an existing org |
42
+ | `myapi org list` | List all orgs (`*` marks the default) |
43
+ | `myapi org get [id]` | Inspect one org (defaults to current default org) |
44
+ | `myapi org delete <id>` | Delete org and cascade |
59
45
 
60
- **List Keys:** `GET /hq/account/keys`
46
+ `org sync-brand` is async — it scrapes the site and updates the org's name, logo, and description. You need an existing org first (`org create`).
61
47
 
62
- **Revoke Key:** `DELETE /hq/account/delete/key/{id}`
48
+ Each org gets a free preview subdomain (`*.makeautonomous.com`) you can use before registering a custom domain.
63
49
 
64
- ### Cross-Session Storage
65
- **Always persist credentials immediately.** Write a `.env` file:
66
- ```
67
- MYAPI_API_KEY=hq_live_...
68
- MYAPI_ACCOUNT_ID=...
69
- ```
70
- Also save to agent memory if your runtime supports it (e.g., Claude Code memory). On every new session, check for credentials before creating a new account.
50
+ ## API Keys
71
51
 
72
- ## Organization Management
73
- **You MUST create an org to get an `org_id` for other APIs.**
52
+ Keys have the format `hq_live_...` and are used as `Authorization: Bearer <api_key>` across all services.
74
53
 
75
- ### Create Org (sync)
76
- ```
77
- POST /hq/orgs
78
- { "name": "Acme Inc" (required), "tagline", "description", "business_sector",
79
- "logo_url", "favicon_url", "og_image_url",
80
- "color_palette": { "primary": "#hex", ... },
81
- "font_family", "imagery_style", "headline", "subheadline", "cta_text",
82
- "value_propositions": ["..."],
83
- "social_links": { "twitter": "url", ... },
84
- "canonical_url", "privacy_policy_url", "cookie_policy_url", "terms_url",
85
- "gdpr_enabled": false, "default_language": "en", "tracking": {} }
86
- → { "data": { "id": "<org_id>", ... } }
54
+ ```bash
55
+ myapi keys list
56
+ myapi keys create
57
+ myapi keys revoke <id>
87
58
  ```
88
- Errors: `400` invalid_json · `422` name_required, invalid_field:color_palette, invalid_field:value_propositions, invalid_field:social_links, invalid_field:tracking · `402` insufficient balance (org creation has a cost on paid plan).
89
59
 
90
- ### Async Brand Import
91
- ```
92
- POST /hq/org-imports
93
- { "org_id": "<id>" (required), "domain": "example.com" (required), "auto_accept": false }
94
- → { "data": { "job_id": "...", "status": "pending" } }
60
+ ## Billing
95
61
 
96
- GET /hq/org-imports/{job_id}
97
- → Poll until status = "awaiting_confirm". Returns brand_preview.
62
+ All services consume credits. Check balance and top up here.
98
63
 
99
- POST /hq/org-imports/{job_id}/confirm
100
- { ...optional overrides matching POST /hq/orgs payload... }
101
- { "data": { "id": "<org_id>", ... } }
64
+ ```bash
65
+ myapi billing balance
66
+ myapi billing topup <amount> # e.g. myapi billing topup 20
67
+ myapi billing history
102
68
  ```
103
69
 
104
- ### Manage Orgs
105
- - `GET /hq/orgs` — list all orgs.
106
- - `GET /hq/orgs/{id}` — get org details. Errors: `404` org_not_found.
107
- - `PATCH /hq/orgs/{id}` — partial update, same fields as create. Errors: `400` invalid_json · `404` org_not_found · `422` invalid_field:*.
108
- - `DELETE /hq/orgs/{id}` — delete org and cascade. Errors: `404` org_not_found.
70
+ If any service returns `402`, run `myapi billing balance` and top up before retrying.
109
71
 
110
- ## Billing
111
- - **Setup Payment Method:** You need to do this from the myapihq dashboard directly.
112
- - **Check Balance:** `GET /hq/billing/balance` `{ "data": { "balance_cents": 1000, "balance_display": "$10.00", "credits_cents": 500, "credits_display": "$5.00", "has_payment_method": true } }`.
113
- - **Billing History:** `GET /hq/billing/history`
114
- - **Top Up:** `POST /hq/billing/topup` — `{ "amount_cents": 1000 }` → `{ "data": { "new_balance_cents": 2000, "new_balance_display": "$20.00" } }`.
72
+ ## Config Defaults
73
+
74
+ Set defaults once to skip `--org` on every command:
75
+
76
+ ```bash
77
+ myapi auth config set-org <org_id>
78
+ myapi auth config set-domain <domain>
79
+ myapi auth config show
80
+ ```
115
81
 
116
- **On 402 from any service:** check balance and top up here before retrying.
82
+ Run `myapi --help` or `myapi <command> --help` for full flag reference.
@@ -1,83 +1,62 @@
1
1
  ---
2
2
  name: my-domain-api
3
3
  description: >
4
- Register new domains, check availability and pricing, import existing domains, and manage edge settings. Use this before creating mailboxes or funnels both require an owned domain.
4
+ Register new domains and manage edge settings. Required before a funnel can go live on a custom URL.
5
5
  ---
6
6
 
7
- # MyDomainAPI Skill
7
+ # MyDomainAPI
8
8
 
9
- ## Quick Start
10
- 1. `GET /domain/orgs/{org_id}/list?filter=all` — lists domains owned by your account. `filter` can be `all`, `unassigned`, or `org` (default).
11
- 2. `GET /domain/orgs/{org_id}/check/available/{domain}` — confirm availability and price.
12
- 3. `POST /domain/orgs/{org_id}/register` with `domain` and optional `years`.
13
- 4. Proceed to `my-email-api` for mailboxes or `my-funnel-api` for a website.
9
+ Handles domain registration, assignment to orgs, and edge (CDN/security) settings. DNS is fully managed — you never touch nameservers manually.
14
10
 
15
- DNS is fully managed by the platform — enabling seamless email deliverability, tracking pixel, and edge delivery integration. Manual DNS record management is not exposed.
11
+ ## How It Fits Together
16
12
 
17
- ## Dependencies & Backlinks
18
- - **Auth & Billing:** 401/402 fall back to `my-api-hq`.
19
- - **Next Steps:** After registration `my-email-api` for mailboxes or `my-funnel-api` for a website.
13
+ - Requires `api_key` and `org_id` from **myapihq**.
14
+ - A domain assigned to an org is the prerequisite for a **myfunnelapi** funnel to be reachable at a custom URL.
15
+ - Without a domain, funnels still work on the free `*.makeautonomous.com` preview subdomain.
20
16
 
21
- ## Authentication
22
- `Authorization: Bearer <api_key>` (from `my-api-hq`).
17
+ ## Typical Flow
23
18
 
24
- ## Endpoints
25
-
26
- ### Check Availability
27
- ```
28
- GET /domain/orgs/{org_id}/check/available/{domain}
29
- → { "available": true, "price_cents": 1200 }
19
+ ```bash
20
+ myapi domain check example.com # check availability + price
21
+ myapi domain register example.com # register it (deducts credits)
22
+ myapi domain assign example.com # assign to your default org
23
+ myapi domain status example.com # watch until status = active
30
24
  ```
31
- Errors: `400` INVALID_DOMAIN, TLD_NOT_SUPPORTED.
32
25
 
33
- ### Register Domain
34
- ```
35
- POST /domain/orgs/{org_id}/register
36
- { "domain": "example.com", "years": 1 }
37
- → { "domain": "...", "status": "provisioning", "domain_id": "..." }
38
- ```
39
- Errors: `400` invalid request, INVALID_DOMAIN, TLD_NOT_SUPPORTED · `409` DOMAIN_ALREADY_OWNED, DOMAIN_UNAVAILABLE · `402` INSUFFICIENT_BALANCE (includes `required_cents`) or UPGRADE_REQUIRED (free account) · `403` `already_owned` flag is not permitted.
26
+ After `status` shows `active`, your funnel will be live at `https://example.com`. SSL provisioning takes a few extra minutes after activation.
40
27
 
41
- ### Import Existing Domain
42
- ```
43
- POST /domain/orgs/{org_id}/import
44
- { "domain": "example.com", "namecheap_api_user": "optional", "namecheap_api_key": "optional" }
45
- ```
46
- Sets up DNS and email infrastructure automatically. Optionally updates Namecheap NS if credentials are provided.
47
- Errors: `402` insufficient balance.
28
+ ## All Commands
48
29
 
49
- To use Namecheap automation: go to **Profile > Tools > Namecheap API Access**, generate an API Key, and whitelist the MyAPI-HQ server IP — otherwise the API calls will be rejected.
30
+ | Command | What it does |
31
+ |---|---|
32
+ | `myapi domain check <domain>` | Check availability and yearly price |
33
+ | `myapi domain register <domain> [--years N]` | Register a new domain (explicit domain required) |
34
+ | `myapi domain list [--filter all\|unassigned\|org]` | List domains in your account |
35
+ | `myapi domain assign <domain>` | Assign domain to the default (or `--org`) org (explicit domain required) |
36
+ | `myapi domain unassign <domain>` | Remove domain from its org (explicit domain required) |
37
+ | `myapi domain status <domain>` | Check registration + DNS propagation status |
38
+ | `myapi domain settings <domain>` | View edge/CDN settings |
39
+ | `myapi domain update-settings <domain>` | Update edge settings (security level, browser check, cache purge) |
50
40
 
51
- ### List & Status
52
- ```
53
- GET /domain/orgs/{org_id}/list
54
- GET /domain/orgs/{org_id}/{domain}/status
55
- ```
56
- Errors (status): `404` DOMAIN_NOT_FOUND.
41
+ `register`, `assign`, and `unassign` always require an explicit domain argument — they do not fall back to any stored default, to prevent accidental destructive actions.
57
42
 
58
- ### Assign / Unassign Domain
59
- ```
60
- POST /domain/orgs/{org_id}/{domain}/assign
61
- { "org_id": "<target_org_id>" } // Pass null to unassign
62
- ```
63
- Associates a domain already in the account with a specific organization, or removes it from its current organization if `org_id` is null.
64
- Errors: `404` DOMAIN_NOT_FOUND · `422` ORG_NOT_FOUND.
43
+ ## Edge Settings
65
44
 
66
- ### Edge Settings
45
+ Fine-tune CDN/security behavior per domain:
67
46
 
68
- **Update:**
47
+ ```bash
48
+ myapi domain update-settings example.com \
49
+ --security=essentially_off \
50
+ --browser-check=off \
51
+ --purge-cache
69
52
  ```
70
- POST /domain/orgs/{org_id}/{domain}/settings
71
- {
72
- "security_level": "essentially_off", // essentially_off | medium | high | under_attack
73
- "browser_check": "off", // on | off
74
- "purge_cache": true
75
- }
76
- ```
77
- *To allow AI training bots and crawlers: set `security_level: "essentially_off"` and `browser_check: "off"`.*
78
53
 
79
- **Get:**
80
- ```
81
- GET /domain/orgs/{org_id}/{domain}/settings
82
- { "domain": "...", "security_level": "...", "browser_check": "...", "ai_bots_protection": "disabled", "is_robots_txt_managed": false }
83
- ```
54
+ Security levels: `essentially_off` · `low` · `medium` · `high` · `under_attack`.
55
+ Set `essentially_off` + `browser-check=off` to allow AI crawlers and training bots through without challenge pages.
56
+
57
+ ## Notes
58
+
59
+ - All commands default to `--org` from your saved config. Set it once with `myapi auth config set-org <id>`.
60
+ - `402` errors mean insufficient credits — run `myapi billing topup <amount>`.
61
+
62
+ Run `myapi domain --help` or `myapi domain <subcommand> --help` for full flag reference.
@@ -1,35 +1,70 @@
1
1
  ---
2
- name: my-funnel-api:funnel
2
+ name: my-funnel-api
3
3
  description: >
4
- A lean CRUD and CDN Publishing API. Manage funnel configurations, push raw HTML pages, and deploy static assets to the edge KV.
4
+ Create and publish websites (funnels) to the edge. Push raw HTML to any slug and it goes live instantly on your org's domain or preview subdomain.
5
5
  ---
6
6
 
7
- # MyFunnelAPI Skill
7
+ # MyFunnelAPI
8
8
 
9
- ## 1. Funnel Management (Authenticated)
10
- These endpoints manage the database records and structural configuration of funnels.
9
+ A funnel is a website tied to an org. You push raw HTML pages to slugs and they are served from the edge immediately — no build pipeline, no deploy queue.
11
10
 
12
- - `GET /funnel/orgs/{org_id}/funnels`
13
- Lists all funnels for the specified organization.
14
- - `POST /funnel/orgs/{org_id}/funnels`
15
- Creates a new funnel entry. Expects basic configuration metadata (name, domain, etc.). Body: `{ "domain": "example.com" }`
16
- - `GET /funnel/orgs/{org_id}/funnels/{id}`
17
- Retrieves the metadata and configuration details of a specific funnel.
18
- - `DELETE /funnel/orgs/{org_id}/funnels/{id}`
19
- Deletes a funnel from the database and automatically purges all of its preview and published pages from the edge KV cache.
11
+ ## How It Fits Together
20
12
 
21
- ## 2. Publishing & Edge Deployment (Authenticated)
22
- These endpoints interact with the edge KV cache to push HTML/JS content to the edge domains. As soon as you push a page, it is live.
13
+ - Requires `api_key` and `org_id` from **myapihq**.
14
+ - Works out of the box on the free preview subdomain (`*.makeautonomous.com`).
15
+ - To serve on a custom domain, register and assign a domain via **mydomainapi** first.
23
16
 
24
- - `POST /funnel/orgs/{org_id}/funnels/{id}/push-page`
25
- Deploys raw HTML to a specific slug on the live funnel (e.g., pushing custom HTML to /contact). Body: `{"slug": "/route", "html": "..."}`.
26
- - `POST /funnel/orgs/{org_id}/funnels/{id}/verify`
27
- Pre-publish verification. Validates syntax and structure of raw HTML or an existing page slug.
17
+ ## Typical Flow
28
18
 
29
- ## 3. Public Proxies (Unauthenticated)
30
- These endpoints are called directly by the end-users' browsers (via the deployed static HTML). They do not require API keys. They are stateless and act as routing proxies to the Webhook API.
19
+ ```bash
20
+ myapi funnel create # creates a funnel under your default org
21
+ echo '<h1>Hello</h1>' | myapi funnel push / # pushes HTML to /
22
+ myapi funnel list # see all funnels and their preview URLs
23
+ ```
31
24
 
32
- - `POST /funnel/funnels/{id}/submit/{slug...}`
33
- The endpoint for HTML form submissions. Validates the JSON payload, returns a 200 OK to the browser, and asynchronously POSTs the data to the organization's matching webhook (or fallback webhook).
34
- - `POST /funnel/funnels/{id}/event`
35
- The endpoint for analytics and tracking scripts. Proxies click events, pageviews, and pixel tracking data to the configured webhook endpoints. Includes built-in rate limiting (max 60 req/min per funnel).
25
+ After `funnel create`, the CLI prints a preview URL. After `push`, the page is immediately live.
26
+
27
+ ## All Commands
28
+
29
+ | Command | What it does |
30
+ |---|---|
31
+ | `myapi funnel create` | Create a new funnel in the default org |
32
+ | `myapi funnel list` | List all funnels with their preview/domain URLs |
33
+ | `myapi funnel get <id>` | Inspect a funnel's metadata and preview URL |
34
+ | `myapi funnel delete <id>` | Delete funnel and purge all its edge pages |
35
+ | `myapi funnel push [slug]` | Push HTML from stdin to a slug path |
36
+
37
+ ## Pushing Pages
38
+
39
+ The `push` command reads HTML from stdin and deploys it to a slug. The funnel is resolved from your saved default (`myapi auth config set-funnel <id>`) or `--funnel <id>`.
40
+
41
+ ```bash
42
+ # push to /
43
+ cat index.html | myapi funnel push /
44
+
45
+ # push to /contact
46
+ cat contact.html | myapi funnel push /contact
47
+
48
+ # push to / using explicit funnel
49
+ cat index.html | myapi funnel push / --funnel <funnel_id>
50
+
51
+ # pipe from a generator
52
+ my-html-gen | myapi funnel push /landing
53
+ ```
54
+
55
+ Omitting `[slug]` defaults to `/`.
56
+
57
+ ## Form Submissions & Analytics
58
+
59
+ Funnels include two public proxy endpoints your HTML can call directly (no API key needed):
60
+
61
+ - **Form submit:** `POST /funnel/funnels/{id}/submit/{slug}` — validates payload and forwards to your org's configured webhook.
62
+ - **Analytics/tracking:** `POST /funnel/funnels/{id}/event` — proxies pageviews, clicks, and pixel events to your webhook. Rate-limited to 60 req/min per funnel.
63
+
64
+ ## Notes
65
+
66
+ - Default org and funnel are stored in config. Set them once with `myapi auth config set-org <id>` to skip `--org` on every command.
67
+ - Deleting a funnel purges all its edge pages immediately.
68
+ - `402` errors mean insufficient credits — run `myapi billing topup <amount>`.
69
+
70
+ Run `myapi funnel --help` or `myapi funnel <subcommand> --help` for full flag reference.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myapihq/cli",
3
- "version": "1.0.79",
3
+ "version": "1.0.82",
4
4
  "description": "MyAPI command-line interface",
5
5
  "type": "module",
6
6
  "files": [