Endpoints

Publish an app

Put the saved app online, the way the Publish button does.

POSThttps://www.setherion.com/api/v1/projects/{id}/publish

Plan: 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.

bash
curl -X POST https://www.setherion.com/api/v1/projects/7c1e4a52-9b0d-4f3e-8a61-2d5f0c9e7b14/publish \
  -H "Authorization: Bearer $SETHERION_API_KEY"

Response

json
{ "ok": true, "url": "https://coffee-shop.setherion.app", "ready": true }
FieldTypeMeaning
okbooleantrue when the app was published.
urlstringWhere the app is online.
readybooleanfalse 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:

js
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

StatusWhen
400The app's code contains a secret, such as an API key, and was not published. The error names where.
401The key is missing, wrong or revoked.
404There is no such app, or your key cannot edit it.
409The 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.
429You have published 100 times through the API today. The count resets tomorrow.
502Publishing failed on our side, or the build on the host failed. Try again.
503Publishing is briefly unavailable. Try again in a minute.
The exact sentences
Statuserror
400Publishing 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.
404No such app on this account.
409This app has no code yet. Build it in Setherion first.
409The address coffee-shop.setherion.app belongs to another app. Choose a different one.
409Could not find a free address for this app. Rename it and publish again.
409This 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.
429That is 100 publishes through the API today. The count resets tomorrow.
502The 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.
502The build was cancelled on the host, so this version is not online. Publish again.
503Publishing is briefly unavailable. Try again in a minute.

Was this page helpful?

Join the community

Questions, ideas and what others are building.