API Setup8 min read

How to Create an API in the Admin Panel

Complete guide to creating and configuring API endpoints in the admin panel. Learn about HTTP methods, headers, cookies, URL parameters, and payload schemas.

API to MCP Team

How to Create an API in the Admin Panel

APIs are the foundation of your MCP tools. This guide will show you how to create and configure API endpoints that your MCP tools can call.

Understanding APIs in This System

An API in this system represents a REST API endpoint that can be called by MCP tools. You configure:

  • The HTTP method and URL
  • Headers, cookies, and URL parameters
  • Payload schema for request validation
  • Enable/disable status

Creating Your First API

Step 1: Navigate to APIs Section

  1. Log in to the admin panel
  2. Navigate to the APIs section from the sidebar
  3. Click the Create API button

Step 2: Basic Configuration

Name and Description

  • Name: A descriptive name for your API (e.g., "Get Weather Data" or "Create Customer")
  • Description: Optional description to help you remember what this API does

HTTP Method

Select the HTTP method for your API:

  • GET: Retrieve data (no request body)
  • POST: Create new resources
  • PUT: Update entire resources
  • PATCH: Partial updates
  • DELETE: Remove resources
  • HEAD: Get headers only
  • OPTIONS: Get allowed methods

URL

Enter the full URL of your API endpoint:

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

Dynamic URLs: You can use variables in the URL that will be replaced with payload values:

https://api.example.com/users/{userId}/posts

The {userId} will be replaced with the value from the payload when the API is called.

Step 3: Headers Configuration

Headers are sent with every API request. Common use cases:

  • Authorization: Authorization: Bearer {token}
  • Content-Type: Content-Type: application/json
  • Custom headers: Any headers your API requires

Using Variables in Headers:

You can reference payload fields in header values using {variableName} syntax:

  • Bearer {token} - Will use the token field from the payload
  • application/json; charset={encoding} - Dynamic content type

Example:

  • Header name: Authorization
  • Header value: Bearer {apiKey}

When called with payload {apiKey: "abc123"}, the header becomes: Authorization: Bearer abc123

Step 4: Cookies Configuration

Configure cookies to be sent with API requests:

  • Cookie name: The name of the cookie
  • Cookie value: The value (can use variables like {sessionId})

Example:

  • Cookie name: session_id
  • Cookie value: {sessionId}

Step 5: URL Parameters

Add query string parameters to your API URL:

  • Parameter name: The query parameter name
  • Parameter value: The value (can use variables)

Example:

  • Parameter name: limit
  • Parameter value: {maxResults}

Results in: https://api.example.com/data?limit=10 (if maxResults is 10)

Step 6: Payload Schema (JSON Schema)

For POST, PUT, and PATCH requests, you can define a JSON Schema that describes the expected request body structure.

Example Schema:

{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Customer name"
    },
    "email": {
      "type": "string",
      "format": "email"
    },
    "age": {
      "type": "number",
      "minimum": 0
    }
  },
  "required": ["name", "email"]
}

Benefits of Payload Schema:

  • Documents the expected API structure
  • Helps with tool-to-API mapping
  • Provides validation guidance

Note: The schema is primarily for documentation and mapping purposes. Actual validation happens at the API level.

Step 7: Enable/Disable

Toggle to enable or disable the API:

  • Enabled: API can be called by MCP tools
  • Disabled: API will not be available for mapping

Complete Example

Here's a complete example of creating a weather API:

Name: Get Weather Data Method: GET URL: https://api.weather.com/v1/current Headers:

  • X-API-Key: {apiKey}
  • Accept: application/json

URL Parameters:

  • location: {city}
  • units: {unitSystem}

Payload Schema: Not needed for GET requests

Best Practices

  1. Use descriptive names: Make it clear what the API does
  2. Document with descriptions: Help yourself and others understand the API
  3. Use variables wisely: Leverage {variableName} for dynamic values
  4. Test your URLs: Ensure the URL format is correct before saving
  5. Organize by purpose: Group related APIs with similar naming

Common Patterns

Authentication

Bearer Token:

  • Header: Authorization
  • Value: Bearer {token}

API Key in Header:

  • Header: X-API-Key
  • Value: {apiKey}

Dynamic URLs

RESTful Resources:

https://api.example.com/users/{userId}/posts/{postId}

Query Parameters

Pagination:

  • page: {pageNumber}
  • limit: {pageSize}

Filtering:

  • status: {filterStatus}
  • sort: {sortOrder}

Troubleshooting

API not working?

  • Check the URL is correct and accessible
  • Verify headers are properly formatted
  • Ensure variables in URLs/headers match payload field names
  • Test the API endpoint directly first

Variables not replacing?

  • Ensure variable names match exactly (case-sensitive)
  • Check that the variable exists in the payload
  • Verify the syntax: {variableName} (with curly braces)

Next Steps

After creating your API:

  1. Create MCP Tools: Define tools that will use this API
  2. Map Tools to APIs: Connect tools to this API endpoint
  3. Test the Integration: Verify the end-to-end flow works

Conclusion

Creating APIs is straightforward once you understand the configuration options. The key is properly setting up headers, cookies, and URL parameters to match your API's requirements.

For more information, see our guides on configuring MCPs and MCP to API mapping.