> ## Documentation Index
> Fetch the complete documentation index at: https://docs.supernote.com/llms.txt
> Use this file to discover all available pages before exploring further.

# getPathEncryptionStatus

> Get the encryption status of a file or directory.

```ts wrap theme={null}
static getPathEncryptionStatus(filePath: string): Promise<APIResponse<number>>;
```

**Parameters**

| Parameter  | Type     | Description            |
| ---------- | -------- | ---------------------- |
| `filePath` | `string` | File or directory path |

**Returns**

* [`APIResponse<number>`](/en/api-reference/supernote-plugin/types/api-response), where `result` is one of:
  * `0`: not encrypted
  * `1`: encrypted and locked (not unlocked in the current plugin session)
  * `2`: encrypted and unlocked in the current plugin session

## Example

```ts wrap theme={null}
import { PluginFileAPI } from 'sn-plugin-lib';

/**
 * Example: get the encryption status of a file or directory.
 */
export async function exampleGetPathEncryptionStatus() {
  const filePath = '/storage/emulated/0/Note/demo.note';

  const res = await PluginFileAPI.getPathEncryptionStatus(filePath);
  if (!res.success) {
    throw new Error(res.error?.message ?? 'getPathEncryptionStatus call failed');
  }

  return res.result;
}
```
