Data Generation
MockAPI generates realistic mock data using 140+ property types powered by Faker.js. Learn about all available types, locale support, and customization options.
How Data Generation Works
When a mock endpoint receives a request, MockAPI looks at the response's associated data model, reads each property's type, and generates a value using the appropriate generator. The result is a realistic JSON object (or array of objects) that matches your model's structure.
Data is generated fresh for each request. MockAPI doesn't store generated data. Each response contains newly generated values based on your property configurations.
Property Types
MockAPI offers a wide range of property types organized into categories. Each type generates contextually appropriate data.
Basic Types
| Type | Description | Example Output |
|---|---|---|
| String | A random word or short text | "lorem" |
| Text | A longer paragraph of text | "Lorem ipsum dolor sit amet..." |
| Number | A random integer | 42 |
| Decimal | A random decimal number | 19.99 |
| Boolean | true or false | true |
| Date | A date in ISO format | "2025-03-15" |
| Date Time | A date and time in ISO format | "2025-03-15T14:30:00.000Z" |
Person
| Type | Description | Example Output |
|---|---|---|
| Name | A full name (first + last) | "John Doe" |
| First Name | A first name | "Jane" |
| Last Name | A last name | "Smith" |
| An email address | "john.doe@example.com" | |
| Phone | A phone number | "+1-555-123-4567" |
| Gender | A gender string | "Female" |
| Job Title | A job title | "Senior Developer" |
Location
| Type | Description | Example Output |
|---|---|---|
| Address | A full street address | "123 Main St" |
| City | A city name | "San Francisco" |
| State | A state or region | "California" |
| Country | A country name | "United States" |
| Zip Code | A postal code | "94105" |
| Latitude | A latitude coordinate | 37.7749 |
| Longitude | A longitude coordinate | -122.4194 |
Internet
| Type | Description | Example Output |
|---|---|---|
| URL | A URL | "https://example.com/page" |
| Domain | A domain name | "example.com" |
| Username | A username | "john_doe42" |
| Password | A password string | "xK9#mPq2!" |
| IP | An IP address (v4 or v6) | "192.168.1.1" |
| IPv4 | An IPv4 address | "192.168.1.1" |
| IPv6 | An IPv6 address | "2001:0db8:85a3:0000:..." |
| Avatar | A profile avatar image URL | "https://cdn.mockapi.com/..." |
Finance
| Type | Description | Example Output |
|---|---|---|
| Account | A bank account number | "12345678" |
| Amount | A monetary amount | "249.99" |
| Credit Card | A credit card number | "4532-1234-5678-9012" |
| Currency | A currency code | "USD" |
| Bitcoin | A Bitcoin address | "1A1zP1eP5QGefi2DMPTf..." |
| Ethereum | An Ethereum address | "0x32Be343B94f860124dC..." |
Commerce
| Type | Description | Example Output |
|---|---|---|
| Product | A product name | "Handmade Steel Chair" |
| Price | A price | "29.99" |
| Department | A department/category | "Electronics" |
Images
MockAPI provides 30+ image categories that return URLs to hosted stock images. These are served from MockAPI's CDN and are always available.
| Type | Description |
|---|---|
| Avatar | Profile avatar images |
| Banner | Wide banner images |
| Product Image | Product photography |
| Food | Food and cuisine images |
| Nature | Nature and landscape photography |
| City | Urban cityscape images |
| Technology | Technology-related images |
| Business | Business and office images |
| Fashion | Fashion and clothing images |
| Architecture | Architecture photography |
| Animals | Animal photography |
| Sports | Sports action images |
| Travel | Travel destination images |
| Abstract | Abstract art images |
| ...and 15+ more | Categories for various image needs |
All image URLs follow the pattern: https://cdn.mockapi.com/file/mockapi/{{category}}/{{filename}}
Model References
You can reference other models to create nested objects. Select another model as the property type, and MockAPI will generate a nested object (or array) using that model's properties.
Info
Nested models have a maximum depth of 5 levels to prevent circular reference issues. See Circular Reference Protection below.
Data Customization
Sequential values
Enable Sequential on a property to generate incrementing values. This is commonly used for ID fields. The sequence starts at 1 by default and increments for each item in a range response.
[
{ "id": 1, "name": "Alice" },
{ "id": 2, "name": "Bob" },
{ "id": 3, "name": "Charlie" }
]Numeric ranges
For number and decimal types, use Range Start and Range End to constrain generated values. For example, setting range 1-100 generates numbers between 1 and 100.
Static values
Enable Static Data to always return the same value for a property. The static value is returned as-is in every response. Useful for version numbers, constant strings, or fixed configuration values.
Custom list values
Define a set of possible values and MockAPI will randomly pick one for each generated instance. Enter values as a comma-separated list.
Example: For a "status" field, enter: active, inactive, pending, suspended
Example: For a "color" field, enter: red, blue, green, yellow, purple
Regex patterns
Use regular expression patterns to generate strings that match a specific format. MockAPI uses the regex pattern to produce matching strings.
Example: [A-Z]{3}-\d{4} generates strings like ABC-1234
Character sequences
Character sequences provide a simpler alternative to regex for common patterns:
| Symbol | Generates | Example Pattern | Example Output |
|---|---|---|---|
| # | Random digit (0-9) | ORD-#### | ORD-8472 |
| @ | Random uppercase letter | @@-#### | KM-3917 |
| ^ | Random lowercase letter | ^^## | ab42 |
| * | Random alphanumeric | ****-**** | a3Kp-9mQx |
| $ | Random special character | pass$$ | pass!@# |
| % | Random hex character | %%:%%:%% | A3:F1:B7 |
Locale Support
MockAPI supports data generation in multiple languages and regional formats. The locale is set at the project level and affects all generated data including names, addresses, phone numbers, and dates. You can change the locale in Settings → General.
How locales work
When you set a project's locale to "de" (German), name properties generate German names, address properties generate German addresses, and so on. MockAPI supports all major Faker.js locales including:
| Locale | Language |
|---|---|
| en | English (default) |
| de | German |
| fr | French |
| es | Spanish |
| it | Italian |
| ja | Japanese |
| ko | Korean |
| zh_CN | Chinese (Simplified) |
| pt_BR | Portuguese (Brazil) |
| ru | Russian |
| ar | Arabic |
| nl | Dutch |
| pl | Polish |
| sv | Swedish |
| ...and many more | All Faker.js locales are supported |
Locale fallback
If a specific locale variant is not available (e.g., "en_GB"), MockAPI falls back to the base language ("en"). Both hyphenated (en-US) and underscored (en_US) formats are accepted.
Circular Reference Protection
When models reference each other (Model A contains Model B, which contains Model A), MockAPI prevents infinite recursion by limiting nesting depth to 5 levels. At the maximum depth, nested model references return null instead of generating deeper objects.
You can check for circular references when editing a model using the built-in cycle detection feature available from the model editor.
GraphQL Selection Set Filtering
When data is generated for GraphQL responses, MockAPI respects the client's selection set. Only fields explicitly requested in the query are included in the response, even if the model has additional properties. This mirrors real GraphQL server behavior and reduces response size.