Shape-preserving placeholders
By default a masked value is a constant of the right type: <masked> for a string, 0 for a number, false for a boolean, and null stays null. That is safe, but 0 fails a validator that expects a positive quantity and <masked> fails one that expects a timestamp.
Set STUBSMITH_MASK_SALT in the environment of the process running the SDK, and give the mask rule a semantic type, and the placeholder keeps the format of the real value instead. The vocabulary is email, uuid, iso8601, e164, iban, url, decimal_amount, integer_id, opaque_token and free_text. A masked UUID becomes a parseable version-4 UUID, a masked timestamp becomes a valid ISO 8601 instant, a masked IBAN carries a correct mod-97 checksum, and a masked amount is a non-zero decimal of the same JSON type as the original.
Placeholders are deterministic: the value is derived from a keyed blake2b hash of the real value, so the same input always produces the same placeholder and two fields that held the same production value still match after masking. That keeps joins and referential checks meaningful across a capture. It also means the salt must stay stable: change it and every placeholder changes with it. The salt never leaves your environment; Stubsmith neither receives nor stores it.
The type is a hint, not a mandate. The server infers it from the field's leaf name and has never seen a value, so it can be wrong: a field called charge_id may hold a string or an integer. Before generating, the SDK checks the hint against the value's actual runtime type and falls back to the constant placeholder on a mismatch, so a placeholder never changes the JSON type of a field. currency_code and country_code are always refused for the reason above, and a boolean always becomes false. For those, use keep.