Promptimus API

Authentication

Header
Authorization: Bearer API_KEY
Content-Type
application/json

Quickstart

Browser (this host or extension)

const headers = {
  "Authorization": "Bearer API_KEY",
  "Content-Type": "application/json"
};

const me = await fetch("https://promptimus.app/api/v1/me", { headers }).then(r => r.json());

const created = await fetch("https://promptimus.app/api/v1/capsules", {
  method: "POST", headers,
  body: JSON.stringify({ name: "Hello", html: "<html>Hi</html>", publish: true })
}).then(r => r.json());

// Upload two images (Prime/Mega)
// do NOT set Content-Type manually when using FormData
const fd = new FormData();
fd.append("files", new File([blob1], "hero.jpg"));
fd.append("files", new File([blob2], "logo.png"));
const up = await fetch(`https://promptimus.app/api/v1/capsules/${created.id}/images`, {
  method: "POST",
  headers: { "Authorization": "Bearer API_KEY" },
  body: fd
}).then(r => r.json());

Server / CLI

# who am I
curl -H "Authorization: Bearer API_KEY" https://promptimus.app/api/v1/me

# create capsule
curl -X POST -H "Authorization: Bearer API_KEY" -H "Content-Type: application/json" \
  -d '{"name":"Hello","html":"<html><h1>Hi</h1></html>","publish":true}' \
  https://promptimus.app/api/v1/capsules

# upload images (Prime/Mega)
curl -X POST -H "Authorization: Bearer API_KEY" \
  -F "files=@/path/hero.jpg" -F "files=@/path/logo.png" \
  https://promptimus.app/api/v1/capsules/123/images

Use assets in your HTML

Place files under assets/. Reference them with a relative path.
<img src="assets/hero.jpg" alt="Hero" width="1200" height="600" loading="lazy">
Sandbox/CSP: Your capsule runs under strict CSP. HTML under /c/<slug>/raw/ cannot call external URLs by default (connect-src 'none'). Inline scripts and styles are allowed, but external requests are blocked. Use local assets.

Endpoints

GET /api/v1/me
Returns account, plan limits, usage.

curl

curl -H "Authorization: Bearer API_KEY" https://promptimus.app/api/v1/me

fetch()

const headers = { "Authorization": "Bearer API_KEY" };
const me = await fetch("https://promptimus.app/api/v1/me", { headers }).then(r => r.json());

Response

200 OK
{ "email":"you@example.com",
  "plan":"free",
  "limits":{"max_capsules":3},
  "usage":{"capsules":1} }
POST /api/v1/apikey/rotate
Rotate API key.

curl

curl -X POST -H "Authorization: Bearer API_KEY" https://promptimus.app/api/v1/apikey/rotate

fetch()

const r = await fetch("https://promptimus.app/api/v1/apikey/rotate", {
  method: "POST",
  headers: { "Authorization": "Bearer API_KEY" }
}).then(r => r.json());

Response

200 OK
{ "api_key":"<new_key>" }
GET /api/v1/capsules
List Code Capsules.

curl

curl -H "Authorization: Bearer API_KEY" https://promptimus.app/api/v1/capsules

fetch()

const list = await fetch("https://promptimus.app/api/v1/capsules", {
  headers: { "Authorization": "Bearer API_KEY" }
}).then(r => r.json());

Response

200 OK
[ { "id":1, "name":"Hello", "slug":"hello-ab12",
    "published":true, "url":"https://promptimus.app/c/hello-ab12" } ]
POST /api/v1/capsules
Create Code Capsule.

curl

curl -X POST -H "Authorization: Bearer API_KEY" -H "Content-Type: application/json" \
  -d '{"name":"Hello","html":"<html>Hi</html>","publish":true}' \
  https://promptimus.app/api/v1/capsules

fetch()

