(Dec. 9th 2024) Flawless Beta 3 is here. Try it out!
  Flawless Logo, a beautiful woman with freckles head illustration. flawless.dev docs replay discord

HTTP API

Once you run flawless up, it will start a local HTTP server listening by default on port 27288. You can use this server to start new workflows or query running and finished ones.


GET /version

Returns the version of the flawless server.


POST /api/module/deploy

Deploys a pre-compiled module as a .wasm file to the server.

Expects the module as a multipart field named "module".

Example:

$ curl -F module=@target/wasm32-unknown-unknown/release/example.wasm \
    localhost:27288/api/module/deploy

> {"ok":{"name":"example","version":"0.0.1"}}

POST /api/workflow/start

Starts a new workflow.

Expects a JSON structure with the following fields:

Example:

$ curl --header "Content-Type: application/json" \ 
    --request POST \
    --data '{"module":"test", "version":"0.1.1", "workflow":"test","input": "\"flawless\""}' \
    http://localhost:27288/api/workflow/start

> {"ok":{"id":"wkf_xhRDf","response":null}}

POST /api/workflow/send-msg/<workflow_id>

Sends message to workflow.

Expects a JSON structure with the following fields:

Example:

$ curl --header "Content-Type: application/json" \
    --request POST \
    --data '{"type":"greeting_msg", "data":"{\"greeting\":\"hello\",\"name\":\"flawless\"}"}' \
    http://localhost:27288/api/workflow/send-msg/wkf_yiSEf

> "ok"

The workflow reading this message can be found on the fundamentals page.