Skip to content

Commit 0c79357

Browse files
MajorTalclaude
andcommitted
Migrate API URLs from /v1/{resource} to /{resource}/v1
Update all endpoint paths across MCP tools, CLI, OpenClaw scripts, SKILL.md docs, and tests to match the new gateway route layout. Admin routes change from /admin/v1/projects/ to /projects/v1/admin/. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f79bcbd commit 0c79357

63 files changed

Lines changed: 149 additions & 149 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,10 @@ Design tables based on what the user needs. Add `user_id uuid` columns if you pl
262262
Use `run_sql` to apply RLS if users should only see their own rows:
263263

264264
```
265-
run_sql(project_id: "prj_...", sql: "-- Use the /admin/v1/projects/:id/rls endpoint via HTTP for RLS templates")
265+
run_sql(project_id: "prj_...", sql: "-- Use the /projects/v1/admin/:id/rls endpoint via HTTP for RLS templates")
266266
```
267267

268-
Three RLS templates are available via the REST API:
268+
Three RLS templates are available via the API:
269269
- **`user_owns_rows`** — Users can only access rows where `owner_column = auth.uid()`. Best for user-scoped data.
270270
- **`public_read`** — Anyone can read. Only authenticated users can write.
271271
- **`public_read_write`** — Anyone can read and write. Use for guestbooks, public logs.

