In this guide

Change a Code

Change a code in place — only what you fill in.

Action referenceChange

What this action does #

First, connect Notion in Services. Then open Actions → + → Notion and choose Change a Code.

To find this direct request action, choose Every Notion endpoint in the integration’s picker. The setup guide also explains the dedicated forms for common tasks.

What a run does

Running or testing this action changes something in your connected service.

More about this action

Edits the block where it is. Only the fields filled in are sent, and Notion leaves everything else alone. Text is replaced whole: the new text is all the block says.

Inputs to fill in #

Open an input to choose its value. Keep a fixed value with Text, receive it from Shortcuts, ask when the action runs, or use an Earlier Step. Read how input sources work.

Block

RequiredText

The block's own ID, not the page's — a Read a Document step lists them.

Example value (replace with your own):
18f2b39-2664-80c1-b8e2-000000000000

Code

OptionalText

Sent exactly as typed. Replaces all of its text; leave empty to keep it.

Example value (replace with your own):
print("hello")

Language

OptionalChoice

How Notion colours the code. Leave empty to keep what it has.

Choices: plain text, abap, arduino, bash, basic, c, clojure, coffeescript, c++, c#, css, dart, diff, docker, elixir, elm, erlang, flow, fortran, f#, gherkin, glsl, go, graphql, groovy, haskell, html, java, javascript, json, julia, kotlin, latex, less, lisp, livescript, lua, makefile, markdown, markup, matlab, mermaid, nix, objective-c, ocaml, pascal, perl, php, powershell, prolog, protobuf, python, r, reason, ruby, rust, sass, scala, scheme, scss, shell, sql, swift, typescript, vb.net, verilog, vhdl, visual basic, webassembly, xml, yaml, java/c/c++/c#

Caption

OptionalFormatted text

Markdown works: **bold**, *italic*, ~~struck~~, `code`, [a link](https://…), $E=mc^2$, <span color="red">colour</span>, <span underline="true">underline</span>, <mention-page url="…"/>, <mention-user url="user://…"/>, <mention-date start="tomorrow"/>. Put a \ before a character to keep it as it is. Leave empty to keep what it has.

What comes back #

In the action editor, open Output → Returned Value to choose fields for your shortcut. These are the response fields described by the app; a service may omit an optional field or return an empty list. JSON File contains the full response.

Returned fieldTypeMeaning
idstringText value.
last_edited_timestringText value.
codeobjectA group of named values.

Run it from Shortcuts #

  1. Give the action a recognizable name and tap Save.
  2. In Apple Shortcuts, add Shortcutify’s Execute Action and select the saved action.
  3. Supply any Param or File slots you bound in the inputs, then run the shortcut.

If the result is unexpected, open Logs in Shortcutify, select the run, and inspect this step’s inputs and response.

Advanced reference #

Request, permissions, and identifiers

Request: PATCH https://api.notion.com/v1/blocks/{block_id}

Action identifier: notion.blocks.change.code.v1

No additional per-action permissions are declared in the app’s catalog. The integration’s connection and account access rules still apply.

InputRequest keyLocation
Blockblock_idpath
Codecode.rich_text[0].text.contentbody
Languagecode.languagebody
Captioncode.captionbody

Notion API reference