> For the complete documentation index, see [llms.txt](https://guardian.hedera.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://guardian.hedera.com/docs/develop/guardian/standard-registry/policies/dry-run/3642-dry-run-virtual-users.md).

# Dry Run Virtual Users

### feat/3642-dry-run-virtual-user

#### Get virtual user by DID

`GET /api/v1/policies/:policyId/dry-run/user/:did`

* Returns a single virtual user by DID in Dry Run mode
* Requires `POLICIES_POLICY_UPDATE`

#### Create virtual user v2

`POST /api/v1/policies/:policyId/dry-run/user` with header `Api-Version: 2`

* Creates a virtual user and returns only the created user object:

{ "username": "Virtual User 3", "did": "did:...", "hederaAccountId": "0.0.123", "active": false }

* More efficient than v1 — there is no need to re-fetch the full user list after creation

#### Deprecations

**Create virtual user v1**

`POST /api/v1/policies/:policyId/dry-run/user`

* Deprecated. Scheduled for removal: 2026-07-24 (4 months per API Deprecation Policy)
* v1 creates a virtual user and returns the full list of all virtual users (array)
* Migration: add header `Api-Version: 2` to receive only the created user object
* Frontend has already been migrated to v2

#### Internal Changes

* Added CREATE\_VIRTUAL\_USER\_V2 NATS event in PolicyEngineEvents
* Added GET\_VIRTUAL\_USER NATS event in PolicyEngineEvents
* Added countVirtualUsers() and getVirtualUser(did) methods to DatabaseServer
* Username generation optimized: uses countVirtualUsers() instead of loading all users

## Related Issues

* [https://github.com/hashgraph/guardian/issues/3642](https://github.com/hashgraph/guardian/issues/1987)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://guardian.hedera.com/docs/develop/guardian/standard-registry/policies/dry-run/3642-dry-run-virtual-users.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
