Forge API

Documentation

Getting Started

Create your first hosted mock REST API with Forge API in just a few minutes. Define an endpoint, add a JSON response and call the generated URL from your browser or application. Paid plans can also protect endpoints with required secret request headers.

Estimated time: 2 minutesDifficulty: BeginnerRequirement: Free Forge API account

Protect your mock API with a secret header

Paid plans can require a custom request header before Forge API returns the endpoint response. This lets you share a mock API with authorised users without allowing requests that do not include your secret value.

Example protected request

x-api-key: your-secret-value

Requests with a missing or incorrect header are rejected. View paid plans to enable request-header protection.

The fastest way to begin

You can generate an endpoint directly from the Forge API homepage. Once you are signed in, Forge API can automatically create a project and save the endpoint to your account.
1

Create or select a project

Projects organise related endpoints and provide the public project key used in your generated API URLs.

Open your Forge API dashboard and select New project. Enter a name such as Online Store.

Forge API assigns the project a public key similar to:

text
p_your_project_key

Project keys

The project key forms part of every public endpoint URL in that project. Treat the example key in this guide as a placeholder and replace it with your real project key.
2

Create an endpoint

An endpoint combines an HTTP method, a path and the response that Forge API should return.

Inside your project, create a new endpoint using:

Method
GET
Path
/products
Status code
200

Endpoint paths should begin with a forward slash. Nested paths are also supported, for example:

text
/products
/products/featured
/users/profile
3

Add the JSON response

Define the exact JSON your frontend should receive when it calls the endpoint.

Paste the following example into the JSON response editor:

products.jsonJSON
[
  {
    "id": 1,
    "name": "Polo Shirt",
    "size": "M",
    "price": 10,
    "stock": 24
  },
  {
    "id": 2,
    "name": "Classic Hoodie",
    "size": "L",
    "price": 29.99,
    "stock": 12
  },
  {
    "id": 3,
    "name": "Slim Fit Jeans",
    "size": "32",
    "price": 39.99,
    "stock": 8
  }
]

Use realistic test data

Match the field names and data types expected by your application. This makes switching to the real backend easier because your frontend can continue using the same response structure.
4

Save the endpoint

Save the endpoint to make the public URL available immediately.

Select Create endpoint or Save endpoint, depending on where you created it.

Your public URL will follow this structure:

URL
https://apis.getforgeapi.com/p_your_project_key/products

Your API is live

Once saved, the endpoint can be called from a browser, frontend application, mobile app, automated test or API client.
5

Call the endpoint

Test the generated URL and confirm that it returns the configured response.

Use a browser

Because this example uses GET, you can paste the generated URL into your browser address bar.

Use cURL

bash
curl https://apis.getforgeapi.com/p_your_project_key/products

Use JavaScript

products.tsTypeScript
const response = await fetch(
  "https://apis.getforgeapi.com/p_your_project_key/products"
);

if (!response.ok) {
  throw new Error(`Request failed: ${response.status}`);
}

const products = await response.json();

console.log(products);

The request returns the same products array configured in the endpoint response.

6

Continue building

You now have a working hosted mock API that can be expanded as your application grows.

Ready to build your first mock API?

Create an account, define your response and start using a hosted API URL without writing backend code.