# Welcome

MockAPI is a tool designed to enhance the development process by providing dynamic API mocking capabilities. It allows developers to create mock APIs and use them in their applications for building prototypes, real projects when the back-end is not ready, integrated into tests as a test server, generating test data, etc.

#### MockAPI is easy to use

With its minimalist design, developers can easily setup an account, create models and endpoints and will be ready to start making API calls to their endpoints. Users can also import OpenAPI docs and Postman collections to quickly and seamlessly create those resources.

#### MockAPI is realistic

The data generated are realistic real-world data in over 50 different languages and locales. Users can also configure the behavior of responses for API calls to mimic real world scenarios, such as conditionally returning a non-200 response at a predefined probability.

#### MockAPI is for everyone

With the free forever version, anyone can easily set up an account and start using MockAPI straight away. Users can be anything from Front-end Engineers, Back-end Engineers, Test Engineers, Data Engineers/Analysts, Enthusiasts, etc.

Start by [creating a free account](https://mockapi.com/Identity/Account/Register) today!


# Use cases

MockAPI is designed to streamline the development and testing phases of software projects by providing a platform for rapid prototyping, integration testing, and more. Below are the key use cases for which MockAPI is ideally suited:

**1. Rapid Prototyping**

MockAPI accelerates the transition from ideas to tangible products by allowing developers to visualize their Minimum Viable Product (MVP) with realistic data. This capability provides end-users with an authentic experience of the final product, facilitating more accurate feedback and iterative development.

**2. Seamless Integration Testing**

Integration testing can often be a bottleneck in the development process, but MockAPI simplifies this by ensuring that different components, APIs, systems, and applications work harmoniously together. With MockAPI, integration issues can be identified and resolved early in the development cycle, avoiding costly fixes later on.

**3. Frontend-Backend Collaboration**

Frontend development should not have to wait for backend systems to be fully developed. MockAPI enables frontend teams to design, develop, and test applications by using mock data that behaves like a real backend. This parallel development process increases productivity and helps ensure that frontend and backend systems align perfectly when integrated.

**4. Comprehensive API Testing**

MockAPI provides a robust environment for testing both internal and external APIs. Whether you are developing new APIs or integrating third-party services, MockAPI allows you to conduct thorough testing with data that reflects real-world use cases. This ensures that your APIs are reliable, performant, and ready for deployment.

**5. Data Science Ready**

For data scientists, having access to realistic, well-structured data is crucial. MockAPI supports data science projects by generating datasets specifically tailored for AI and machine learning applications. This feature enables data scientists to train and test their models with high-quality data, leading to more effective algorithms and insights.

**6. Education and Training**

MockAPI can be an excellent tool for educational purposes, where instructors and students use it to simulate real-world APIs in classroom settings or online courses. It provides a safe, controlled environment for learning how APIs work, how to interact with them, and how to handle data dynamically without the need for real-world consequences.

**7. Third-Party Vendor Simulation**

For projects that rely on third-party services, MockAPI can simulate those APIs to develop and test your application without having actual access to the third-party services. This is particularly useful when third-party APIs are unstable, costly, or have strict rate limits.

**8. Load Testing**

MockAPI can help simulate different load scenarios to see how your application behaves under stress or high traffic conditions. By providing mock responses, you can test the scalability and performance of your application before it goes into production.

**9. Regulatory Compliance Testing**

In environments where data handling and processing are subject to regulatory compliance (such as GDPR, HIPAA, etc.), MockAPI can be used to ensure that applications are compliant by simulating the necessary conditions and responses without using real personal data.

**10. Multi-Tenancy Testing**

For applications that serve multiple users or organizations from a single instance (multi-tenancy), MockAPI can simulate various tenant scenarios. This helps developers ensure that data segregation, customized configurations, and privacy controls work as intended for different users.

**11. IoT Simulation**

In IoT applications where various devices need to interact through APIs, MockAPI can simulate the APIs of those IoT devices, enabling developers to prototype and test interactions between the cloud and devices without the need for physical devices.

**12. Error and Failure Testing**

MockAPI can be set up to return error responses deliberately to test how the application handles failures such as timeouts, server errors, or network failures. This can help improve the robustness and error handling capabilities of the application.

**13. Integration in Unit Testing**

MockAPI can be integrated into unit testing frameworks to provide mocked responses to API calls. This allows developers to write and execute tests that rely on API interactions without actually hitting the real API endpoints. Here’s how it can be beneficial:

* **Isolation**: By using MockAPI, developers can isolate the unit tests from external dependencies, ensuring that tests are not affected by the availability or behavior of external services.
* **Consistency**: MockAPI can return consistent, predictable responses, which is crucial for unit testing where you need to assert known outcomes based on given inputs.
* **Full Control**: You can simulate various scenarios including edge cases, failures, and unexpected responses, which might be hard to replicate with a real API.

Integration can typically be done by configuring the unit testing framework to route API requests to MockAPI endpoints instead of real ones, either through environmental variables, configuration files, or directly in the test code.

**14. Integration in Development Environments**

Incorporating MockAPI into development environments allows developers to work independently of backend services, which might still be under development or undergoing maintenance. This is particularly useful in microservices architectures where different teams may be responsible for different services. Here’s how MockAPI facilitates this:

* **Parallel Development**: Frontend and backend teams can work in parallel. Frontend developers use MockAPI to simulate backend responses, while backend developers work on implementing the actual logic.
* **Environment Stability**: Developers can continue their work even when parts of the backend are unstable or down for maintenance.
* **Configuration Driven**: MockAPI can be integrated into the development environment through configuration management tools, allowing developers to switch between real and mock APIs based on the environment settings (e.g., development, testing, production).

To integrate MockAPI into development environments, teams can use environment-specific configuration files or environment variables that point to either MockAPI or real APIs depending on the requirements. This setup helps maintain a clear distinction between development and production configurations, preventing mock settings from being deployed to production environments.

#### Conclusion

MockAPI serves as a powerful tool that significantly enhances the software development and testing processes across a variety of scenarios. By providing the ability to simulate real-world data and API behaviors, MockAPI allows development teams to address challenges such as integration testing, load testing, compliance testing, and more, without the need for real data or services. This versatility makes it an indispensable asset for companies aiming to streamline their workflows and improve product quality through rigorous testing and accurate prototyping.

Through its integration into unit tests and development environments, MockAPI enables developers to maintain productivity and consistency regardless of external dependencies. This isolation from real-world variables helps ensure that the development process is not only faster but also more stable and predictable. Whether you are a small team or a large enterprise, MockAPI adapits to your needs, ensuring that your applications are robust, scalable, and compliant with expectations and standards.

In conclusion, MockAPI not only simplifies the technical complexities of application development but also empowers teams to deliver superior software solutions efficiently. Its ability to mock, simulate, and test various API scenarios is crucial for minimizing risks, speeding up development cycles, and ensuring that your software meets the highest standards of quality and reliability before it reaches the end-users.


# Project

Everything starts with a project. Kindly create a project by clicking on the project selection box at the top of the dashboard and click on the [*Create New Project*](https://mockapi.com/Project/Create) button.

#### Locale

Locales are set project wide. This means that all endpoints within a project will return data in the locale set for that project.

#### API Key

An API key is associated with a project, and can be regenerated at any time from the *API Key* tab on the [*Settings*](https://mockapi.com/Project/Settings) page.

#### Teams

Multiple users can collaborate and work on a project. Any user can invite others to join a project by clicking on the *Invite User* button and entering their email address on the *Manage Teams* tab on the [*Settings*](https://mockapi.com/Project/Settings) page.

When a new team member joins a project, they are not required to upgrade their plans. It is the responsibility of the project owner to upgrade their plan to avail advanced features for that project and any other project they may have.

#### Advanced Configuration

**Pagination Request Parameter Labels**: This is where you set the label for the pagination request parameters.

For eg:

<pre class="language-javascript"><code class="lang-javascript">?<a data-footnote-ref href="#user-content-fn-1">page</a>=x&#x26;<a data-footnote-ref href="#user-content-fn-2">limit</a>=y
</code></pre>

The default values are **page** and **limit** respectively.

If a page number is set in the request parameter, it will return same page number within the pagination response data.

If a limit is set in the request parameter, it will return a total record of the limit set.

**Note**: The settings is for setting the labels, not the actual numbers.

**Pagination Response Parameter Labels**: This is where you set the labels for the pagination data within the response body.

The pagination data is returned in this format:

<pre class="language-json"><code class="lang-json">{
    "data": [
        ...
    ],
    "<a data-footnote-ref href="#user-content-fn-3">pagination</a>": {
        "<a data-footnote-ref href="#user-content-fn-3">currPage</a>": 1,
        "<a data-footnote-ref href="#user-content-fn-3">nextPage</a>": 2,
        "<a data-footnote-ref href="#user-content-fn-3">prevPage</a>": null,
        "<a data-footnote-ref href="#user-content-fn-3">pageSize</a>": 5,
        "<a data-footnote-ref href="#user-content-fn-3">totalPages</a>": 200,
        "<a data-footnote-ref href="#user-content-fn-3">totalRecords</a>": 1000
    }
}
</code></pre>

The labels for this data can be changed from the "Advanced Configuration" tab on the [*Settings*](https://mockapi.com/Project/Settings) page. Eg: ***currPage*** can be changed to ***currentPage*** or ***page***.

[^1]: page label

[^2]: limit label

[^3]: default label


# Models

In MockAPI, a model is a blueprint outlining the structure and type of data your API should handle, similar to how Data Transfer Objects (DTOs) work in API frameworks.&#x20;

By defining a model, you instruct MockAPI to generate realistic, structured data, like user profiles in a social media app, with specified attributes or properties such as names, email and date of birth.

Defining a model enables MockAPI to generate realistic data based on the properties of that model and will return the data based on that structure.

Let's discuss how to create a model next.


# Create a Model

To create a model, navigate to the Models section by simply click on the *Models* link on the side menu of your dashboard.

On the Models page, you will see a list of existing models if any, then click on the [*Create Model*](https://mockapi.com/Models/Create) button at the top of the table list.

<figure><img src="/files/EjxDkvcIiHNmQC8jvgzk" alt=""><figcaption></figcaption></figure>

On the model creation page, kindly enter the name of the model, eg: *User*, and add the properties associated with that model, *eg: id, firstname, lastname,* etc.

Simply add new properties by clicking on the plus (+) button below the last property. You can also delete/remove a property by clicking on the associated delete button for that property.

<figure><img src="/files/MY6UEOTsUd8H3YxwMQFG" alt=""><figcaption><p>Creation of a model</p></figcaption></figure>

While adding a property, kindly enter the name of the property, *eg: id*, and select the type for that property from the wide range of types, eg: *UUID*.

There are wide range of existing data type you can select for a property, but also static data which allows you to enter the exact data you want it to return or pattern-based data in form of a defined Regular Expression or Character Sequence.

<figure><img src="/files/9po8PbjKqKASiF3b8Xot" alt=""><figcaption><p>Select type of the property</p></figcaption></figure>

If you would like the property to return an array of the type you selected, click on the settings button for that property, a modal will pop up, select "*Is This Property an Array?*" and enter the number of items to return.

<figure><img src="/files/cXxsSCDhTlcoFBeyMauc" alt=""><figcaption><p>Configure the property to return a list</p></figcaption></figure>

Each property can be dragged up or down depending on where you want it to sit within the model. Do this by simply clicking and dragging the property up or down.


# Property Types

This guide provides comprehensive information about the various property types you can set for each property of a model. These models are used to generate random data for API responses based on the types set for each model property.

#### Address Property Types

* **Building Number**: Generates a random building number.
  * **Samples**: 101, 202, 303
* **City**: Generates a random city name.
  * **Samples**: New York, London, Tokyo
* **City Name**: Generates a random city name (specific naming convention).
  * **Samples**: Paris, Berlin, Madrid
* **Country**: Generates a random country name.
  * **Samples**: USA, Canada, UK
* **Country Code**: Generates a random country code.
  * **Samples**: US, CA, GB
* **County**: Generates a random county name.
  * **Samples**: Los Angeles County, Cook County, Harris County
* **Latitude**: Generates a random latitude coordinate.
  * **Samples**: 34.0522, 40.7128, 51.5074
* **Longitude**: Generates a random longitude coordinate.
  * **Samples**: -118.2437, -74.0060, -0.1278
* **State**: Generates a random state name.
  * **Samples**: California, Texas, New York
* **State Abbreviation**: Generates a random state abbreviation.
  * **Samples**: CA, TX, NY
* **Street**: Generates a random street name.
  * **Samples**: Main St, Second St, Elm St
* **Street Address**: Generates a random street address.
  * **Samples**: 123 Main St, 456 Elm St, 789 Oak St
* **Time Zone**: Generates a random time zone.
  * **Samples**: EST, CST, PST
* **Zip Code**: Generates a random zip code.
  * **Samples**: 10001, 90001, 73301

#### Animal Property Types

* **Bear**: Generates a random bear species.
  * **Samples**: Grizzly Bear, Polar Bear, Black Bear
* **Bird**: Generates a random bird species.
  * **Samples**: Sparrow, Eagle, Parrot
* **Cat**: Generates a random cat breed.
  * **Samples**: Siamese, Persian, Maine Coon
* **Cetacean**: Generates a random cetacean species.
  * **Samples**: Blue Whale, Dolphin, Orca
* **Cow**: Generates a random cow breed.
  * **Samples**: Holstein, Angus, Jersey
* **Crocodilia**: Generates a random crocodilia species.
  * **Samples**: Crocodile, Alligator, Caiman
* **Dog**: Generates a random dog breed.
  * **Samples**: Labrador, German Shepherd, Bulldog
* **Fish**: Generates a random fish species.
  * **Samples**: Salmon, Goldfish, Tuna
* **Horse**: Generates a random horse breed.
  * **Samples**: Arabian, Thoroughbred, Clydesdale
* **Insect**: Generates a random insect species.
  * **Samples**: Butterfly, Ant, Bee
* **Lion**: Generates a random lion species.
  * **Samples**: African Lion, Asiatic Lion, White Lion
* **Rabbit**: Generates a random rabbit breed.
  * **Samples**: Netherland Dwarf, Angora, Lionhead
* **Rodent**: Generates a random rodent species.
  * **Samples**: Mouse, Rat, Squirrel
* **Snake**: Generates a random snake species.
  * **Samples**: Python, Rattlesnake, Cobra

#### Color Property Types

* **Human Color**: Generates a random human skin color.
  * **Samples**: Peach, Olive, Ivory
* **RGB Color**: Generates a random RGB color.
  * **Samples**: 255,0,0; 0,255,0; 0,0,255

#### Commerce Property Types

* **Department**: Generates a random department name.
  * **Samples**: Electronics, Clothing, Home & Garden
* **Price**: Generates a random price.
  * **Samples**: $19.99, $99.50, $249.00
* **Product**: Generates a random product name.
  * **Samples**: Smartphone, Sneakers, Coffee Maker
* **Product Description**: Generates a random product description.
  * **Samples**: High-resolution camera, Lightweight and comfortable, Brews in under 5 minutes
* **Product Name**: Generates a random product name.
  * **Samples**: GalaxyX, Runner's Choice, MorningBrew

#### Company Property Types

* **Company Name**: Generates a random company name.
  * **Samples**: Globex Corp, Initech, Umbrella Corporation
* **Catch Phrase**: Generates a random company catchphrase.
  * **Samples**: Innovate strategic solutions, Empower seamless markets, Drive sustainable growth
* **Company Suffix**: Generates a random company suffix.
  * **Samples**: Inc, LLC, Ltd

#### Database Property Types

* **Column**: Generates a random database column name.
  * **Samples**: user\_id, email\_address, phone\_number
* **Type**: Generates a random database column type.
  * **Samples**: VARCHAR(255), INT, BOOLEAN
* **Collation**: Generates a random database collation.
  * **Samples**: utf8\_general\_ci, latin1\_swedish\_ci, utf8\_unicode\_ci
* **Engine**: Generates a random database engine.
  * **Samples**: InnoDB, MyISAM, MEMORY

#### Datatype Property Types

* **Boolean**: Generates a random boolean value.
  * **Samples**: true, false
* **Null**: Generates a null value.
  * **Samples**: null
* **Datetime**: Generates a random datetime.
  * **Samples**: 2023-01-01T00:00:00, 2023-12-25T18:30:00, 2023-07-04T12:00:00
* **Float**: Generates a random float value.
  * **Samples**: 3.14, 0.001, 123.456
* **Hexadecimal**: Generates a random hexadecimal value.
  * **Samples**: #1a2b3c, #ff0044, #00cc99
* **JSON**: Generates a random JSON object.
  * **Samples**: {"key": "value"}, {"id": 1, "name": "John"}, \["one", "two", "three"]
* **Number**: Generates a random number.
  * **Samples**: 42, 100, 2023
* **String**: Generates a random string.
  * **Samples**: Hello, World, Faker
* **UUID**: Generates a random UUID.
  * **Samples**: 123e4567-e89b-12d3-a456-426614174000, 123e4567-e89b-12d3-a456-426614174001, 123e4567-e89b-12d3-a456-426614174002

#### Date Property Types

* **Past Date**: Generates a random past date.
  * **Samples**: 2000-01-01, 1980-05-15, 1995-12-20
* **Future Date**: Generates a random future date.
  * **Samples**: 2050-01-01, 2040-08-25, 2060-11-30
* **Recent Date**: Generates a random recent date.
  * **Samples**: 2024-01-01, 2024-03-15, 2024-04-20
* **Soon Date**: Generates a random soon date.
  * **Samples**: 2024-12-25, 2024-01-01, 2024-11-11
* **Month**: Generates a random month name.
  * **Samples**: January, July, December
* **Weekday**: Generates a random weekday name.
  * **Samples**: Monday, Friday, Sunday

#### Finance Property Types

* **Account**: Generates a random account number.
  * **Samples**: 123456789, 987654321, 112233445
* **Account Name**: Generates a random account name.
  * **Samples**: Savings Account, Checking Account, Business Account
* **Mask**: Generates a random account mask.
  * **Samples**: 1234, \*\*\*\*, 5678
* **Amount**: Generates a random amount.
  * **Samples**: $100.00, $250.50, $5000.00
* **BIC**: Generates a random BIC code.
  * **Samples**: NEDSZAJJXXX, CITIUS33XXX, DEUTDEFFXXX
* **Bitcoin Address**: Generates a random Bitcoin address.
  * **Samples**: 1BoatSLRHtKNngkdXEeobR76b53LETtpyT, 3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy, 3Cbq7aT1tY8kMxWLbitaG7yT6bPbKChq64
* **Currency Code**: Generates a random currency code.
  * **Samples**: USD, EUR, GBP
* **Currency Name**: Generates a random currency name.
  * **Samples**: Dollar, Euro, Pound
* **Currency Symbol**: Generates a random currency symbol.
  * **Samples**: $, €, £
* **Credit Card CVV**: Generates a random credit card CVV.
  * **Samples**: 123, 456, 789
* **Credit Card Issuer**: Generates a random credit card issuer.
  * **Samples**: Visa, MasterCard, American Express
* **Credit Card Number**: Generates a random credit card number.
  * **Samples**: 4111111111111111, 5500000000000004, 340000000000009
* **Ethereum Address**: Generates a random Ethereum address.
  * **Samples**: 0x27b1fdb04752bbc536007a920d24acb045561c26, 0x4e83362442b8d1bec281594cea3050c8eb01311c, 0x529084c0460e64dde4cb8a92b20ea16a3004a987
* **IBAN**: Generates a random IBAN code.
  * **Samples**: DE89370400440532013000, GB82WEST12345698765432, FR7630006000011234567890189
* **Litecoin Address**: Generates a random Litecoin address.
  * **Samples**: LZpSK9BcYPmF4YWgqMp9ABNpF6BCPEEYKw, Lc6YgT8ArbK1Q4Eda3m4Ss9uR7gLmTfj2M, LaHM6LWJ711vp3uUep4rwXKwJ4bYfFZ5H8
* **PIN**: Generates a random PIN number.
  * **Samples**: 1234, 9876, 4567
* **Routing Number**: Generates a random routing number.
  * **Samples**: 011000015, 021000021, 121000358
* **Transaction Description**: Generates a random transaction description.
  * **Samples**: Payment for invoice #123, Transfer to savings account, Refund for product #456
* **Transaction Type**: Generates a random transaction type.
  * **Samples**: Deposit, Withdrawal, Transfer

#### Image Property Types

* **Abstract Image**: Generates a random abstract image description.
  * **Samples**: Colorful patterns, Geometric shapes, Fluid textures
* **Animals Image**: Generates a random animals image description.
  * **Samples**: Lion in the wild, Butterflies on flowers, Herd of elephants
* **Avatar**: Generates a random avatar description.
  * **Samples**: Cartoon character, Abstract face, Animal avatar
* **Business Image**: Generates a random business image description.
  * **Samples**: Corporate meeting, Office building, Business handshake
* **Cats Image**: Generates a random cats image description.
  * **Samples**: Sleeping kitten, Playful cat, Angry cat
* **City Image**: Generates a random city image description.
  * **Samples**: Skyline at night, Busy street, Urban park
* **Data Uri**: Generates a random data URI.
  * **Samples**: Encoded image data, Base64 image string, Embedded graphic
* **Fashion Image**: Generates a random fashion image description.
  * **Samples**: Runway model, Fashion accessories, High fashion shoot
* **Food Image**: Generates a random food image description.
  * **Samples**: Gourmet meal, Fresh fruits, Desserts
* **Image**: Generates a random image description.
  * **Samples**: Scenic landscape, Portrait photo, Abstract art
* **Image Url**: Generates a random image URL.
  * **Samples**: <https://example.com/photo.jpg>, <https://imagesite.com/image.png>, <https://mypics.org/beautiful.jpg>
* **Nature Image**: Generates a random nature image description.
  * **Samples**: Mountain range, Forest trail, Ocean sunset
* **Nightlife Image**: Generates a random nightlife image description.
  * **Samples**: City nightlife scene, Nightclub, Concert event
* **People Image**: Generates a random people image description.
  * **Samples**: Group of friends, Portrait of a woman, Man in a crowd
* **Sports Image**: Generates a random sports image description.
  * **Samples**: Soccer match, Basketball game, Marathon runners
* **Technics Image**: Generates a random technics image description.
  * **Samples**: Modern gadgets, Engineering marvels, Technological devices
* **Transport Image**: Generates a random transport image description.
  * **Samples**: Busy subway station, Airport runway, Highway traffic

#### Internet Property Types

* **Avatar**: Generates a random avatar URL.
  * **Samples**: <https://example.com/avatar1.jpg>, <https://avatar.com/pic2.png>, <https://imagesite.org/avatar3.svg>
* **Color**: Generates a random hex color code.
  * **Samples**: #FF5733, #33D4FF, #F033FF
* **Domain Name**: Generates a random domain name.
  * **Samples**: example.com, mysite.net, webworld.org
* **Email**: Generates a random email address.
  * **Samples**: <user@example.com>, <contact@mysite.net>, <info@webworld.org>
* **Emoji**: Generates a random emoji.
  * **Samples**: 😀, 👍, 🌟
* **Example Email**: Generates a random example email address.
  * **Samples**: <john@example.com>, <jane.doe@example.net>, <info@example.org>
* **HTTP Method**: Generates a random HTTP method.
  * **Samples**: GET, POST, PUT
* **HTTP Status Code**: Generates a random HTTP status code.
  * **Samples**: 200, 404, 500
* **IP**: Generates a random IP address.
  * **Samples**: 192.168.1.1, 10.0.0.2, 172.16.0.3
* **IPv4**: Generates a random IPv4 address.
  * **Samples**: 192.168.1.10, 10.0.0.20, 172.16.0.30
* **IPv6**: Generates a random IPv6 address.
  * **Samples**: 2001:0db8:85a3:0000:0000:8a2e:0370:7334, fe80:0000:0000:0000:0202:b3ff:fe1e:8329, 2001:db8:0:1:1:1:1:1
* **MAC**: Generates a random MAC address.
  * **Samples**: 00:1B:44:11:3A:B7, 00:0a:e6:3e:fd:e1, 00:0d:93:13:51:da
* **Password**: Generates a random password.
  * **Samples**: Pass1234, Secr3t!, MyP\@ssw0rd
* **Port**: Generates a random port number.
  * **Samples**: 8080, 3000, 443
* **Protocol**: Generates a random protocol.
  * **Samples**: http, https, ftp
* **URL**: Generates a random URL.
  * **Samples**: <https://www.example.com>, <http://mysite.net>, <https://webworld.org>
* **User Agent**: Generates a random user agent string.
  * **Samples**: Mozilla/5.0, Chrome/90.0, Safari/605.1.15
* **User Name**: Generates a random user name.
  * **Samples**: john\_doe, sarah.connor, neo.matrix

#### Lorem Property Types

* **Lines**: Generates random lines of lorem ipsum text.
  * **Samples**: Lorem ipsum dolor sit amet, Consectetur adipiscing elit, Sed do eiusmod tempor incididunt
* **Paragraph**: Generates a random lorem ipsum paragraph.
  * **Samples**: Lorem ipsum dolor sit amet, consectetur adipiscing elit..., Pellentesque habitant morbi tristique senectus et netus..., Nam libero tempore, cum soluta nobis est eligendi optio...
* **Paragraphs**: Generates random lorem ipsum paragraphs.
  * **Samples**: Lorem ipsum dolor sit amet...\n\nSed ut perspiciatis unde..., At vero eos et accusamus et iusto odio...\n\nEt harum quidem rerum..., Temporibus autem quibusdam et aut officiis debitis...\n\nNeque porro quisquam est...
* **Sentence**: Generates a random lorem ipsum sentence.
  * **Samples**: Lorem ipsum dolor sit amet, consectetur adipiscing elit., Etiam sit amet orci eget eros faucibus tincidunt., Duis aute irure dolor in reprehenderit in voluptate.
* **Sentences**: Generates random lorem ipsum sentences.
  * **Samples**: Lorem ipsum dolor sit amet, consectetur. Ut enim ad minim veniam., Sed ut perspiciatis unde omnis iste. Natus error sit voluptatem., Duis aute irure dolor in reprehenderit. Velit esse cillum dolore.
* **Slug**: Generates a random slug.
  * **Samples**: lorem-ipsum, dolor-sit-amet, consectetur-adipiscing
* **Text**: Generates random lorem ipsum text.
  * **Samples**: Lorem ipsum dolor sit amet, consectetur adipiscing elit., Vestibulum nec odio ipsum. Suspendisse cursus malesuada facilisis., Donec nec justo eget felis facilisis fermentum.
* **Word**: Generates a random lorem ipsum word.
  * **Samples**: lorem, ipsum, dolor
* **Words**: Generates random lorem ipsum words.
  * **Samples**: lorem ipsum, dolor sit amet, consectetur adipiscing

#### Music Property Types

* **Music Genre**: Generates a random music genre.
  * **Samples**: Rock, Jazz, Classical
* **Song Name**: Generates a random song name.
  * **Samples**: Yesterday, Imagine, Bohemian Rhapsody

#### Pattern Property Types

* **Character Sequence**: Generates data based on a character sequence pattern.
  * **Rule**:
    * Use `#` for a random digit.
    * Use `@` for a random lower case letter.
    * Use `^` for a random upper case letter.
    * Use `*` for a random digit or letter.
    * Use `$` for a random digit or lower case letter.&#x20;
    * Use `%` for a random digit or upper case letter.&#x20;
    * Any other character will be included verbatim.
  * **Example**: `###-**-$$$$` (e.g., 123-ab-cdef)
* **Regular Expression**: Generates data based on a regular expression pattern.
  * **Example**: `^0\d{9}$` (e.g., 0123456789)

#### Person Property Types

* **First Name**: Generates a random first name.
  * **Samples**: John, Emma, Mohamed
* **Full Name**: Generates a random full name.
  * **Samples**: John Doe, Emma Watson, Mohamed Ali
* **Gender**: Generates a random gender.
  * **Samples**: Male, Female, Non-binary
* **Job Area**: Generates a random job area.
  * **Samples**: Management, Technical, Administrative
* **Job Descriptor**: Generates a random job descriptor.
  * **Samples**: Senior, Lead, Junior
* **Job Title**: Generates a random job title.
  * **Samples**: Software Engineer, Project Manager, Graphic Designer
* **Job Type**: Generates a random job type.
  * **Samples**: Part-time, Full-time, Contract
* **Last Name**: Generates a random last name.
  * **Samples**: Smith, Johnson, Williams
* **Middle Name**: Generates a random middle name.
  * **Samples**: James, Elizabeth, Abdul
* **Prefix**: Generates a random prefix.
  * **Samples**: Mr., Ms., Dr.
* **Sex**: Generates a random sex.
  * **Samples**: Male, Female, Other
* **Sex Type**: Generates a random sex type.
  * **Samples**: Masculine, Feminine, Other
* **Suffix**: Generates a random suffix.
  * **Samples**: Jr., Sr., III

#### Phone Property Types

* **IMEI**: Generates a random IMEI number.
  * **Samples**: 490154203237518, 356938035643809, 990000862471854
* **Phone Number**: Generates a random phone number.
  * **Samples**: +1-202-555-0173, +44-7911-123456, +61-412-345-678

#### Static Property Types

* **Static Data**: Returns static data entered by the user.
  * **Examples**: Your custom static data

#### System Property Types

* **File Extension**: Generates a random file extension.
  * **Samples**: pdf, txt, jpg
* **File Name**: Generates a random file name.
  * **Samples**: document.pdf, image.jpg, spreadsheet.xls
* **File Type**: Generates a random file type.
  * **Samples**: text, image, video
* **File Path**: Generates a random file path.
  * **Samples**: /home/user/documents/report.pdf, /var/www/html/index.html, C:\Program Files\app\app.exe
* **Cron**: Generates a random cron expression.
  * **Samples**: \* \* \* \* \*, 0 12 \* \* MON, \*/15 \* \* \* \*
* **Directory Path**: Generates a random directory path.
  * **Samples**: /home/user/documents, /var/log, C:\Program Files
* **MIME Type**: Generates a random MIME type.
  * **Samples**: application/pdf, image/jpeg, text/plain

#### Vehicle Property Types

* **Bicycle**: Generates a random bicycle type.
  * **Samples**: Mountain bike, Road bike, Hybrid bike
* **Vehicle Color**: Generates a random vehicle color.
  * **Samples**: Red, Blue, Black
* **Fuel**: Generates a random fuel type.
  * **Samples**: Petrol, Diesel, Electric
* **Vehicle Manufacturer**: Generates a random vehicle manufacturer.
  * **Samples**: Toyota, Ford, BMW
* **Vehicle Model**: Generates a random vehicle model.
  * **Samples**: Camry, F-150, 3 Series
* **Vehicle Type**: Generates a random vehicle type.
  * **Samples**: Sedan, SUV, Truck
* **Vehicle**: Generates a random vehicle type.
  * **Samples**: Car, Motorbike, Truck
* **Vehicle VIN**: Generates a random vehicle VIN.
  * **Samples**: 1HGCM82633A004352, 1FTRW08L21KE34589, JH4KA96583N012345
* **Vehicle VRM**: Generates a random vehicle VRM.
  * **Samples**: YD58GTA, MF61CVJ, RX62HSK

***

This is an overview of the various property types supported by MockAPI. These property types allow you to generate realistic and diverse data for your API responses.


# Endpoints

An endpoint is a specific URL where your application can request or send data. It acts like a distinct address in an API that defines one particular operation or data set. For example, in a weather app, one endpoint might provide current weather data, while another could offer forecasts. When you interact with an endpoint, you're essentially asking the API to perform a specific task, like retrieving, updating, or deleting data.

Each endpoint supports different request types, such as GET, POST, PUT, PATCH, DELETE, HEAD and OPTIONS.


# Create an Endpoint

To create an endpoint, navigate to the Endpoints section by simply click on the *Endpoints* link on the side menu of your dashboard.

On the Endpoints page, you will see a list of existing endpoints if any, then click on the [*Create Endpoint*](https://mockapi.com/Endpoints/Create) button at the top of the table list.

<figure><img src="/files/yy1g40aV5mA5DULHxX6f" alt=""><figcaption><p>Create an Endpoint</p></figcaption></figure>

On the endpoint creation page, start by entering the endpoint you want to create, then for any request type you want to setup for that endpoint, click on the plus (+) button beside it to expand it, then click on the plus (+) button below the Responses to add a new response for that request type.

When associating a response to a request type, select the response code (200 OK, 404, Not Found, etc), and then select a model from the range of existing models in the project.

<figure><img src="/files/kIsi2Ssh2bcfkmfULdUO" alt=""><figcaption><p>Endpoint creation page</p></figcaption></figure>

#### Advanced Configuration

<figure><img src="/files/gYeYcZFDaHBaTBwinTZb" alt=""><figcaption></figcaption></figure>

Each request type can be configured to conditionally return different response codes and models when an API call is made to that endpoint with that request type. This can be helpful when you want to mimic unexpected response like it may happen in a real world scenario to see how your application handles it.

For eg: Let's say an expected response will be to return a 200 response code with a User model as response data, other responses can be added for a 404 Not-Found response, 401 Unauthorized or 500 Internal Server Error, so that any of this responses will return randomly when an API call is made for this endpoint and request type.

The probability of each response returning can be configured by clicking on the *Settings* button beside the model selection input. Clicking on the *Settings* button will open an *Advanced Configuration* dialog box where the Return rate for that response can be set. The higher the response rate, the higher chance of that response returning for each API call.

The response can be returned as an array or list of the selected model along with the size of list to return. This can also be set from the *Advanced Configuration* dialog box.


# Authentication Guide

This guide will help you understand the different ways you can authenticate your API requests. We support multiple methods to ensure flexibility and ease of integration. Below are the detailed methods and examples of how to use them.

#### 1. API Key in Query Parameters

You can include your API key directly in the query parameters of your API request.

**Example:**

```sh
curl -X GET "https://api.mockapi.com/your/endpoint?api_key=YOUR-API-KEY"
```

#### 2. API Key in Headers

You can also include your API key in the headers of your request. This method is more secure than including the key in the query parameters.

**Custom Header (`x-api-key`):**

```bash
curl -X GET https://api.mockapi.com/your/endpoint -H "x-api-key: YOUR-API-KEY"
```

#### 3. Bearer Token in Authorization Header

Using a Bearer token in the `Authorization` header is a widely used method for authentication. You can include your API key as a Bearer token.

**Example:**

```sh
curl -X GET https://api.mockapi.com/your/endpoint -H "Authorization: Bearer YOUR-API-KEY"
```

#### 4. API Key in Request Body

Although less common and not recommended for GET requests, you can pass the API key in the body of POST requests.

**Example:**

```sh
curl -X POST https://api.mockapi.com/your/endpoint -d '{"api_key": "YOUR-API-KEY"}' -H "Content-Type: application/json"
```

#### Choosing the Right Authentication Method

* **Query Parameters**: Quick and easy for testing or when making simple API calls from a browser. However, it's less secure since the API key is exposed in the URL.
* **Headers (`x-api-key`)**: More secure than query parameters. Recommended for production use.
* **Bearer Token**: Standard practice for modern APIs. Use this method if you are integrating with systems that already use Bearer tokens.
* **Request Body**: Useful for POST requests where including the key in the body is necessary. Not recommended for GET requests due to security concerns.

**Tip**: If you already use a specific authentication method in your application to make request on your production server, try to use the same method in your [MockAPI](https://mockapi.com) so you only need to change the base URL and the API Key when making request to each one.

#### Additional Security Tips

* **Use HTTPS**: Always use HTTPS to encrypt your API requests and responses.
* **Keep API Keys Secret**: Never expose your API keys in public repositories, client-side code, or public forums.
* **Rotate Keys Regularly**: Periodically change your [API keys](/project#api-key) to minimize the risk of them being compromised.

#### Troubleshooting

* **401 Unauthorized**: Ensure your API key is correct and included in the request using one of the supported methods.
* **403 Forbidden**: Your API key might be valid but lacks the necessary permissions to access the requested resource.
* **404 Not Found**: Check the endpoint URL for typos or errors.

***

By following this guide, you can securely authenticate your requests to MockAPI and ensure smooth integration with our services.


# Import

MockAPI allows for quick and easy importation of your existing Schemas and Endpoints. We currently support [OpenAPI Documents](https://www.openapis.org/) and [Postman Collections](https://www.postman.com/collection/).

During import, the schema and endpoints will be created automatically on the current project.

To navigate to the [import page](https://mockapi.com/Import), click on the `Import` link from the menu.

<figure><img src="/files/pTgbt9Rua5Hknds8xb2t" alt=""><figcaption><p>Import page</p></figcaption></figure>


# OpenAPI

MockAPI support OpenAPI document import. This allows users to seamlessly create endpoints, models and other configurations within the OpenAPI document within a MockAPI project.

The import only supports JSON and XML file formats and must contain valid OpenAPI specification content.

To import your OpenAPI document, go to the [***Import***](https://mockapi.com/Import) page and click on the [***OpenAPI***](https://mockapi.com/Import/OpenAPI) link. On the page, kindly click or drag and drop the file on the upload section of the page.

When your import is completed, your endpoints and models and other configurations will have successfully created.

<figure><img src="/files/c9vDyv7k4nuLNa92k1S4" alt=""><figcaption><p>OpenAPI Document import</p></figcaption></figure>


# Postman

MockAPI support Postman collection import. This allows users to seamlessly create models and other configurations within the Postman collection within a MockAPI project.

The import only supports JSON file format and must contain valid content.

To import your Postman collection, go to the [***Import***](https://mockapi.com/Import) page and click on the [***Postman***](https://mockapi.com/Import/Postman) link. On the page, kindly click or drag and drop the file on the upload section of the page.

When your import is completed, your models and other configurations will have successfully created.

<figure><img src="/files/DD7guzvFE8bmFReGoQoJ" alt=""><figcaption><p>Postman Collection import</p></figcaption></figure>


# Account

Update your account by navigating to your [profile page](https://mockapi.com/Account/Profile).&#x20;

<figure><img src="/files/cu823hJcTumSq3hX8hPE" alt=""><figcaption><p>Update profile page</p></figcaption></figure>

To delete your account, click on the `Delete Account` link on the profile page.

<figure><img src="/files/AsWKOFmEXgCwFCAuTkd2" alt=""><figcaption><p>Account deletion</p></figcaption></figure>


# Subscription

Our subscription model is tiered according to usage and privileges but there's an always free tier for individuals who wants to try our product and can upgrade later to the tier that most suites them.

Upgrading your account will upgrade all your created projects which will also extend to any user invited to those projects regardless of if they have an upgraded account or not.

To upgrade your account, click on the `upgrade` button at the menu of your dashboard which will take you to the [plan selection page](https://mockapi.com/Payment/Plans).

<figure><img src="/files/AHIfv1rkZ2GB5eYnmqTi" alt=""><figcaption><p>Upgrade your account</p></figcaption></figure>

To cancel your subscription anytime, go to your profile and click on the `Cancel Subscription` button on the page.

<figure><img src="/files/ncYKUg4nnYyEkoEc5RUk" alt=""><figcaption><p>Cancel Subscription</p></figcaption></figure>

After cancelling your subscription, you will still be able to continue on your plan until the end of the subscription period. For eg: If you subscribed to a monthly `Standard` plan on 20th of April and cancelled on 1st of May, you will still be subscribed to the `Standard` plan until the 20th of May which marks the end of your subscription period.

If you experience any issue with subscription, please do not hesitate to contact us from the live chat icon at the bottom right of the page.


