> For the complete documentation index, see [llms.txt](https://docs.api.market/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.api.market/seller-docs/importing-an-api-source.md).

# Importing an API Source

Import an OpenAPI spec to create an API Source

To create an API store, you first connect your APIs to [API.market](https://api.market/). When a user calls API.market, the platform calls your API using the API Source you define and its configuration.

#### 🎯 Overview

The **API Source** is the OpenAPI specification that connects your APIs to API.market. API.market acts as an API gateway, making your API available through a unified platform.

{% hint style="info" %}
💡 **How it works:** API.market proxies requests to your API using the OpenAPI specification. This lets API.market handle authentication, billing, analytics, and rate limiting automatically.
{% endhint %}

#### 📋 Prerequisites

Before you begin, you will need:

✅ An OpenAPI specification file (YAML or JSON)\
✅ Your API's base URL\
✅ Authentication details (if required)

{% hint style="warning" %}
⚠️ **Don't have an OpenAPI spec yet?** You can create one using ChatGPT. Follow our guide: [Create OpenAPI spec using ChatGPT](/fundamentals/create-openapi-spec-using-chatgpt.md)
{% endhint %}

#### 🚀 Step-by-step guide

**Step 1 — Open "OpenAPI Specs"**

Go to the Seller Console and select your organization from the dropdown. Then click **"Manage APIs"** in the left sidebar and select **"OpenAPI Specs"**.<br>

<div data-with-frame="true"><figure><img src="https://979396929-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJpzXHBiEL3zWqYljGVxS%2Fuploads%2Ff3whygFttjVblF6senSF%2Fimage.png?alt=media&amp;token=285ce26d-6c30-4705-90cf-5de0a58e9419" alt=""><figcaption></figcaption></figure></div>

***

**Step 2 — Import the OpenAPI YAML or JSON file**

Upload or drag and drop your OpenAPI specification file. You should see the paths imported from the file.

<div data-with-frame="true"><figure><img src="https://979396929-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJpzXHBiEL3zWqYljGVxS%2Fuploads%2Fiur0HDYhFvXz4SwGxrPL%2Fimage.png?alt=media&amp;token=8a212139-55bc-46a0-ab8a-09765b40e004" alt=""><figcaption></figcaption></figure></div>

**Step 3 — Configure custom headers**

Next, add any custom headers that should be included in every API request to your backend.

1. Enter a JSON object in the text area.
2. Format: `{"Header-Name": "header-value"}`
3. Example:

```json
{
  "Content-Type": "application/json",
  "Accept": "application/json",
  "X-Custom-Header": "custom-value"
}
```

{% hint style="info" %}
💡 **No custom headers?** Leave this as `{}` (an empty JSON object) and continue.
{% endhint %}

<div data-with-frame="true"><figure><img src="https://979396929-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJpzXHBiEL3zWqYljGVxS%2Fuploads%2FZvP0F3hOf3vmdtX9lORA%2Fimage.png?alt=media&amp;token=4265cb5f-f317-4dea-ba50-0a9bdcdaa6c6" alt=""><figcaption></figcaption></figure></div>

**Step 4 — Configure base path URL**

Set the base URL for all API requests. This is the root address API.market will call.

1. The field may be pre-filled if a `servers` entry was detected in your OpenAPI spec.
2. Review or enter your API's base URL.
3. Format: `https://api.example.com/v1`
4. This URL is used as the base for every API request.

**Example:**

```
https://api.example.com/v1
```

<div data-with-frame="true"><figure><img src="https://979396929-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJpzXHBiEL3zWqYljGVxS%2Fuploads%2F3SoXrjGwVtKZOlfHGmdB%2Fimage.png?alt=media&amp;token=38e01118-de64-42a9-9e34-bec42d708025" alt=""><figcaption></figcaption></figure></div>

**Step 5 — Configure authentication**

Choose how API.market authenticates with your backend when it forwards a request. You have five options.

**Option 1 — No authentication**

* Select the **"None"** tab.
* No authentication is used when making API requests.

<div data-with-frame="true"><figure><img src="https://979396929-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJpzXHBiEL3zWqYljGVxS%2Fuploads%2F5d81Sd8AyqvJsm461iMr%2Fimage.png?alt=media&amp;token=ae12523b-9419-4c12-8208-c3221c476379" alt=""><figcaption></figcaption></figure></div>

**Option 2 — API Key**

* Select the **"API Key"** tab.
* Enter the **Header Name** (e.g. `X-API-Key`, `Authorization`).
* Enter the **API Key Value** (masked for security).
* The API key is sent in the specified header with each request.

*Example —* Header Name: `X-API-Key` · API Key Value: `your-secret-api-key`

<div data-with-frame="true"><figure><img src="https://979396929-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJpzXHBiEL3zWqYljGVxS%2Fuploads%2FSnMgcmyLNUdPh6oVYnsS%2Fimage.png?alt=media&amp;token=ce332742-4aed-43f9-a0f3-0a8a6ce019c2" alt=""><figcaption></figcaption></figure></div>

**Option 3 — Bearer Token**

* Select the **"Bearer Token"** tab.
* Enter your bearer token (masked for security).
* The token is sent in the `Authorization` header as `Bearer <token>`.

*Example —* Token: `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...`&#x20;

<div data-with-frame="true"><figure><img src="https://979396929-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJpzXHBiEL3zWqYljGVxS%2Fuploads%2FiGXJV31dgNicrK9AQccb%2Fimage.png?alt=media&amp;token=911d8e9b-cac2-4aca-881b-0b9ffb9ae1bb" alt=""><figcaption></figcaption></figure></div>

**Option 4 — Basic Auth**

* Select the **"Basic Auth"** tab.
* Enter your **Username** and **Password** (masked for security).
* Credentials are base64 encoded and sent in the `Authorization` header.

*Example —* Username: `myuser` · Password: `mypassword`&#x20;

<div data-with-frame="true"><figure><img src="https://979396929-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJpzXHBiEL3zWqYljGVxS%2Fuploads%2FDJTJN1tNmX66t6l9UPrr%2Fimage.png?alt=media&amp;token=13941f14-9a25-4bd8-813b-fd67ab665342" alt=""><figcaption></figcaption></figure></div>

**Option 5 — Query Parameter**

* Select the **"Query Param"** tab.
* Enter the **Parameter Key** (e.g. `api_key`, `token`).
* Enter the **Parameter Value** (masked for security).
* The parameter is added to the query string of each request.

*Example —* Param Key: `api_key` · Param Value: `your-api-key-value`

<div data-with-frame="true"><figure><img src="https://979396929-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJpzXHBiEL3zWqYljGVxS%2Fuploads%2FBsj3kXaKf9mHKgcE2LqZ%2Fimage.png?alt=media&amp;token=9e692776-1b89-4051-8a8f-7c1f85968816" alt=""><figcaption></figcaption></figure></div>

{% hint style="warning" %}
🔒 **Security:** Your backend credentials are stored securely and never shown to your customers. Customers authenticate with API.market using their own key.
{% endhint %}

**Step 6 — Review summary and create**

Review all your configuration before creating the API Source. The summary shows:

* **API Source Name** — the detected or entered name
* **API Version** — the detected version
* **Base URL** — the configured base URL
* **Custom Headers** — the JSON object of custom headers
* **Authentication** — the selected method and configuration
* **Endpoints** — the list of all detected endpoints

<figure><img src="https://979396929-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJpzXHBiEL3zWqYljGVxS%2Fuploads%2FQZKpI2dl8QWPqO5puFXB%2Fimage.png?alt=media&amp;token=81a0fedc-63a8-4f74-8c67-9b72faa4cb40" alt=""><figcaption></figcaption></figure>

**Review checklist:**

* ✅ API name and version are correct
* ✅ Base URL is correct
* ✅ Custom headers are properly formatted
* ✅ Authentication is configured correctly
* ✅ All expected endpoints are listed

Then click **"Create API Source"**. Your API Source is created and you are taken back to the API Sources list, where you should see it appear.

{% hint style="success" %}
🎉 **Success!** Your API Source is ready to use when creating products.
{% endhint %}

***

#### ✅ What's next?

After importing your API Source, you can:

1. **Create products** — use your API Source to create API products
2. **Configure pricing plans** — set up pricing for your endpoints
3. **Test your APIs** — use the API Playground to test your endpoints
4. **View analytics** — monitor usage and performance

***

#### 🛠️ Troubleshooting

**"No endpoints found"**\
Check that your OpenAPI spec has a `paths` object with at least one endpoint defined.

**"Invalid JSON/YAML"**\
Validate your OpenAPI spec with an online tool such as [Swagger Editor](https://editor.swagger.io/).

**"Base URL not detected"**\
Make sure your spec includes a `servers` array with at least one URL, or enter it manually in Step 5.

**"Authentication not working"**\
Verify your credentials are correct, check that the header name matches what your API expects, and confirm the authentication type matches your API's requirements.

***

#### 💡 Best practices

1. **Validate your OpenAPI spec** — use tools like Swagger Editor before importing.
2. **Test authentication** — after creating your source, test it with a sample request.
3. **Use descriptive names** — pick clear API Source names you can identify later.
4. **Document custom headers** — keep track of what headers you use and why.
5. **Version your APIs** — use semantic versioning (e.g. `1.0.0`, `2.1.3`).

***

**Next →** [What Is an API Product](/what-are-api-products.md)
