Skip to content

Getting Started

Go from zero to a working mock API in under 5 minutes. This guide walks you through creating an account, setting up your first project, defining a data model, and making your first request.

Step 1: Create an Account

Visit the registration page and sign up with your email address or use one of the supported single sign-on providers (Google, GitHub, or Twitter).

  1. 1

    Enter your details

    Provide your first name, last name, and email address. Choose a password with at least 6 characters that includes a digit and a non-alphanumeric character.

  2. 2

    Confirm your email

    Check your inbox for a confirmation email from MockAPI. Click the link to verify your email address. If you don't see it, check your spam folder or request a resend from the confirmation page.

  3. 3

    Log in

    After confirming your email, log in with your credentials. You'll be taken to the dashboard where your first project is ready.

SSO Login

When using Google, GitHub, or Twitter SSO, your account is automatically created and confirmed. No email verification is needed.

Step 2: Create a Project

Projects are workspaces that hold all your models, endpoints, and configuration. Each project gets its own API key and is completely isolated. Learn more about projects in the Projects documentation.

  1. 1

    Navigate to Projects

    From the dashboard, click "New Project" or go to the project creation page.

  2. 2

    Name your project

    Enter a descriptive name (e.g., "E-Commerce API" or "Blog Backend"). Optionally add a description to help your team understand what this project is for.

  3. 3

    Choose your locale

    Select a locale to control the language and regional format of generated data. For example, choosing "de" generates German names and addresses, while "ja" generates Japanese data. Defaults to "en" (English).

Note

The Free plan allows up to 3 projects. See Plans & Billing for details on limits for each plan.

Step 3: Define a Data Model

Models describe the shape of the data your API returns. Each model has a name and a list of typed properties.

  1. 1

    Go to Models

    Click Models in the sidebar to view your project's models.

  2. 2

    Create a new model

    Click "New Model" and give it a name (e.g., "User").

  3. 3

    Add properties

    Add properties to define the structure of your data. For a "User" model, you might add: id (Type: Number, Sequential: enabled); firstName (Type: First Name); lastName (Type: Last Name); email (Type: Email); avatar (Type: Avatar); createdAt (Type: Date Time)

    • id: Type: Number, Sequential: enabled
    • firstName: Type: First Name
    • lastName: Type: Last Name
    • email: Type: Email
    • avatar: Type: Avatar
    • createdAt: Type: Date Time
  4. 4

    Save your model

    Click "Save" to create the model. MockAPI will use these property types to generate realistic sample data.

See Data Generation for the full list of 140+ property types available.

Step 4: Create a REST Endpoint

Endpoints define the URL paths and HTTP methods your mock API responds to. Each endpoint can return different responses based on the HTTP method used.

  1. 1

    Go to REST Endpoints

    Click REST Endpoints in the sidebar.

  2. 2

    Create a new endpoint

    Click "New Endpoint" and enter a path (e.g., /users). This will be the URL path clients use to access this endpoint.

  3. 3

    Configure the GET method

    Enable the GET method and add a response: Status Code: 200; Model: Select the "User" model you just created; Range: Enable range and set to 10 (returns an array of 10 users); Return Rate: 100 (always return this response)

    • Status Code: 200
    • Model: Select the "User" model you just created
    • Range: Enable range and set to 10 (returns an array of 10 users)
    • Return Rate: 100 (always return this response)
  4. 4

    Save the endpoint

    Click "Save" to create the endpoint.

Template endpoints

You can also create template endpoints with path parameters. For example, /users/{id} will match requests like /users/1 or /users/42. Template parameters are denoted by curly braces in the path. See the REST API documentation for more details on endpoint configuration.

Step 5: Make Your First Request

Every project has a unique API key that authenticates requests. You can find your API key in Settings → API Keys.

Find your API key

Navigate to Settings → API Keys in the sidebar. Your API key is displayed on the page (masked by default). Click "Show" to reveal it, or use the copy button to copy it to your clipboard.

Send a request

There are several ways to authenticate. The simplest is the x-api-key header:

Base URL

The base URL for REST endpoints is https://api.mockapi.com. Your endpoint path (e.g., /users) is appended to form the full URL.

cURL
curl -H "x-api-key: YOUR_API_KEY" \
  https://api.mockapi.com/users

Or using JavaScript:

JavaScript (fetch)
const response = await fetch('https://api.mockapi.com/users', {
  headers: {
    'x-api-key': 'YOUR_API_KEY'
  }
});

const users = await response.json();
console.log(users);
// Returns an array of 10 user objects with realistic data

Example response

Response (200 OK)
[
  {
    "id": 1,
    "firstName": "John",
    "lastName": "Doe",
    "email": "john.doe@example.com",
    "avatar": "https://cdn.mockapi.com/file/mockapi/avatars/avatar-1.jpg",
    "createdAt": "2025-08-15T14:30:00.000Z"
  },
  {
    "id": 2,
    "firstName": "Jane",
    "lastName": "Smith",
    "email": "jane.smith@example.com",
    "avatar": "https://cdn.mockapi.com/file/mockapi/avatars/avatar-2.jpg",
    "createdAt": "2025-09-21T09:15:00.000Z"
  }
]

Step 6: Test in the Playground

MockAPI includes a built-in API Playground where you can test your endpoints without leaving the dashboard. Navigate to Playground in the sidebar to try it out.

The Playground supports both REST and GraphQL requests, lets you configure custom headers and request bodies, and shows formatted response data with status codes and response times.

Read more in the API Playground documentation.

Next Steps

Now that you have a working mock API, explore these topics to get the most out of MockAPI: