Codetje docs

HTTP API

Everything rt and the console do goes through these APIs, so you can script them too. Send credentials as Authorization: Bearer <token>, using an access token from accounts.codetje.com/tokens.

Runner

At https://run.codetje.app.

Route
ANY /run/{ns}/{name}[@version|@tag]/{path} Run a package's handler with path /{path} and the query as sent. Without @…, it runs stable, else latest. Needs a token for the namespace unless the package is public. The module gets x-forwarded-prefix and no Authorization
GET /logs/{ns}/{name} A package's logs, as server-sent events

Log events are named stdout, stderr and runner, and carry {stream, version, line} as JSON.

Module hosts, https://{ns}--{name}.codetje.app and https://{ns}--{name}--{tag}.codetje.app, pass every path to the package, with no prefix.

Registry

At https://registry.codetje.com. Reading a public package needs no token. Everything else needs a token for its namespace.

Route
GET /v1/packages[?namespace=] Packages, with their latest version
GET /v1/packages/{ns}/{name} Versions, tags, and whether it's public
GET /v1/packages/{ns}/{name}/{version|latest|tag} A version's metadata: digest, exports, manifest, dependencies, source
GET /v1/packages/{ns}/{name}/{version|latest|tag}/wit The WIT it exports for other packages
GET /v1/blobs/sha256:{hex} Module bytes
PUT /v1/packages/{ns}/{name}/{version}[?deps=ns/name@version,…] Publish an application/wasm body. 409 if the version exists, 422 if it doesn't validate
PUT /v1/packages/{ns}/{name}/tags/{tag} Body {"version": "<version|latest|tag>"}. DELETE removes the tag
PUT /v1/packages/{ns}/{name}/{version}/source Body {toolchain, files}. Once per version. GET reads it
PATCH /v1/settings/{ns}/{name} Change settings: public, importable, allowed_fetch_origins, env ({NAME: value | null})
GET /v1/imports/{ns}/{name} What the package gives each package it imports
PATCH /v1/imports/{ns}/{name}/{provider_ns}/{provider_name} Body {allowed_fetch_origins?, env?}
GET /v1/me {user_id, username, namespaces}
GET /v1/tokens, DELETE /v1/tokens/{id} List and revoke your tokens

A private package answers 404 to anyone outside its namespace, exactly as if it didn't exist.