Local Api

In our platform, we provide a unique way for developers to make AJAX calls to any endpoint. By using a special header, x-local-api:true, a regular URL can respond with JSON formatted data, enabling developers to handle the response in their AJAX success callback.

How it Works:

When the x-local-api:true header is detected in a request, the server will interpret it as an AJAX request, even if the URL is typically used for standard page loads. This allows for dynamic handling of the response based on the request type.


Consider a URL like /form/submit. Under normal circumstances, when you submit a form to this URL, it processes the request and redirects the user based on the outcome. However, if you want to handle this process using AJAX:

  1. Make an AJAX request to /form/submit.
  2. Include the header x-local-api:true in your request.
  3. The server will recognize this as an AJAX request and return a JSON response instead of the typical page redirect.
  4. Use the JSON response in your AJAX success callback to update the page or inform the user.


  • Flexibility: Developers can choose between standard form submissions or AJAX-based submissions without needing separate endpoints.
  • Unified Endpoints: No need to maintain separate API endpoints for AJAX interactions. Use the same URL for both page loads and AJAX calls.
  • Error Handling: In case of errors, the JSON response can provide detailed information that can be used to inform the user or take corrective actions on the frontend.

Implementation Details:

Our backend has been designed to detect the presence of the x-local-api header in incoming requests. When this header is detected, the server dynamically switches the response type to cater to AJAX calls, returning data in a JSON format instead of the standard page response.


It's important to mention that not all URLs in our platform are currently "local-api friendly." We are actively working on enhancing more endpoints to support this feature. If there's a specific endpoint you'd like to see added with local-api support, please contact us, and we'll be happy to assist.

Last update: 14-Sep-2023

Top Top