OmniScript 2.0
HTTP API
The osf toolchain behind a small HTTP API: render a document to any format, lint it, format it or query it, without installing anything. The playground's export buttons use it.
Base URL
https://osf.mycel.me/api. Each request is handled alone and nothing is stored. @include and data sources are off.Render
POST /api/render with a JSON body returns the file. target is one of pdf, docx, pptx, xlsx, html, md, json or typst; theme, pageSize (a4, letter, legal) and landscape are optional.
curl -X POST https://osf.mycel.me/api/render \
-H 'content-type: application/json' \
-d '{"source": "@doc { # Hello }", "target": "pdf", "theme": "corporate"}' \
-o hello.pdfA file can be sent as it is, with the target in the query string:
curl -X POST 'https://osf.mycel.me/api/render?target=docx' \
-H 'content-type: text/plain' --data-binary @report.osf -o report.docxLint, format and query
| Endpoint | Body | Returns |
|---|---|---|
POST /api/lint | { source } | { ok, diagnostics } |
POST /api/format | { source } | Formatted OSF text |
POST /api/query | { source, selector } | { count, blocks } |
GET /api | Endpoints, limits and the osf version | |
GET /api/health | { ok, osf } |
curl -X POST https://osf.mycel.me/api/query \
-H 'content-type: application/json' \
-d '{"source": "@finding { id: \"F-1\"; claim: \"Works\"; confidence: 0.9; }", "selector": "finding[confidence>=0.8]"}'Errors and limits
| Status | Meaning |
|---|---|
| 400 | Missing source, unknown target or theme, or a body that is not a JSON object |
| 413 | More than 512 KB of OSF, or output larger than 25 MB |
| 422 | osf could not render the document; the error says why |
| 429 | More than 30 renders or 120 other requests per minute from one client |
| 503 / 504 | The server is busy, or a run took longer than 20 seconds |
Errors are JSON: { "error": "…" }. For larger documents, batch work or files that include other files, install osf and run it locally.