Generating fake data
Kreya can generate fake but realistic data such as names, emails, numbers, UUIDs and dates. This is useful for filling request bodies, generating unique identifiers, or creating data-driven tests. Fake data generation is powered by Bogus and is available both in templating and in scripts.
In templating
Anywhere templating is supported, the faker object is available.
For example:
I am {{ faker.name.full_name }} and my email is {{ faker.internet.email }}
renders something like:
I am Jazlyn Gorczany and my email is [email protected]
Available categories
The faker object exposes the following categories. Methods are written in snake_case
in templating (e.g. faker.name.full_name).
| Category | Examples |
|---|---|
faker.address | city, country, zip_code, full_address |
faker.commerce | product, price, department |
faker.company | company_name, catch_phrase |
faker.database | column, engine, type |
faker.date | past, future, recent, soon, between (see Dates) |
faker.finance | account, amount, currency_code, credit_card_number |
faker.hacker | phrase, verb, noun |
faker.image | picture_url, loremflickr_url |
faker.internet | email, user_name, url, ip, mac |
faker.lorem | word, sentence, paragraph |
faker.music | genre |
faker.name | first_name, last_name, full_name, job_title |
faker.phone | phone_number |
faker.random | guid, uuid, number, int, bool, word |
faker.system | file_name, mime_type, semver |
faker.vehicle | manufacturer, model, vin |
A GUID is a common case. By default a GUID renders with dashes; use Scriban's object.format
to change the representation, for example to a 32-digit form without dashes:
{{ faker.random.guid }}
{{ faker.random.guid | object.format 'N' }}
Dates
faker.date generates random dates relative to now:
| Method | Result |
|---|---|
faker.date.past | A date in the past |
faker.date.recent | A date within the last few days |
faker.date.soon | A date within the next few days |
faker.date.future | A date in the future |
faker.date.between | A date between two explicit dates |
A generated date is a date/time value. To output it in a specific format, pipe it through
Scriban's built-in date.to_string
function, which uses strftime-style placeholders:
Date only: {{ faker.date.past | date.to_string '%Y-%m-%d' }}
ISO 8601 UTC: {{ faker.date.past | date.to_string '%Y-%m-%dT%H:%M:%SZ' }}
To generate a date in a specific time range — for example "sometime in the next 30 days" —
use faker.date.soon with the number of days, or faker.date.between for an explicit range
built with the Scriban date helpers:
# Within the next 30 days:
{{ faker.date.soon 30 | date.to_string '%Y-%m-%d' }}
# Between now and 30 days from now (explicit range):
{{ faker.date.between date.now (date.add_days date.now 30) | date.to_string '%Y-%m-%dT%H:%M:%SZ' }}
faker.date.future similarly accepts the number of years to go forward, and faker.date.past
the number of years to go back.
In scripts Pro / Enterprise
In scripts the same data is available through
kreya.faker.
Here, methods use camelCase and are called as functions:
const name = kreya.faker.name.fullName();
const email = kreya.faker.internet.email();
const id = kreya.faker.random.uuid();
const amount = kreya.faker.finance.amount();
kreya.faker.date.* returns a JavaScript Date, so you can format it with the standard
JavaScript APIs or generate it within a range:
// A date within the next 30 days, formatted as ISO 8601
const soon = kreya.faker.date.soon(30);
kreya.variables.set('due_date', soon.toISOString());
// A date in an explicit range
const start = new Date();
const end = new Date();
end.setDate(end.getDate() + 30);
const inRange = kreya.faker.date.between(start, end);
// Custom format (e.g. yyyy-MM-dd) using Intl
const formatted = new Intl.DateTimeFormat('en-CA').format(inRange); // 2026-05-19
For more advanced date formatting in scripts you can also import a date library such as
date-fns, see importing external modules.
The full list of available members is documented in the faker script API reference.