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

TypeUsageExampleLimit
string{{random.string}} / {{random.string(20)}}aBcDeFgHiJ10 (max 50)
alphanumeric{{random.alphanumeric}}aB3dE9fG2h10 (max 50)
hex{{random.hex}} / {{random.hex(32)}}a3f2b1c9e8d716 (max 64)
slug{{random.slug}} / {{random.slug(5)}}lorem-ipsum-dolor3 (max 10)
number{{random.number}} / {{random.number(1,100)}}74820-1000 (max 1M)
double{{random.double}} / {{random.double(0.0,10.0)}}34.780-100 (max 1M)
boolean{{random.boolean}}truetrue/false
timestamp{{random.timestamp}}1704067200000Unix ms
uuid{{random.uuid}}550e8400-e29b-41d4...UUID v4
email{{random.email}}abc123@xyz789.comRandom domain
name{{random.name}}John SmithFirst + Last
firstName{{random.firstName}}Sarah40 names
lastName{{random.lastName}}Williams40 surnames
phone{{random.phone}}+905321234567Multi-country
date{{random.date}}2024-11-03ISO format
datetime{{random.datetime}}2024-11-03T14:30:00ZISO 8601
time{{random.time}}14:30:00HH:mm:ss
url{{random.url}}https://abc123.com/xyzHTTPS
website{{random.website}}abc123.comDomain only
ip{{random.ip}}192.168.1.147Private range
ipv6{{random.ipv6}}2001:0db8:85a3:...Full IPv6
city{{random.city}}Tokyo64 cities
country{{random.country}}Germany51 countries
enum{{random.enum(a,b,c)}}bFrom list
custom{{random.custom([A-Z]{3}\d{4})}}ABC1234Regex

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.