Skip to content

Getting started

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

Video tutorial: Your first mock API, 2:20Watch on YouTube

Step 1: create an account

Visit the registration page and sign up with your email address, or use Google or GitHub on the sign-in page.

  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 letter, 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 or GitHub 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 Image 128x128
    • createdAt: type Datetime
  4. 4

    Save your model

    Click "Create model" to save it. 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 from step 3
    • Array response: Turn it on and set Array size to 10 (returns an array of 10 users)
    • Return rate: 100 (always return this response)
  4. 4

    Save the endpoint

    Click "Create endpoint" to save it.

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: