Quick start

  1. Open /tokens, sign in with the configured admin account, and create a token with function:run.
  2. Call POST /api/v1/run with header Authorization: Bearer <token>.
  3. Put the function id in function and the function parameters in input.
{
  "function": "regex.replace",
  "input": {
    "input": "Order 123 ships on 2026-06-22",
    "pattern": "\\d+",
    "flags": "g",
    "replacement": "#"
  }
}

Authentication

Runtime calls

Function execution requires an HTTP header named Authorization with value Bearer <token>. The token needs the function:run scope.

Browser admin session

The /tokens page uses the login session cookie. Configure ADMIN_USERNAME, ADMIN_PASSWORD, and SESSION_SECRET before browser login is available.

Bootstrap admin key

Initial admin automation can use header x-bootstrap-admin-key with the value from BOOTSTRAP_ADMIN_KEY. Use it only to create the first scoped admin token or recover access.

Admin bearer scopes

admin:tokens manages tokens. admin:functions manages function state. Function runners should use only function:run.

Endpoint reference

Public and discovery

MethodPathAuthUse
GET/api/healthNo authService readiness check.
GET/api/v1/functionsNo authList callable functions and their input schemas.

Function execution

MethodPathAuthUse
POST/api/v1/runBearer function:runGeneric runner. Body includes function and input.
POST/api/v1/regex/matchBearer function:runConvenience endpoint for regex.match.
POST/api/v1/regex/replaceBearer function:runConvenience endpoint for regex.replace.
POST/api/v1/regex/splitBearer function:runConvenience endpoint for regex.split.
POST/api/v1/regex/validateBearer function:runConvenience endpoint for regex.validate.
POST/api/v1/regex/extractBearer function:runConvenience endpoint for regex.extract.
POST/api/v1/regex/replace-manyBearer function:runConvenience endpoint for regex.replaceMany.

Browser admin session

MethodPathAuthUse
POST/api/v1/auth/loginAdmin username/passwordCreates the browser session cookie used by /tokens.
POST/api/v1/auth/logoutSession cookieClears the browser session cookie.
GET/api/v1/auth/meSession cookieReports whether the browser session is authenticated.

Admin APIs

MethodPathAuthUse
GET/api/v1/admin/tokensSession, bootstrap, or admin:tokensList token metadata. Token hashes are never returned.
POST/api/v1/admin/tokensSession, bootstrap, or admin:tokensCreate a token. Plaintext token is returned once.
DELETE/api/v1/admin/tokens/:idSession, bootstrap, or admin:tokensDelete a token by id.
GET/api/v1/admin/functionsSession, bootstrap, or admin:functionsList functions through the admin authorization path.
PATCH/api/v1/admin/functions/:idSession, bootstrap, or admin:functionsEnable or disable a function with an enabled boolean.

Generic function runner

POST /api/v1/run is the stable contract for all callable functions. Use it when the caller can send a nested JSON object.

Request body

{
  "function": "regex.replace",
  "input": {
    "input": "Order 123 ships on 2026-06-22",
    "pattern": "\\d+",
    "flags": "g",
    "replacement": "#"
  }
}

Success response

{
  "ok": true,
  "data": {
    "result": "Order # ships on #-#-#",
    "count": 4
  },
  "meta": {
    "function": "regex.replace"
  }
}

The function field must be a registered id such asregex.replace. The input object is passed directly to that function and must match its schema.

Regex functions

Regex functions use Rust regex syntax by default. pattern is required for all regex functions, flags is optional, and input is the text to inspect. Set engine to js only when a request needs JavaScript-specific syntax such as lookaround or backreferences. Requests are bounded to keep deployed Workers responsive: input is limited to 100,000 characters, pattern to 1,000 characters, flags to supported engine flags, and global result sets to 1,000 matches.

regex

regex.match

Check whether text matches a regular expression and return matches.

Input schema

{
  "type": "object",
  "required": [
    "input",
    "pattern"
  ],
  "properties": {
    "input": {
      "type": "string"
    },
    "pattern": {
      "type": "string"
    },
    "flags": {
      "type": "string"
    },
    "engine": {
      "type": "string",
      "enum": [
        "rust",
        "js"
      ]
    }
  }
}
regex

regex.replace

Replace regular expression matches in text.

Input schema

{
  "type": "object",
  "required": [
    "input",
    "pattern",
    "replacement"
  ],
  "properties": {
    "input": {
      "type": "string"
    },
    "pattern": {
      "type": "string"
    },
    "flags": {
      "type": "string"
    },
    "engine": {
      "type": "string",
      "enum": [
        "rust",
        "js"
      ]
    },
    "replacement": {
      "type": "string"
    }
  }
}
regex

regex.split

Split text with a regular expression separator.

Input schema

{
  "type": "object",
  "required": [
    "input",
    "pattern"
  ],
  "properties": {
    "input": {
      "type": "string"
    },
    "pattern": {
      "type": "string"
    },
    "flags": {
      "type": "string"
    },
    "engine": {
      "type": "string",
      "enum": [
        "rust",
        "js"
      ]
    }
  }
}
regex

regex.validate

Check whether the entire input matches a regular expression.

Input schema

