Get Started

Configuring API Endpoints For Gateway

Learn how to set up API endpoints in SuperAPI's gateway for intelligent caching

After connecting your database to SuperAPI, the next step is to configure your API endpoints. This tells SuperAPI which routes to cache and how they relate to your database tables.

Endpoint Types in SuperAPI

SuperAPI supports two types of endpoints that work together to create an intelligent caching system:

  1. Cached API Endpoints: These are typically GET requests that retrieve information from your database. SuperAPI will cache the responses to these endpoints.

  2. Invalidate API Endpoints: These are typically POST, PUT, PATCH, or DELETE requests that modify your database. When these endpoints are called, SuperAPI will invalidate related cached responses.

Configure both types of endpoints to get the most out of SuperAPI. Cache endpoints that return data and set up invalidation endpoints that modify that data.

Adding a New Endpoint

Navigate to the "Endpoints" tab in your application dashboard

Click the "+ Add Endpoint" button in the top right corner

Enter the API details:

  • Host: Your API hostname (e.g., https://api.stripe.com)
  • Method: Select the HTTP method (GET, POST, PUT, PATCH, DELETE)
  • Path: The endpoint path, including:
    • Path parameters with colons (e.g., /v2/customers/:id/orders)
    • Query parameters with empty angle brackets (e.g., /v2/customers/:id/orders?order_id=<>)
  • Nickname: A descriptive name for this endpoint (e.g., stripe-platform)

For path parameters, use a colon (:) before the parameter name. For query parameters, use the format parameter=<> where the angle brackets indicate a variable value. Always use empty angle brackets <> for query parameter values, not actual values.

Configure authentication (if required):

SuperAPI supports two authentication methods:

  • JWT Bearer Token: For APIs secured with JSON Web Tokens
  • Unauthenticated: For public endpoints that don't require authentication

Select the cache type:

  • Cached API: Choose this for endpoints that retrieve data (typically GET requests)
  • Invalidate API: Choose this for endpoints that modify data (typically POST, PUT, etc.)

For Cached API endpoints, configure caching details:

  • TTL (Time-to-Live): Enter the number of seconds the cache should be valid (e.g., 7200 for 2 hours)
  • Root Table: Select the primary database table that this endpoint queries
  • Tables of Interest: Select all database tables that affect this endpoint's response

Only tables you've configured in your database connection will appear in the dropdown. If a required table is missing, you'll need to add it to your database configuration first.

Configure parameter relationships:

Map your API parameters to database fields to tell SuperAPI how they relate:

  • Parameter: The path or query parameter from your API (e.g., id)
  • Operation: How the parameter relates to the database field (==, !=, or ignore)
  • Value: Select the database table and column to map to this parameter (e.g., public.customer.id). Only Primary Key and Foreign Key columns will be available in the dropdown.

For a detailed explanation of parameter relationships and how they enable intelligent cache invalidation, refer to our Configuring API Endpoints in SuperAPI guide.

Click "Save" to create your endpoint

Next Steps

After configuring your endpoints, deploy your gateway from the "Gateway" tab in your SuperAPI dashboard. Once deployed, you can test your cache to ensure it's working correctly.

Remember that the Deploy button will only become active after you've successfully configured both a database connection and at least one endpoint.

Next: Test Your Cache

Learn how to verify your SuperAPI caching is working correctly with a quick test

On this page