# 3642 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 their DID in dry-run mode
* Requires POLICIES\_POLICY\_UPDATE permission

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 — 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 instead
* 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

<br>


---

# Agent Instructions: 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/guardian-3.6-features-and-enhancements/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.