cli/lib/agent.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ async function contact(args) {
4747
if (email) body.email = email;
4848
if (webhook) body.webhook = webhook;
4949

50-
const res = await fetchPaid(`${API}/v1/agent/contact`, {
50+
const res = await fetchPaid(`${API}/agent/v1/contact`, {
5151
method: "PUT",
5252
headers: { "Content-Type": "application/json" },
5353
body: JSON.stringify(body),

cli/lib/apps.mjs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Examples:
3131
`;
3232

3333
async function browse(args) {
34-
let url = `${API}/v1/apps`;
34+
let url = `${API}/apps/v1`;
3535
const tags = [];
3636
for (let i = 0; i < args.length; i++) {
3737
if (args[i] === "--tag" && args[i + 1]) tags.push(args[++i]);
@@ -71,7 +71,7 @@ async function fork(versionId, name, args) {
7171
const body = { version_id: versionId, name };
7272
if (opts.subdomain) body.subdomain = opts.subdomain;
7373

74-
const res = await fetchPaid(`${API}/v1/fork/${opts.tier}`, {
74+
const res = await fetchPaid(`${API}/fork/v1/${opts.tier}`, {
7575
method: "POST",
7676
headers: { "Content-Type": "application/json" },
7777
body: JSON.stringify(body),
@@ -109,7 +109,7 @@ async function publish(projectId, args) {
109109
if (opts.visibility) body.visibility = opts.visibility;
110110
if (opts.forkAllowed !== undefined) body.fork_allowed = opts.forkAllowed;
111111

112-
const res = await fetch(`${API}/admin/v1/projects/${projectId}/publish`, {
112+
const res = await fetch(`${API}/projects/v1/admin/${projectId}/publish`, {
113113
method: "POST",
114114
headers: { "Authorization": `Bearer ${p.service_key}`, "Content-Type": "application/json" },
115115
body: JSON.stringify(body),
@@ -121,7 +121,7 @@ async function publish(projectId, args) {
121121

122122
async function versions(projectId) {
123123
const p = findProject(projectId);
124-
const res = await fetch(`${API}/admin/v1/projects/${projectId}/versions`, {
124+
const res = await fetch(`${API}/projects/v1/admin/${projectId}/versions`, {
125125
headers: { "Authorization": `Bearer ${p.service_key}` },
126126
});
127127
const data = await res.json();
@@ -131,7 +131,7 @@ async function versions(projectId) {
131131

132132
async function inspect(versionId) {
133133
if (!versionId) { console.error(JSON.stringify({ status: "error", message: "Missing version ID" })); process.exit(1); }
134-
const res = await fetch(`${API}/v1/apps/${versionId}`);
134+
const res = await fetch(`${API}/apps/v1/${versionId}`);
135135
const data = await res.json();
136136
if (!res.ok) { console.error(JSON.stringify({ status: "error", http: res.status, ...data })); process.exit(1); }
137137
console.log(JSON.stringify(data, null, 2));
@@ -147,7 +147,7 @@ async function update(projectId, versionId, args) {
147147
if (args[i] === "--fork-allowed") body.fork_allowed = true;
148148
if (args[i] === "--no-fork") body.fork_allowed = false;
149149
}
150-
const res = await fetch(`${API}/admin/v1/projects/${projectId}/versions/${versionId}`, {
150+
const res = await fetch(`${API}/projects/v1/admin/${projectId}/versions/${versionId}`, {
151151
method: "PATCH",
152152
headers: { "Authorization": `Bearer ${p.service_key}`, "Content-Type": "application/json" },
153153
body: JSON.stringify(body),
@@ -159,7 +159,7 @@ async function update(projectId, versionId, args) {
159159

160160
async function deleteVersion(projectId, versionId) {
161161
const p = findProject(projectId);
162-
const res = await fetch(`${API}/admin/v1/projects/${projectId}/versions/${versionId}`, {
162+
const res = await fetch(`${API}/projects/v1/admin/${projectId}/versions/${versionId}`, {
163163
method: "DELETE",
164164
headers: { "Authorization": `Bearer ${p.service_key}` },
165165
});

cli/lib/deploy.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export async function run(args) {
8484
client.register("eip155:84532", new ExactEvmScheme(signer));
8585
const fetchPaid = wrapFetchWithPayment(fetch, client);
8686

87-
const res = await fetchPaid(`${API}/v1/deploy/${opts.tier}`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(manifest) });
87+
const res = await fetchPaid(`${API}/deploy/v1/${opts.tier}`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(manifest) });
8888
const result = await res.json();
8989
if (!res.ok) { console.error(JSON.stringify({ status: "error", http: res.status, ...result })); process.exit(1); }
9090
saveProject(result);

cli/lib/functions.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ async function deploy(projectId, name, args) {
6565
if (opts.deps) body.deps = opts.deps;
6666

6767
const fetchPaid = await setupPaidFetch();
68-
const res = await fetchPaid(`${API}/admin/v1/projects/${projectId}/functions`, {
68+
const res = await fetchPaid(`${API}/projects/v1/admin/${projectId}/functions`, {
6969
method: "POST",
7070
headers: { "Authorization": `Bearer ${p.service_key}`, "Content-Type": "application/json" },
7171
body: JSON.stringify(body),
@@ -102,7 +102,7 @@ async function logs(projectId, name, args) {
102102
for (let i = 0; i < args.length; i++) {
103103
if (args[i] === "--tail" && args[i + 1]) tail = parseInt(args[++i]);
104104
}
105-
const res = await fetch(`${API}/admin/v1/projects/${projectId}/functions/${encodeURIComponent(name)}/logs?tail=${tail}`, {
105+
const res = await fetch(`${API}/projects/v1/admin/${projectId}/functions/${encodeURIComponent(name)}/logs?tail=${tail}`, {
106106
headers: { "Authorization": `Bearer ${p.service_key}` },
107107
});
108108
const data = await res.json();
@@ -112,7 +112,7 @@ async function logs(projectId, name, args) {
112112

113113
async function list(projectId) {
114114
const p = findProject(projectId);
115-
const res = await fetch(`${API}/admin/v1/projects/${projectId}/functions`, {
115+
const res = await fetch(`${API}/projects/v1/admin/${projectId}/functions`, {
116116
headers: { "Authorization": `Bearer ${p.service_key}` },
117117
});
118118
const data = await res.json();
@@ -122,7 +122,7 @@ async function list(projectId) {
122122

123123
async function deleteFunction(projectId, name) {
124124
const p = findProject(projectId);
125-
const res = await fetch(`${API}/admin/v1/projects/${projectId}/functions/${encodeURIComponent(name)}`, {
125+
const res = await fetch(`${API}/projects/v1/admin/${projectId}/functions/${encodeURIComponent(name)}`, {
126126
method: "DELETE",
127127
headers: { "Authorization": `Bearer ${p.service_key}` },
128128
});

cli/lib/image.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export async function run(sub, args) {
6666
client.register("eip155:84532", new ExactEvmScheme(signer));
6767
const fetchPaid = wrapFetchWithPayment(fetch, client);
6868

69-
const res = await fetchPaid(`${API}/v1/generate-image`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ prompt: opts.prompt, aspect: opts.aspect }) });
69+
const res = await fetchPaid(`${API}/generate-image/v1`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ prompt: opts.prompt, aspect: opts.aspect }) });
7070
const data = await res.json();
7171
if (!res.ok) { console.error(JSON.stringify({ status: "error", http: res.status, ...data })); process.exit(1); }
7272

cli/lib/message.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ async function send(text) {
3535
client.register("eip155:84532", new ExactEvmScheme(signer));
3636
const fetchPaid = wrapFetchWithPayment(fetch, client);
3737

38-
const res = await fetchPaid(`${API}/v1/message`, {
38+
const res = await fetchPaid(`${API}/message/v1`, {
3939
method: "POST",
4040
headers: { "Content-Type": "application/json" },
4141
body: JSON.stringify({ message: text }),

cli/lib/projects.mjs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ async function setupPaidFetch() {
5959
}
6060

6161
async function quote() {
62-
const res = await fetch(`${API}/v1/projects`);
62+
const res = await fetch(`${API}/projects/v1`);
6363
const data = await res.json();
6464
if (!res.ok) { console.error(JSON.stringify({ status: "error", http: res.status, ...data })); process.exit(1); }
6565
console.log(JSON.stringify(data, null, 2));
@@ -74,7 +74,7 @@ async function provision(args) {
7474
const fetchPaid = await setupPaidFetch();
7575
const body = { tier: opts.tier };
7676
if (opts.name) body.name = opts.name;
77-
const res = await fetchPaid(`${API}/v1/projects`, {
77+
const res = await fetchPaid(`${API}/projects/v1`, {
7878
method: "POST",
7979
headers: { "Content-Type": "application/json" },
8080
body: JSON.stringify(body),
@@ -98,7 +98,7 @@ async function provision(args) {
9898
async function rls(projectId, template, tablesJson) {
9999
const p = findProject(projectId);
100100
const tables = JSON.parse(tablesJson);
101-
const res = await fetch(`${API}/admin/v1/projects/${projectId}/rls`, {
101+
const res = await fetch(`${API}/projects/v1/admin/${projectId}/rls`, {
102102
method: "POST",
103103
headers: { "Authorization": `Bearer ${p.service_key}`, "Content-Type": "application/json" },
104104
body: JSON.stringify({ template, tables }),
@@ -116,7 +116,7 @@ async function list() {
116116

117117
async function sqlCmd(projectId, query) {
118118
const p = findProject(projectId);
119-
const res = await fetch(`${API}/admin/v1/projects/${projectId}/sql`, { method: "POST", headers: { "Authorization": `Bearer ${p.service_key}`, "Content-Type": "text/plain" }, body: query });
119+
const res = await fetch(`${API}/projects/v1/admin/${projectId}/sql`, { method: "POST", headers: { "Authorization": `Bearer ${p.service_key}`, "Content-Type": "text/plain" }, body: query });
120120
console.log(JSON.stringify(await res.json(), null, 2));
121121
}
122122

@@ -128,23 +128,23 @@ async function rest(projectId, table, queryParams) {
128128

129129
async function usage(projectId) {
130130
const p = findProject(projectId);
131-
const res = await fetch(`${API}/admin/v1/projects/${projectId}/usage`, { headers: { "Authorization": `Bearer ${p.service_key}` } });
131+
const res = await fetch(`${API}/projects/v1/admin/${projectId}/usage`, { headers: { "Authorization": `Bearer ${p.service_key}` } });
132132
const data = await res.json();
133133
if (!res.ok) { console.error(JSON.stringify({ status: "error", http: res.status, ...data })); process.exit(1); }
134134
console.log(JSON.stringify(data, null, 2));
135135
}
136136

137137
async function schema(projectId) {
138138
const p = findProject(projectId);
139-
const res = await fetch(`${API}/admin/v1/projects/${projectId}/schema`, { headers: { "Authorization": `Bearer ${p.service_key}` } });
139+
const res = await fetch(`${API}/projects/v1/admin/${projectId}/schema`, { headers: { "Authorization": `Bearer ${p.service_key}` } });
140140
const data = await res.json();
141141
if (!res.ok) { console.error(JSON.stringify({ status: "error", http: res.status, ...data })); process.exit(1); }
142142
console.log(JSON.stringify(data, null, 2));
143143
}
144144

145145
async function renew(projectId) {
146146
const fetchPaid = await setupPaidFetch();
147-
const res = await fetchPaid(`${API}/v1/projects/${projectId}/renew`, { method: "POST", headers: { "Content-Type": "application/json" } });
147+
const res = await fetchPaid(`${API}/projects/v1/${projectId}/renew`, { method: "POST", headers: { "Content-Type": "application/json" } });
148148
const data = await res.json();
149149
if (!res.ok) { console.error(JSON.stringify({ status: "error", http: res.status, ...data })); process.exit(1); }
150150
const projects = loadProjects();
@@ -155,7 +155,7 @@ async function renew(projectId) {
155155

156156
async function deleteProject(projectId) {
157157
const p = findProject(projectId);
158-
const res = await fetch(`${API}/v1/projects/${projectId}`, { method: "DELETE", headers: { "Authorization": `Bearer ${p.service_key}` } });
158+
const res = await fetch(`${API}/projects/v1/${projectId}`, { method: "DELETE", headers: { "Authorization": `Bearer ${p.service_key}` } });
159159
if (res.status === 204 || res.ok) {
160160
saveProjects(loadProjects().filter(pr => pr.project_id !== projectId));
161161
console.log(JSON.stringify({ status: "ok", message: `Project ${projectId} deleted.` }));

cli/lib/secrets.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Notes:
2222

2323
async function set(projectId, key, value) {
2424
const p = findProject(projectId);
25-
const res = await fetch(`${API}/admin/v1/projects/${projectId}/secrets`, {
25+
const res = await fetch(`${API}/projects/v1/admin/${projectId}/secrets`, {
2626
method: "POST",
2727
headers: { "Authorization": `Bearer ${p.service_key}`, "Content-Type": "application/json" },
2828
body: JSON.stringify({ key, value }),
@@ -34,7 +34,7 @@ async function set(projectId, key, value) {
3434

3535
async function list(projectId) {
3636
const p = findProject(projectId);
37-
const res = await fetch(`${API}/admin/v1/projects/${projectId}/secrets`, {
37+
const res = await fetch(`${API}/projects/v1/admin/${projectId}/secrets`, {
3838
headers: { "Authorization": `Bearer ${p.service_key}` },
3939
});
4040
const data = await res.json();
@@ -44,7 +44,7 @@ async function list(projectId) {
4444

4545
async function deleteSecret(projectId, key) {
4646
const p = findProject(projectId);
47-
const res = await fetch(`${API}/admin/v1/projects/${projectId}/secrets/${encodeURIComponent(key)}`, {
47+
const res = await fetch(`${API}/projects/v1/admin/${projectId}/secrets/${encodeURIComponent(key)}`, {
4848
method: "DELETE",
4949
headers: { "Authorization": `Bearer ${p.service_key}` },
5050
});

cli/lib/sites.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ async function deploy(args) {
7777
client.register("eip155:84532", new ExactEvmScheme(signer));
7878
const fetchPaid = wrapFetchWithPayment(fetch, client);
7979

80-
const res = await fetchPaid(`${API}/v1/deployments`, {
80+
const res = await fetchPaid(`${API}/deployments/v1`, {
8181
method: "POST",
8282
headers: { "Content-Type": "application/json" },
8383
body: JSON.stringify(body),
@@ -93,7 +93,7 @@ async function status(args) {
9393
if (!args[i].startsWith("-")) { deploymentId = args[i]; break; }
9494
}
9595
if (!deploymentId) { console.error(JSON.stringify({ status: "error", message: "Missing deployment ID" })); process.exit(1); }
96-
const res = await fetch(`${API}/v1/deployments/${deploymentId}`);
96+
const res = await fetch(`${API}/deployments/v1/${deploymentId}`);
9797
const data = await res.json();
9898
if (!res.ok) { console.error(JSON.stringify({ status: "error", http: res.status, ...data })); process.exit(1); }
9999
console.log(JSON.stringify(data, null, 2));

0 commit comments

Comments
 (0)