GoRunner docs
Search or askSearch⌘K

Convert a Code step to 2.0.0

Since v2026.10.35

POST/api/code-steps/upgrade

Converts one Code 1.0.0 step’s code and Inputs for Code 2.0.0, and answers the result. It reads and writes nothing.

Needs an API token with the Read permission for workflows (workflow:read).

Parameters

Body

codeRequired · string

The step’s config.code, as stored. Up to 256 KB.

inputsOptional · object or string or null

The step’s config.inputs: an object, a string holding a JSON object, or null. One expression is refused: switch Inputs to rows first.

Apply the answer

Nothing is saved. Set the step’s pieceVersion to 2.0.0, and its config.code and config.inputs to the answer’s, with Update a workflow’s draft. Then test the step.

A note with level review means the converter left that line for you to rewrite. A step’s output stays {result, logs}, so later steps need no change.

Responses

  • 200OK

    The converted step. unchanged: true: nothing to convert, so upgrading only changes the pin.

  • Unreadable JSON, no code, or Inputs that can’t be converted. details.field names which.

  • The token lacks the Read permission for workflows.

  • The body is over 600 KB, or code is over 256 KB (details.field: code).

Any call can also answer: 401 UNAUTHORIZED · 401 TOKEN_ENDED · 403 TOKEN_SURFACE_OFF · 403 FEATURE_OFF · 403 EMBED_NOT_ALLOWED · 403 EMBED_NOT_AVAILABLE · 403 ACCOUNT_SUSPENDED · 415 INVALID_CONTENT_TYPE · 429 RATE_LIMITED · 503 BUSY · 503 PAUSED · 503 SERVICE_UNAVAILABLE. See Errors.

Request

GORUNNER="https://api.gorunner.io"
GORUNNER_TOKEN="grt_…"  # needs Read for workflows

curl -X POST "$GORUNNER/api/code-steps/upgrade" \
  -H "Authorization: Bearer $GORUNNER_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "code": "const email = \"{{trigger.body.email}}\";\nreturn { domain: email.split(\"@\")[1] };",
    "inputs": {}
  }'

Response · 200 OK, shortened

json
{
  "data": {
    "code": "const email = inputs.email;\nreturn { domain: email.split(\"@\")[1] };",
    "inputs": {
      "email": "{{trigger.body.email}}"
    },
    "pieceVersion": "2.0.0",
    "unchanged": false,
    "changes": [
      {
        "line": 1,
        "before": "\"{{trigger.body.email}}\"",
        "after": "inputs.email",
        "input": "email"
      }
    ],
    "moreChanges": 0,
    "notes": [
      {
        "level": "info",
        "text": "Test the step: its result should match its last run."
      }
    ],
    "moreNotes": 0
  }
}
Every field

Body

codeRequired · string

The step’s config.code, as stored. Required; an empty string is accepted and answers unchanged: true.

inputsOptional · object or string or null

The step’s config.inputs: an object (the usual shape), a string holding a JSON object, or null.

Response · 200 OK

dataobject

A Code step converted for Code 2.0.0 by POST /api/code-steps/upgrade.

codestring

The new config.code.

inputsobject

The new config.inputs: the step’s own rows in their order, then one row per new input, whose value is the original {{ }} text.

pieceVersionstring

The version to pin the step to.

unchangedboolean

True when the code needed no rewrite and holds nothing to review (no review note): upgrading only changes the pin.

changesarray of objects

The rewrites, in code order, at most 500.

lineinteger

1-based line of the code.

beforestring

The text replaced (cut at 400 characters).

afterstring

What replaced it (cut at 400 characters).

inputstring

The Inputs row it reads, when it reads one (several, comma-separated, for a string that held more than one {{ }}).

moreChangesinteger

How many rewrites were made beyond the 500 listed.

notesarray of objects

What the author should know. review means look at that line yourself: the converter left something it could not convert safely. At most 500 notes about the code are listed (moreNotes counts the rest); after them always come the runtime differences no rewrite can see (NaN, BigInt, Map/Set, UTC, console, logs on failure) and "Test the step".

lineinteger

1-based line, when the note is about one.

levelstring

One of info, review.

textstring
moreNotesinteger

How many notes about the code there were beyond the 500 listed.