Calling the API
Last updated
Last updated
Once you've added a base and configured access to it, you'll want to call the base API from your app.
AirQL uses OAuth to authenticate API requests. We recommend that you use an OAuth2 client implementation appropriate for your language (e.g. NextAuth.js, github.com/golang/oauth2, etc.) with the following configuration:
The access token returned by the token endpoint should be used as a bearer token in the Authorization
header when calling the base API.
The GraphQL API for your base is accessible at https://api.airql.dev/base/BASE_ID
where BASE_ID is the ID you see in Airtable URLs, e.g. appGSRaZVwoOoAbQB
.
You can explore this API from the Playground tab in the AirQL UI. For more information about the shape of the base API and the playground, see GraphQL base API.
Here's an example of making a simple GraphQL query using curl. Note the that you'll need to replace YOUR_AUTH_TOKEN
with a real OAuth token. The easiest way to get that is to look at the API calls made by the playground in your browser developer tools.
To make GraphQL API calls from a custom web app, we recommend using a library like graphql-request or github.com/shurcooL/graphql.
Authorization endpoint
https://api.airql.dev/oauth2/authorize
Token endpoint
https://api.airql.dev/oauth2/token
Client ID
Your BASE_ID
(e.g. appGSRaZVwoOoAbQB
)