Endpoints
Publish an app
Put the saved app online, the way the Publish button does.
https://www.setherion.com/api/v1/projects/{id}/publishPlan: Every plan
Puts the app online exactly as it is saved, through the same steps as the Publish button in the editor. An app that was published before keeps its address; one published for the first time gets an address made from its name, on setherion.app.
Publishing does not use credits. You need to be able to edit the app. It is limited to 100 publishes per account per day through the API, which no one working by hand reaches; the editor's own button has no such limit.
Request
No body is needed.
curl -X POST https://www.setherion.com/api/v1/projects/7c1e4a52-9b0d-4f3e-8a61-2d5f0c9e7b14/publish \
-H "Authorization: Bearer $SETHERION_API_KEY"Response
{ "ok": true, "url": "https://coffee-shop.setherion.app", "ready": true }| Field | Type | Meaning |
|---|---|---|
ok | boolean | true when the app was published. |
url | string | Where the app is online. |
ready | boolean | false when the address is still being set up. It works within a minute or two. |
Publishing the same saved app twice is safe: the second call answers with the same address.
Edit, then publish
What is published is what is saved, and an edit is saved when it finishes. So an edit followed by a publish puts the change online:
const base = 'https://www.setherion.com/api/v1/projects'
const headers = {
Authorization: `Bearer ${process.env.SETHERION_API_KEY}`,
'Content-Type': 'application/json',
}
const edit = await fetch(`${base}/${appId}/edit`, {
method: 'POST',
headers,
body: JSON.stringify({ prompt: 'Add a contact form' }),
}).then(r => r.json())
if (edit.ok) {
const live = await fetch(`${base}/${appId}/publish`, { method: 'POST', headers }).then(r => r.json())
console.log(live.url)
}Errors
| Status | When |
|---|---|
400 | The app's code contains a secret, such as an API key, and was not published. The error names where. |
401 | The key is missing, wrong or revoked. |
404 | There is no such app, or your key cannot edit it. |
409 | The app has no code yet, or the address it needs is not available, or it is a private app that cannot go on a domain of your own. The error says which. |
429 | You have published 100 times through the API today. The count resets tomorrow. |
502 | Publishing failed on our side, or the build on the host failed. Try again. |
503 | Publishing is briefly unavailable. Try again in a minute. |
The exact sentences
| Status | error |
|---|---|
400 | Publishing would put a secret key on the open internet: ... followed by the kind of secret, the file and the line, and what to do instead. |
404 | No such app on this account. |
409 | This app has no code yet. Build it in Setherion first. |
409 | The address coffee-shop.setherion.app belongs to another app. Choose a different one. |
409 | Could not find a free address for this app. Rename it and publish again. |
409 | This app is private, and a private app can only be published on its setherion.app address. To use a domain of your own, make it public first. Otherwise try again in a moment. Nothing was published. |
429 | That is 100 publishes through the API today. The count resets tomorrow. |
502 | The build failed on the host, so this version is not online. Publish again, and if it fails again, ask for a fix in the editor. |
502 | The build was cancelled on the host, so this version is not online. Publish again. |
503 | Publishing is briefly unavailable. Try again in a minute. |
Was this page helpful?
