Random Variables
Random variables allow you to generate dynamic data in your request body at runtime. Use the format {{random.type}} and each request will have unique values.
Quick Example
Request Body (Template):
{
"id": "{{random.uuid}}",
"name": "{{random.name}}",
"age": {{random.number(18,65)}}
}Actual Request (Sent):
{
"id": "a3d5f7b9-1234-5678-9abc",
"name": "Sarah Williams",
"age": 34
}Important: String types need quotes in JSON, number/boolean types don't.
"email": "{{random.email}}" - Correct
"age": {{random.number}} - Correct (no quotes)
Available Types
| Type | Usage | Example | Limit |
|---|---|---|---|
| string | {{random.string}} / {{random.string(20)}} | aBcDeFgHiJ | 10 (max 50) |
| alphanumeric | {{random.alphanumeric}} | aB3dE9fG2h | 10 (max 50) |
| hex | {{random.hex}} / {{random.hex(32)}} | a3f2b1c9e8d7 | 16 (max 64) |
| slug | {{random.slug}} / {{random.slug(5)}} | lorem-ipsum-dolor | 3 (max 10) |
| number | {{random.number}} / {{random.number(1,100)}} | 7482 | 0-1000 (max 1M) |
| double | {{random.double}} / {{random.double(0.0,10.0)}} | 34.78 | 0-100 (max 1M) |
| boolean | {{random.boolean}} | true | true/false |
| timestamp | {{random.timestamp}} | 1704067200000 | Unix ms |
| uuid | {{random.uuid}} | 550e8400-e29b-41d4... | UUID v4 |
| {{random.email}} | abc123@xyz789.com | Random domain | |
| name | {{random.name}} | John Smith | First + Last |
| firstName | {{random.firstName}} | Sarah | 40 names |
| lastName | {{random.lastName}} | Williams | 40 surnames |
| phone | {{random.phone}} | +905321234567 | Multi-country |
| date | {{random.date}} | 2024-11-03 | ISO format |
| datetime | {{random.datetime}} | 2024-11-03T14:30:00Z | ISO 8601 |
| time | {{random.time}} | 14:30:00 | HH:mm:ss |
| url | {{random.url}} | https://abc123.com/xyz | HTTPS |
| website | {{random.website}} | abc123.com | Domain only |
| ip | {{random.ip}} | 192.168.1.147 | Private range |
| ipv6 | {{random.ipv6}} | 2001:0db8:85a3:... | Full IPv6 |
| city | {{random.city}} | Tokyo | 64 cities |
| country | {{random.country}} | Germany | 51 countries |
| enum | {{random.enum(a,b,c)}} | b | From list |
| custom | {{random.custom([A-Z]{3}\d{4})}} | ABC1234 | Regex |
Parameterized Types
Some types accept parameters for customization:
Length Parameters
{{random.string(30)}} - 30 character string
{{random.alphanumeric(20)}} - 20 alphanumeric chars
{{random.hex(32)}} - 32 hex characters
{{random.slug(5)}} - 5 word slug
Range Parameters
{{random.number(1,100)}} - Integer between 1-100
{{random.double(0.0,10.0)}} - Decimal between 0-10
Enum Values
{{random.enum(active,pending,completed)}}
{{random.enum(low,medium,high,critical)}}
Custom Regex Patterns
{{random.custom([A-Z]{3}-[0-9]{4})}} - ABC-1234
{{random.custom([0-9]{2}[A-Z]{3}[0-9]{2})}} - 34ABC56
{{random.custom(\d{3}-\d{2}-\d{4})}} - 123-45-6789
Full Example
A comprehensive example covering all random variable types:
{
"strings": {
"string": "{{random.string}}",
"alphanumeric": "{{random.alphanumeric(15)}}",
"hex": "{{random.hex(32)}}",
"slug": "{{random.slug(4)}}"
},
"numbers": {
"number": {{random.number(1,100)}},
"double": {{random.double(0.5,99.9)}},
"boolean": {{random.boolean}},
"timestamp": {{random.timestamp}}
},
"identity": {
"uuid": "{{random.uuid}}",
"email": "{{random.email}}",
"name": "{{random.name}}",
"firstName": "{{random.firstName}}",
"lastName": "{{random.lastName}}",
"phone": "{{random.phone}}"
},
"dateTime": {
"date": "{{random.date}}",
"datetime": "{{random.datetime}}",
"time": "{{random.time}}"
},
"network": {
"url": "{{random.url}}",
"website": "{{random.website}}",
"ip": "{{random.ip}}",
"ipv6": "{{random.ipv6}}"
},
"location": {
"city": "{{random.city}}",
"country": "{{random.country}}"
},
"special": {
"status": "{{random.enum(draft,published,archived)}}",
"plate": "{{random.custom([0-9]{2}[A-Z]{3}[0-9]{2})}}"
}
}Tips & Best Practices
1.
Random values are generated at request time - each Send produces new values
2.
Works with JSON, XML, and Text body types
3.
Use enum for status fields: {{random.enum(active,inactive)}}
4.
Use custom for special formats like license plates, tracking numbers
5.
Combine with environment variables: {{baseUrl}}/users/{{random.uuid}}
Remember: In JSON, string types need quotes. Number/boolean types don't.