--- title: "Custom APIs" description: "How to expose object metadata to non-Python 3rd party applications by mounting a custom Flask app alongside corridor-api." --- This helps create custom APIs to use for 3rd party integrations by using the [`corridor` package](/technology/customization/fetching-metadata/corridor-package/). The user would define additional flask-applications which would be mounted along with Corridor API. This option is useful if the 3rd party application is not python based, and therefore can't use the `corridor` package directly. ## Utility There are scenarios when the user wants to use a 3rd party application which fetches the details about the objects on the platform. To accomplish that, the user can create a simple `Flask` application, and register the corresponding APIs. These APIs would use the `corridor` package to fetch the required information. This new `FLASK` app would be mounted along with the `corridor-api` application, and we would internally register those API endpoints along with the rest of `corridor-api` endpoints. ## Example The example focuses on creating a `GET` api to fetch information about all the models to which a given user has access to. The 3rd party application can specify the `username` as part of the headers with the key: `x-user-name`. The endpoint in this case would be: `http://localhost:5000/{CUSTOM_APP_NAME}/models`, assuming `corridor-api` is running on port: 5000. The user can optionally provide `prefix` kwarg in the configurations, in which case the endpoint would become: `http://localhost:5000/{prefix}/models` ```python CUSTOM_APP_NAME = 'customtool' from flask import Flask, request custom_app = Flask(CUSTOM_APP_NAME) @app.route('/models', methods=['GET']) def models(): import corridor from corridor_api import AppUser username = request.headers.get('x-user-name') with AppUser(username): models = corridor.Model.models models_info = {} for model in models: model_obj = corridor.Model(name=model) model_id = model_obj.id models_info[model_id] = { 'modelId': model_id, 'modelName': model_obj.name, 'modelVersion': model_obj.version, 'modelType': model_obj.type, 'outputAlias': model_obj.output_alias, 'createdBy': model_obj.created_by, 'current_status': model_obj.current_status, } return {'result': models_info} ``` :::note The user, for which we want to fetch the information, needs to be passed in the headers. `AppUser` sets the user context for us, so that only the information accessible to that user is fetched. ::: ## Configurations Custom APIs related configurations need to be set in [`api_config.py`](/technology/installation/configuration-setup/api/) along with other configurations. ```python CUSTOM_APIS = { CUSTOM_APP_NAME: {'prefix': 'optional_prefix_to_add_to_the_endpoint', 'app': custom_app}, } ```