v0.7.0

API Reference

Last updated

Request fields and status codes for HakoRun's three HTTP endpoints; for response formats see Responses and SSE.

POST /upload

Stores a function as a new version.

Field Type Required Description
path string Yes Function path; must not contain ..
code string Yes Source code
language string Yes python, javascript, or typescript
Status Body Case
200 {"path", "language", "version"} Stored
400 Invalid request payload Missing field or malformed JSON
400 Invalid path path contains .., or language is unsupported (same message)
500 Failed to save function Storage backend write failed

POST /run/*path

Runs a stored function. The body must be JSON; send {} when there is no input.

Parameter In Type Description
version query int64 Target version; omitted or non-integer means latest
input body string JSON string, exposed as event / input
stream body bool true responds over SSE
Status Case
200 Success (JSON or SSE)
400 Body is not valid JSON or exceeds CODE_MAX_SIZE
404 script not found or assign version not found
500 Non-stream execution failed or timed out (failed to run: ...)

POST /run-now

Runs the code in the request without storing it.

Field Type Required Description
code string Yes Source code; must not be blank
language string Yes python, javascript, or typescript
input string No JSON string input
stream bool No true responds over SSE
Status Case
200 Success (JSON or SSE)
400 Bad body, unsupported language, or code is required
500 Non-stream execution failed or timed out
中文