const created = await fetch("https://promptimus.app/api/v1/capsules", {
  method: "POST",
  headers: {
    "Authorization": "Bearer API_KEY",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({ name:"Hello", html:"<html>Hi</html>", publish:true })
}).then(r => r.json());

Response

201 Created
{ "id":1, "name":"Hello", "slug":"hello-ab12",
  "published":true, "url":"https://promptimus.app/c/hello-ab12" }
PUT /api/v1/capsules/<id>
Overwrite HTML, rename, toggle publish.

curl

curl -X PUT -H "Authorization: Bearer API_KEY" -H "Content-Type: application/json" \
  -d '{"name":"New","html":"<html>...</html>","publish":false}' \
  https://promptimus.app/api/v1/capsules/123

fetch()

const res = await fetch("https://promptimus.app/api/v1/capsules/123", {
  method: "PUT",
  headers: {
    "Authorization": "Bearer API_KEY",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({ name:"New", html:"<html>...</html>", publish:false })
}).then(r => r.json());

Response

200 OK
{ "ok": true }
POST /api/v1/capsules/<id>/publish
Publish or unpublish.

curl

curl -X POST -H "Authorization: Bearer API_KEY" -H "Content-Type: application/json" \
  -d '{"publish":true}' \
  https://promptimus.app/api/v1/capsules/123/publish

fetch()

const out = await fetch("https://promptimus.app/api/v1/capsules/123/publish", {
  method: "POST",
  headers: {
    "Authorization": "Bearer API_KEY",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({ publish:true })
}).then(r => r.json());

Response

200 OK
{ "published": true, "url":"https://promptimus.app/c/slug" }
DELETE /api/v1/capsules/<id>
Delete capsule and files.

curl

curl -X DELETE -H "Authorization: Bearer API_KEY" https://promptimus.app/api/v1/capsules/123

fetch()

await fetch("https://promptimus.app/api/v1/capsules/123", {
  method: "DELETE",
  headers: { "Authorization": "Bearer API_KEY" }
}).then(r => r.json());

Response

200 OK
{ "ok": true }
GET /api/v1/capsules/<id>/images
List images in assets/. Prime/Mega

curl

curl -H "Authorization: Bearer API_KEY" https://promptimus.app/api/v1/capsules/123/images

fetch()

const imgs = await fetch("https://promptimus.app/api/v1/capsules/123/images", {
  headers: { "Authorization": "Bearer API_KEY" }
}).then(r => r.json());

Response

200 OK
[
  { "name":"hero.jpg","bytes":123456,"width":1200,"height":600,
    "url":"https://promptimus.app/c/slug/raw/assets/hero.jpg" }
]
POST /api/v1/capsules/<id>/images
Upload one or more images. Accepts multipart/form-data with repeated files. Prime/Mega

curl

curl -X POST -H "Authorization: Bearer API_KEY" \
  -F "files=@/path/hero.jpg" -F "files=@/path/logo.png" \
  https://promptimus.app/api/v1/capsules/123/images

fetch()

const fd = new FormData();
fd.append("files", fileInput.files[0]);
const r = await fetch("https://promptimus.app/api/v1/capsules/123/images", {
  method: "POST",
  headers: { "Authorization": "Bearer API_KEY" },
  body: fd
}).then(r => r.json());

Response

201 Created
{ "uploaded":[
    { "name":"hero.jpg","width":1200,"height":600,"bytes":123456,
      "url":"https://promptimus.app/c/slug/raw/assets/hero.jpg" }
  ],
  "errors":[]
}
Partial success returns 207 Multi-Status. Invalid files return errors.
DELETE /api/v1/capsules/<id>/images/<name>
Delete an image by filename. Prime/Mega

curl

curl -X DELETE -H "Authorization: Bearer API_KEY" \
  https://promptimus.app/api/v1/capsules/123/images/hero.jpg

fetch()

await fetch("https://promptimus.app/api/v1/capsules/123/images/hero.jpg", {
  method: "DELETE",
  headers: { "Authorization": "Bearer API_KEY" }
}).then(r => r.json());

Response

200 OK
{ "ok": true }
GET /api/v1/health
Health check.

curl

curl https://promptimus.app/api/v1/health

fetch()

const health = await fetch("https://promptimus.app/api/v1/health").then(r => r.json());

Response

200 OK
{ "ok": true, "time": "2025-01-01T00:00:00Z" }