---
title: "block.setId: Set a block id — Note kit command — Kition"
description: "Gives a block a block id (`^id`) so links and `block.*` commands can reach it: the block ending on `line`, or the one already carrying `blockId` (renaming its id)."
canonical: "https://developer.kition.ai/docs/kits/note/commands/block.setId"
---

> Canonical HTML: [https://developer.kition.ai/docs/kits/note/commands/block.setId](https://developer.kition.ai/docs/kits/note/commands/block.setId)

# block.setId

**Set a block id.** Gives a block a block id (`^id`) so links and `block.*` commands can reach it: the block ending on `line`, or the one already carrying `blockId` (renaming its id).

- Kit: Note 0.3.0 (Markdown (.md)); reference: [Note kit commands](https://developer.kition.ai/docs/kits/note.md)
- Changes the document: yes

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `blockId` | `string` | no | The block's current id, instead of line. |
| `id` | `string` | yes | The new id: letters, digits and hyphens, without the caret. |
| `line` | `integer` | no | The block's last line, from 1. |
| `occurrence` | `integer` | no | Which of the blocks with that id, from 1. |

## Call through note_run

```text
note_run {
  "path": "<file>.md",
  "steps": [{ "command": "block.setId", "params": { "id": <string> } }]
}
```

The required parameters, with placeholders for their types: not a tested example. Optional: `blockId`, `line`, `occurrence`. note_run answers the step’s result in `completed[i].result`.

## Result

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `changed` | `boolean` | yes | Whether the note's text changed (false when it already read so). |

```json
{
  "additionalProperties": false,
  "properties": {
    "changed": {
      "description": "Whether the note's text changed (false when it already read so).",
      "type": "boolean"
    }
  },
  "required": [
    "changed"
  ],
  "type": "object"
}
```

## Parameter schema

```json
{
  "additionalProperties": false,
  "properties": {
    "blockId": {
      "description": "The block's current id, instead of line.",
      "type": "string"
    },
    "id": {
      "description": "The new id: letters, digits and hyphens, without the caret.",
      "type": "string"
    },
    "line": {
      "description": "The block's last line, from 1.",
      "type": "integer"
    },
    "occurrence": {
      "description": "Which of the blocks with that id, from 1.",
      "type": "integer"
    }
  },
  "required": [
    "id"
  ],
  "type": "object"
}
```

Generated from kition-sdk packages/script/kits/note.ts and the kit itself (kition-note@69e14d9).