{
  "type": "object",
  "required": [
    "input",
    "pattern"
  ],
  "properties": {
    "input": {
      "type": "string"
    },
    "pattern": {
      "type": "string"
    },
    "flags": {
      "type": "string"
    },
    "engine": {
      "type": "string",
      "enum": [
        "rust",
        "js"
      ]
    }
  }
}
regex

regex.extract

Extract numbered and named captures from text.

Input schema

{
  "type": "object",
  "required": [
    "input",
    "pattern"
  ],
  "properties": {
    "input": {
      "type": "string"
    },
    "pattern": {
      "type": "string"
    },
    "flags": {
      "type": "string"
    },
    "engine": {
      "type": "string",
      "enum": [
        "rust",
        "js"
      ]
    }
  }
}
regex

regex.replaceMany

Apply multiple regular expression replacement rules in order.

Input schema

{
  "type": "object",
  "required": [
    "input",
    "rules"
  ],
  "properties": {
    "input": {
      "type": "string"
    },
    "engine": {
      "type": "string",
      "enum": [
        "rust",
        "js"
      ]
    },
    "rules": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "pattern",
          "replacement"
        ],
        "properties": {
          "pattern": {
            "type": "string"
          },
          "flags": {
            "type": "string"
          },
          "replacement": {
            "type": "string"
          },
          "engine": {
            "type": "string",
            "enum": [
              "rust",
              "js"
            ]
          }
        }
      }
    }
  }
}

regex.match

Returns matched and a matches array. Without g, only the first match is returned. Withg, all matches are returned.

regex.replace

Requires replacement. Returns result and count. Without g, replacement changes only the first match.

replacement is the text written back for each match. Use a literal value like X, an empty string to delete matches, or JavaScript replacement tokens:$1 for the first capture group, $& for the full match, $<name> for a named group, and $$ for a literal dollar sign.

regex.split

Returns parts and count after splitting input by a regex separator. Use it for comma-or-semicolon lists, whitespace-delimited values, and line-based field cleanup.

regex.validate

Returns valid after checking whether the entire input matches the pattern. This is stricter thanregex.match, which can succeed on a substring.

regex.extract

Returns captures. Each item includes match, positional groups, and namedGroups for patterns like (?<id>\d+).

regex.replaceMany

Applies ordered replacement rules and returns the finalresult, total count, and per-rule counts. Use it to combine several Power Automate cleanup steps into one HTTP action.

Convenience endpoints

POST /api/v1/regex/match, POST /api/v1/regex/replace, and POST /api/v1/regex/split, POST /api/v1/regex/validate, POST /api/v1/regex/extract, and POST /api/v1/regex/replace-many accept the function input directly. They are useful for tools that prefer a flat body instead of the generic runner wrapper.

{
  "input": "abc123",
  "pattern": "\\d+",
  "replacement": "X",
  "engine": "rust"
}

Token admin

Tokens are created by POST /api/v1/admin/tokens. The response returns the plaintext token, and newly created token records keep that plaintext value visible in later token lists. Token hashes stay hidden from API responses.

Create body

{
  "name": "Power Automate Flow",
  "scopes": [
    "function:run"
  ]
}

Scope selection

  • function:run for Power Automate and runtime API callers.
  • admin:tokens for token automation.
  • admin:functions for function state management.

Power Automate setup

  1. Add an HTTP action.
  2. Set Method to POST.
  3. Set URI to {baseUrl}/api/v1/run or one of the regex convenience endpoints.
  4. Add header Content-Type with value application/json.
  5. Add header Authorization with value Bearer <token>.
  6. Paste the JSON request body and map dynamic values.

If a Flow receives UNAUTHORIZED, check for the exactBearer prefix, extra spaces, copied placeholder brackets, disabled tokens, or missing function:run.

Response envelope and errors

Success responses use { ok: true, data, meta? }. Failures use { ok: false, error, status }.

{
  "ok": false,
  "error": {
    "code": "INVALID_REGEX",
    "message": "Invalid regular expression"
  },
  "status": 400
}
CodeMeaning
INVALID_JSONRequest body is missing, not an object, or invalid JSON.
INVALID_INPUTA required field is missing or has the wrong type.
INVALID_REGEXThe selected regex engine cannot compile the pattern.
UNAUTHORIZEDBearer token is missing, invalid, disabled, or expired.
FORBIDDENToken is valid but lacks the required scope.
FUNCTION_NOT_FOUNDThe requested function id is not registered.
FUNCTION_DISABLEDThe function exists but is disabled.
TOKEN_NOT_FOUNDThe admin token delete target does not exist.
AUTH_NOT_CONFIGUREDAdmin username, password, or session secret is absent.

FAQ and troubleshooting

Which endpoint should I use?

Use /api/v1/run for a consistent long-term contract. Use regex convenience endpoints when the caller benefits from a flatter body.

Why did replace change only one match?

Add g to flags. Regex replacement changes only the first match without the global flag.

How do I use lookaround?

Add engine: "js" for JavaScript-only regex syntax. The default Rust engine is safer for untrusted patterns but does not support lookaround or backreferences.

Can I expose admin scopes to a Flow?

Avoid it. Most Flows need only function:run. Keep admin scopes for operational tooling and recovery.

How do I discover available parameters?

Use GET /api/v1/functions or this page. The function list includes the same input schema shown here.

Why is an older token not visible?

Tokens created before visible token storage kept only a hash. Hashes cannot be reversed, so create a replacement token if an older plaintext value is missing.