package main
import ( "fmt" "strings" "net/http" "io")
func main() {
url := "https://api.elefork.com/v1/tasks/example/episodes"
payload := strings.NewReader("{ \"count\": 1, \"size\": \"nano\", \"ttl_seconds\": 1 }")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>") req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close() body, _ := io.ReadAll(res.Body)
fmt.Println(res) fmt.Println(string(body))
}const url = 'https://api.elefork.com/v1/tasks/example/episodes';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"count":1,"size":"nano","ttl_seconds":1}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.elefork.com/v1/tasks/example/episodes \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "count": 1, "size": "nano", "ttl_seconds": 1 }'Creates count branches from the task’s template, one episode each. Wait for each branch’s operation, then issue credentials for it.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Header Parameters
Section titled “Header Parameters”Request Body
Section titled “Request Body”object
Branch TTL (at most 10 years); omitted = default (L0: 24 h)
Responses
Section titled “Responses”Branches are being created
object
object
object
Tampered: the environment was changed in a way that can fake a result (no score). review: scored, but something needs a human look (e.g. episode WAL unavailable).
Scorer report (empty until scored).
object
False for superuser tasks; some cheats cannot be detected generically
object
Added, removed, changed, transient (modified and restored; seen only in WAL), …
object
object
object
Episode record of table changes relative to the start state.
object
object
L0: reset to the last checkpoint after a crash. L1: async WAL replication. L2: no confirmed commit lost if any single host is lost (L1/L2 return 501 until available).
idle: paused automatically after the idle timeout without connections (woken on the next
connection). never: never paused automatically; POST /v1/branches/{id}/pause still works.
object
object
object
The API request that started the operation (X-Request-Id).
Example
{ "episodes": [ { "episode": { "state": "running", "integrity": "clean", "result": { "findings": [ { "severity": "high" } ], "wal_scan": { "status": "ok" }, "data_changes": [ { "change": "added" } ] } }, "branch": { "durability": "L0", "pause_policy": "idle", "size": "nano", "state": "creating", "source_kind": "template" }, "operation": { "kind": "create", "state": "pending" } } ]}Error
object
object
Example
{ "error": { "code": "not_found" }}Error
object
object
Example
{ "error": { "code": "not_found" }}Error
object
object
Example
{ "error": { "code": "not_found" }}Error
object
object
Example
{ "error": { "code": "not_found" }}Task not ready (task_not_ready), or request_in_progress (Idempotency-Key)
object
object
Example
{ "error": { "code": "not_found" }}idempotency_mismatch: this Idempotency-Key was used with a different request
object
object
Example
{ "error": { "code": "not_found" }}Error
object
object
Example
{ "error": { "code": "not_found" }}Error
object
object
Example
{ "error": { "code": "not_found" }}Temporarily unavailable; retry after the Retry-After seconds. Codes:
database_unavailable (the metadata database is failing over) and
cube_admission (a compute node runs a sandbox shim below the
platform minimum, so creates, forks, checkpoints and resets are
refused until it is upgraded).
object
object
Example
{ "error": { "code": "not_found" }}