Importing an API Source

Import an OpenAPI spec to create an API Source

To create an API store, you need to first connect your APIs to API.marketarrow-up-right.

When a user calls API.market, then API.market will call your APIs using the defined API Source and the 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.

circle-info

πŸ’‘ How it works: API.market proxies requests to your API using the OpenAPI specification. This allows API.market to handle authentication, billing, analytics, and rate limiting automatically.

πŸ“‹ Prerequisites

Before you begin, you'll need:

βœ… An OpenAPI specification file (YAML or JSON) βœ… Your API's base URL βœ… Authentication details (if required)

circle-exclamation

πŸš€ Step-by-Step Guide

1. Click on "OpenAPI Specs" on the left side menu under "Manage APIs".

Navigate to the Seller Console and select your organization from the dropdown. Then click on "Manage APIs" in the left sidebar and select "OpenAPI Specs" .

2. Click on the "Import API Source" button.

This wizard will pop up:

Click "Continue" to proceed after selecting "Yes, I have an OpenAPI schema".

circle-info

πŸ’‘ For now, we only support creating an API Source using an OpenAPI schema.

Need help? Check out this example OpenAPI schemaarrow-up-right.


3. Import the OpenAPI YAML or JSON file.

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

Step 4: Configure Custom Headers

After importing your OpenAPI file, proceed to Step 3: Configure API Headers. Here you can add custom headers that will 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:

Note: If you don't need custom headers, you can leave this as {} (empty JSON object) and proceed.

Step 5: Configure Base Path URL

Click "Continue" to proceed , here you'll set the base URL for all API requests.

  1. The Base URL field may be pre-filled if detected from your OpenAPI spec's servers section

  2. Review or enter your API's base URL

  3. Format: https://api.example.com/v1

  4. This URL will be used as the base for all API requests

Example:

Step 6: Configure Authentication

Click "Continue" to proceed . Here you'll choose how your API authenticates requests. This is the endpoint API.market backend will call.

You have five authentication options:

Option 1: No Authentication

  • Select the "None" tab

  • No authentication will be used when making API requests

  • Use this if your API doesn't require authentication

Option 2: API Key Authentication

  • Select the "API Key" tab

  • Enter the Header Name (e.g., X-API-Key, Authorization)

  • Enter the API Key Value (this will be masked for security)

  • The API key will be sent in the specified header with each request

Example:

  • Header Name: X-API-Key

  • API Key Value: your-secret-api-key

Option 3: Bearer Token Authentication

  • Select the "Bearer Token" tab

  • Enter your bearer token (this will be masked for security)

  • The token will be sent in the Authorization header as Bearer <token>

Example:

  • Token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

Option 4: Basic Authentication

  • Select the "Basic Auth" tab

  • Enter your Username

  • Enter your Password (this will be masked for security)

  • Credentials will be base64 encoded and sent in the Authorization header

Example:

  • Username: myuser

  • Password: mypassword

Option 5: Query Parameter Authentication

  • Select the "Query Param" tab

  • Enter the Parameter Key (e.g., api_key, token)

  • Enter the Parameter Value (this will be masked for security)

  • The parameter will be added to the query string of each request

Example:

  • Param Key: api_key

  • Param Value: your-api-key-value

Step 7: Review Summary and Create

Click "Continue" to proceed .Here you'll review all your configuration before creating the API Source.

The summary will show:

  • 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 authentication method and configuration

  • Endpoints - List of all detected endpoints

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

  1. Review the summary carefully to ensure all details are correct

  2. Click "Create API Source" or "Finish" button

  3. Your API Source will be created and you'll be redirected to the API Sources list

  4. You should see your new API Source in the list

Success! Your API Source is now ready to be used when creating products.


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 API endpoints

  3. Test Your APIs - Use the API Playground to test your endpoints

  4. View Analytics - Monitor usage and performance


Troubleshooting

Common Issues

Issue: "No endpoints found"

  • Solution: Check that your OpenAPI spec has a paths object with at least one endpoint defined

Issue: "Invalid JSON/YAML"

Issue: "Base URL not detected"

  • Solution: Make sure your OpenAPI spec includes a servers array with at least one server URL, or manually enter it in Step 6

Issue: "Authentication not working"

  • Solution:

    • Verify your authentication credentials are correct

    • Check that the header name matches what your API expects

    • Ensure the authentication type matches your API's requirements


Best Practices

  1. Validate Your OpenAPI Spec - Use tools like Swagger Editor to validate your spec before importing

  2. Test Authentication - After creating your API Source, test it with a sample request to ensure authentication works

  3. Use Descriptive Names - Choose clear API Source names that help you identify them later

  4. Document Custom Headers - Keep track of what custom headers you're using and why

  5. Version Your APIs - Use semantic versioning in your API version field (e.g., 1.0.0, 2.1.3)


Last updated