API Reference

The API is live at api.otherfunc.com.

Endpoints

GET  /                              # Health check (no auth)
GET  /api/languages                 # List supported languages (no auth)
POST /api/run                       # Execute ad-hoc code (API key required)

POST   /api/functions               # Create a saved function
GET    /api/functions               # List your functions
GET    /api/functions/:id           # Get function details
PUT    /api/functions/:id           # Update a function
DELETE /api/functions/:id           # Delete a function
POST   /api/run/:id                 # Execute a saved function
POST   /api/functions/:id/rollback  # Rollback to a prior version
GET    /api/usage                    # Check rate limit usage (API key required)

PUT    /api/functions/:id/secrets/:name  # Set a secret (API key required)
DELETE /api/functions/:id/secrets/:name  # Delete a secret (API key required)
GET    /api/functions/:id/secrets        # List secret names only (API key required)

GET  /fn/:slug                      # Public endpoint (no auth)

Execute Code

# Run Forth code
curl -X POST https://api.otherfunc.com/api/run \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"language":"forth","code":"3 4 + .","input":""}'

# Response:
# {"output":"7 ","stats":{"instructions_executed":2,"execution_time_ms":0.0}}
# Run Brainfuck (Hello World)
curl -X POST https://api.otherfunc.com/api/run \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"language":"brainfuck","code":"++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.","input":""}'
# Run APL
curl -X POST https://api.otherfunc.com/api/run \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"language":"apl","code":"+/iota 100","input":""}'
# Run Lisp
curl -X POST https://api.otherfunc.com/api/run \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"language":"lisp","code":"(define (fact n) (if (<= n 1) 1 (* n (fact (- n 1))))) (fact 10)","input":""}'
# Run BASIC
curl -X POST https://api.otherfunc.com/api/run \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"language":"basic","code":"10 FOR I = 1 TO 5\n20 PRINT I * I\n30 NEXT I","input":""}'

Saved Functions

# Create a function
curl -X POST https://api.otherfunc.com/api/functions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"slug":"add-numbers","language":"forth","name":"Add Numbers","description":"Adds 3 and 4","code":"3 4 + .","is_published":true}'

# Invoke it publicly (no auth needed)
curl https://api.otherfunc.com/fn/add-numbers

Secrets

Per-function write-only environment variables for storing API keys, tokens, and other sensitive values. Secret values are never returned by the API; only names are listed. Secrets are automatically loaded when a saved function is executed.

Constraints: Name must be 1–64 characters (alphanumeric and underscore only). Value is capped at 4 KB.

# Set a secret
curl -X PUT https://api.otherfunc.com/api/functions/FUNC_ID/secrets/MY_KEY \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"value":"secret-value-here"}'

# List secret names (values are never returned)
curl https://api.otherfunc.com/api/functions/FUNC_ID/secrets \
  -H "Authorization: Bearer YOUR_API_KEY"

# Response:
# {"secrets":["MY_KEY","OTHER_KEY"]}

# Delete a secret
curl -X DELETE https://api.otherfunc.com/api/functions/FUNC_ID/secrets/MY_KEY \
  -H "Authorization: Bearer YOUR_API_KEY"

Accessing secrets from code

Forth: s" MY_KEY" env — pushes the secret value as a string.
Lisp: (env "MY_KEY") — returns the secret value as a string.
BASIC: ENV$("MY_KEY") — returns the secret value as a string.

KV Storage

Per-function persistent key-value storage. Only available for saved functions (not ad-hoc /api/run). Data is scoped per function — each function has its own isolated namespace.

Constraints: Keys must be 1–256 printable ASCII characters (no colons). Values are capped at 64 KB. Only available for saved functions.

LanguageGetSetDelete
Forth s" key" kv-get( -- addr len ) s" key" s" val" kv-set( -- ) s" key" kv-del( -- )
Lisp (kv-get "key") (kv-set "key" "value") (kv-del "key")
BASIC KVGET$("key") KVSET("key", "value") KVDEL("key")

Check Usage

Check how many requests you've used today against your rate limit. This endpoint does not count against your limit.

# Check current usage
curl https://api.otherfunc.com/api/usage \
  -H "Authorization: Bearer YOUR_API_KEY"

# Response:
# {"requests_used":42,"daily_limit":1000,"requests_remaining":958,"resets_at_ms":1739145600000}

Error Handling

Errors return {"error":"..."} with appropriate HTTP status codes. User code errors (syntax, runtime, instruction limit) return 422 with an Execution error: prefix. Platform errors (bad request, unauthorized) return 400 or 401.