Sometimes you need to interact with your Application or its data outside of Airkit. Application APIs at its core, are a way to build custom API endpoints and interact with Airkit from external systems, leveraging the available data operations to create Journeys, modify existing Journeys, validate data, or even read data from AirData.
An App API is a powerful method for integrating Airkit with other applications and services. It is how you can create a custom REST endpoints that are defined by you, through the use of combining and adding data operations together. With App APIs, you are able to create either a GET request or a POST request and can also configure your endpoint path, path parameters, and query parameters.
For a guide on how to build an App API, see Building an App API.
If the App API requires Authentication and should not be publicly available, a token must be created. The API token that gets generated is a JWT token. For this you will need an API key that can be generated from the Console (API > Tokens):
Make sure to safely store the generated token at that moment since it will not be retrievable after the window is closed. If the API key is lost, you can delete the API key and create a new one.
Once the token has been created in the Console, go to Settings and add the API Key in API Key Filtering.
This will make it appear under Authentication in Triggers > App APIs .
If you want to make an HTTP request to an App API that requires Authentication, this requires the request to include the token in the request header.
In the headers of the request, add:
Authorization: Bearer <Your API token>
Upon creation, the token needs to be assigned an environment in multi-environment organizations. This would then make the API Token only accessible to developers who have access to the corresponding environment. For example, if a developer created an API token in the development environment, then that API Token can only be used for an API created in the development environment.
For more information see Environments.
When using an App API to redirect to a URL it is recommended to use the
302 response status code instead of
301s are cached by the browser which may result in unintended behavior.
Data passed as a request payload for App APIs have a maximum size of 5mb.
Updated 4 months ago
Interested in integrating other systems with Airkit and triggering off a journey with an HTTP request? Check out the tutorial below.