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:
-
Cached API Endpoints: These are typically GET requests that retrieve information from your database. SuperAPI will cache the responses to these endpoints.
-
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=<>
)
- Path parameters with colons (e.g.,
- 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: The database table and column this parameter corresponds to (e.g.,
public.customer.id
)
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, the final step is to deploy your gateway. Return to the "Gateway" tab in your SuperAPI dashboard, where you'll find the "Deploy" button for your application. Once deployed, you can start enjoying the performance benefits of SuperAPI's intelligent caching.
Remember that the Deploy button will only become active after you've successfully configured both a database connection and at least one endpoint.
Next: Monitoring Metrics
Learn how to track the performance of your cached API endpoints