---
title: "file.inspect: Inspect Document — Photo kit command — Kition"
description: "Answers the active document (or `document`): size, mode, the layer tree with ids, kinds, names and properties, channels, paths, selection and history. Start here."
canonical: "https://developer.kition.ai/docs/kits/photo/commands/file.inspect"
---

> Canonical HTML: [https://developer.kition.ai/docs/kits/photo/commands/file.inspect](https://developer.kition.ai/docs/kits/photo/commands/file.inspect)

# file.inspect

**Inspect Document.** Answers the active document (or `document`): size, mode, the layer tree with ids, kinds, names and properties, channels, paths, selection and history. Start here.

- Kit: Photo 0.1.0 (PSD, PSB, or .kphoto); reference: [Photo kit commands](https://developer.kition.ai/docs/kits/photo.md)
- Changes the document: no

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `coalesce` | `string` | no | Merges consecutive edits with the same key into one undo step, as a slider drag or a typing session is one. |
| `document` | `integer` | no | a position counted from 0 (the first is 0) |
| `region` | `object` | no | Where the command acts, for this call only: {"rect": [x, y, width, height]}, {"ellipse": [x, y, width, height]}, {"polygon": [[x, y], …]} (3 points or more), {"layer": id} (that layer's pixels, by their opacity), {"channel": name or index} (a saved selection or alpha channel), or "all"; add "invert": true to take everything else. Without it, inside the current selection (made with select.* earlier in the run), or everywhere when there is none. |

## Call through photo_run

```text
photo_run {
  "path": "<file>.psd",
  "steps": [{ "command": "file.inspect" }]
}
```

The required parameters, with placeholders for their types: not a tested example. Optional: `coalesce`, `document`, `region`. photo_run answers the step’s result in `completed[i].result`.

## Result

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `activeLayer` | `integer` | no |  |
| `canRedo` | `boolean` | no |  |
| `canUndo` | `boolean` | no |  |
| `channels` | `object` | no |  |
| `depth` | `integer` | no |  |
| `effectsCollapsed` | `any[]` | no |  |
| `hasSelection` | `boolean` | no |  |
| `height` | `integer` | no |  |
| `history` | `string[]` | no |  |
| `historyIndex` | `integer` | no |  |
| `historyRedo` | `any[]` | no |  |
| `isolatedLayers` | `any[]` | no |  |
| `lastAppliedComp` | `any` | no |  |
| `layerComps` | `any[]` | no |  |
| `layerMaskView` | `any` | no |  |
| `layers` | `object[]` | no |  |
| `measurement` | `object` | no |  |
| `mode` | `string` | no |  |
| `name` | `string` | no |  |
| `notes` | `any[]` | no |  |
| `quickMask` | `boolean` | no |  |
| `resolution` | `number` | no |  |
| `revision` | `integer` | no |  |
| `selectedLayers` | `integer[]` | no |  |
| `selectionBounds` | `any` | no |  |
| `symmetry` | `any` | no |  |
| `timeline` | `any` | no |  |
| `variables` | `any` | no |  |
| `width` | `integer` | no |  |

```json
{
  "additionalProperties": true,
  "properties": {
    "activeLayer": {
      "type": "integer"
    },
    "canRedo": {
      "type": "boolean"
    },
    "canUndo": {
      "type": "boolean"
    },
    "channels": {
      "additionalProperties": true,
      "properties": {
        "alpha": {
          "type": "array"
        },
        "colors": {
          "items": {},
          "type": "array"
        },
        "composite": {
          "type": "string"
        },
        "compositeVisible": {
          "type": "boolean"
        },
        "layerMaskView": {},
        "quickMask": {},
        "target": {
          "additionalProperties": true,
          "properties": {
            "kind": {
              "type": "string"
            }
          },
          "type": "object"
        }
      },
      "type": "object"
    },
    "depth": {
      "type": "integer"
    },
    "effectsCollapsed": {
      "type": "array"
    },
    "hasSelection": {
      "type": "boolean"
    },
    "height": {
      "type": "integer"
    },
    "history": {
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "historyIndex": {
      "type": "integer"
    },
    "historyRedo": {
      "type": "array"
    },
    "isolatedLayers": {
      "type": "array"
    },
    "lastAppliedComp": {},
    "layerComps": {
      "type": "array"
    },
    "layerMaskView": {},
    "layers": {
      "items": {
        "additionalProperties": true,
        "properties": {
          "blend": {
            "type": "string"
          },
          "bounds": {},
          "clipped": {
            "type": "boolean"
          },
          "fill": {
            "type": "number"
          },
          "hasMask": {
            "type": "boolean"
          },
          "id": {
            "type": "integer"
          },
          "kind": {
            "type": "string"
          },
          "labelColor": {
            "type": "string"
          },
          "linkGroup": {},
          "locks": {},
          "maskEnabled": {},
          "maskLinked": {},
          "name": {
            "type": "string"
          },
          "opacity": {
            "type": "number"
          },
          "selected": {
            "type": "boolean"
          },
          "visible": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "type": "array"
    },
    "measurement": {
      "additionalProperties": true,
      "properties": {
        "count": {
          "type": "integer"
        },
        "countGroups": {
          "type": "integer"
        },
        "ruler": {},
        "scale": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "mode": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "notes": {
      "type": "array"
    },
    "quickMask": {
      "type": "boolean"
    },
    "resolution": {
      "type": "number"
    },
    "revision": {
      "type": "integer"
    },
    "selectedLayers": {
      "items": {
        "type": "integer"
      },
      "type": "array"
    },
    "selectionBounds": {},
    "symmetry": {},
    "timeline": {},
    "variables": {},
    "width": {
      "type": "integer"
    }
  },
  "type": "object"
}
```

## Parameter schema

```json
{
  "additionalProperties": false,
  "properties": {
    "coalesce": {
      "description": "Merges consecutive edits with the same key into one undo step, as a slider drag or a typing session is one.",
      "type": "string"
    },
    "document": {
      "description": "a position counted from 0 (the first is 0)",
      "type": "integer"
    },
    "region": {
      "description": "Where the command acts, for this call only: {\"rect\": [x, y, width, height]}, {\"ellipse\": [x, y, width, height]}, {\"polygon\": [[x, y], …]} (3 points or more), {\"layer\": id} (that layer's pixels, by their opacity), {\"channel\": name or index} (a saved selection or alpha channel), or \"all\"; add \"invert\": true to take everything else. Without it, inside the current selection (made with select.* earlier in the run), or everywhere when there is none.",
      "properties": {
        "channel": {
          "x-khp-name": "name",
          "x-khp-role": "object",
          "x-khp-types": [
            "Channel"
          ]
        }
      }
    }
  },
  "type": "object"
}
```

Generated from the command list of @kition/photo-darwin-arm64@0.1.0 and the kit itself (photo_commands through @kition/cli@0.1.1, built from KitionAI/kition-photo@abe3f30).
