Maybe you were looking for the Enterprise Documentation instead?
Careful! You are browsing documentation for an outdated version of Kong. Go here to browse the documentation for the latest version.

Table of Contents

Adding your API

Before you start:
  1. Make sure you've installed Kong — It should only take a minute!
  2. Make sure you've started Kong.

In this section, you’ll be adding your API to the Kong layer. This is the first step to having Kong manage your API. Kong exposes a RESTful API for managing the details of your Kong instances.

1. Add your API using the RESTful API

Issue the following cURL request to add your first API ([Mockbin][mockbin]) to Kong:

$ curl -i -X POST \
  --url http://localhost:8001/apis/ \
  --data 'name=mockbin' \
  --data 'target_url=' \
  --data ''

**Note:** Kong handles API configuration requests on port `:8001`

2. Verify that your API has been added

You should see a similar response from the initial request:

HTTP/1.1 201 Created
Content-Type: application/json
Connection: keep-alive

  "public_dns": "",
  "target_url": "",
  "id": "2eec1cb2-7093-411a-c14e-42e67142d2c4",
  "created_at": 1428456369000,
  "name": "mockbin"

Kong is now aware of your API and ready to proxy requests.

3. Forward your requests through Kong

Issue the following cURL request to verify that Kong is properly forwarding requests to your API:

$ curl -i -X GET \
  --url http://localhost:8000/ \
  --header 'Host:'

A successful response means Kong is now forwarding requests to the `target_url` we passed in the first step and giving us the response back. Kong knows to do this through the header defined in the above cURL request:

  <li><strong>Host: &lt;public_dns></strong></li>

**Note:** Kong handles proxy requests on port `:8000`

Next Steps

Now that you’ve got your API added to Kong lets learn how to enable plugins.

Go to Enabling Plugins ›