🌬️
AirQL Docs
  • ⭐Getting started
    • Adding a base
    • Configuring access
    • Calling the API
  • 💡User guide
    • GraphQL base API
    • Users, roles, & access control
    • Rate limits
Powered by GitBook
On this page
  • Authentication
  • The base API endpoint
  1. Getting started

Calling the API

PreviousConfiguring accessNextUser guide

Last updated 2 years ago

Once you've added a base and configured access to it, you'll want to call the base API from your app.

Authentication

AirQL uses OAuth to authenticate API requests. We recommend that you use an OAuth2 client implementation appropriate for your language (e.g. , , etc.) with the following configuration:

Authorization endpoint

https://api.airql.dev/oauth2/authorize

Token endpoint

https://api.airql.dev/oauth2/token

Client ID

Your BASE_ID (e.g. appGSRaZVwoOoAbQB)

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 base API endpoint

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.

echo '{"query":"{ employees { records { name } } }"}' | \
  curl https://api.airql.dev/base/appGSRaZVwoOoAbQB \
  -H 'Authorization: Bearer YOUR_AUTH_TOKEN' \
  -H 'Content-Type: application/json' \
  -X POST -d @-

To make GraphQL API calls from a custom web app, we recommend using a library like or .

⭐
NextAuth.js
github.com/golang/oauth2
graphql-request
github.com/shurcooL/graphql