Get started with Aircall OAuth
Learn how Aircall OAuth flow works

Select a language:

    If you are building an integration with Aircall that accesses other peoples' Aircall data, then you will need to set up OAuth and understand how that can be done with Aircall. This tutorial will guide you through the Aircall OAuth flow, and show you how it works in few steps.

    1 - Create your Application on Aircall

    To get your app created on Aircall, please follow this link and sign up. We'll reach out to you with your client_id and client_secret.

    2 - Setting up OAuth

    Provide Information

    • Redirect URI

    It is the URL through which Aircall will send the authorization code for your user, once this user has authorized your app to access their data, or the error if any.

    All you have to do is communicate us the redirect url you have chosen.

    Redirect URIs must use HTTPS as they will communicate over SSL connection.

    3 - Get your Authorization Code

    To get your authorization code, you will need to redirect your user to the following URL:

    https://dashboard-v2.aircall.io/oauth/authorize?client_id=XXXX&redirect_uri=XXXX&response_type=code&scope=public_api

    The required parameters are :

    • client_id Provided by Aircall
    • redirect_uri (see above)
    • response_type The value must be code
    • scope The value must be public_api

    Optionally, you can also add :

    • state A string value created by your app to maintain state between the request and callback. This parameter should be used for preventing Cross-site Request Forgery and will be passed back to you, unchanged, in your redirect URI.

    After following this link, your user will be asked to consent to the permissions that your app is requesting (scope). Once they authorize your app, the user will be redirected back to the Redirect URI you provided earlier. You will receive an authorization code in the URL params that you will be able to trade for an access token.

    4 - Get an Access Token

    You can now exchange the authorization code for an Access Token with a POST request, as following :

      uri = URI.parse("https://api.aircall.io/v1/oauth/token")
      response = Net::HTTP.post_form(uri, {"code" => params[:code],
                                           "client_id" => "YOUR_CLIENT_ID",
                                           "client_secret" => "YOUR_CLIENT_SECRET",
                                           "grant_type" => "authorization_code",
                                           "redirect_uri" => "your_redirect_uri"})
    
      res = JSON.parse(response.body)
    
      # get the access token
      puts "ACCESS TOKEN: #{res["token"]}"
    

    Here is another way to do it :

    curl -X POST https://api.aircall.io/v1/oauth/token -H 'Content-Type: application/json' -d '{
        "grant_type": "authorization_code",
        "code": "YOUR_AUTHORIZATION_CODE",
        "redirect_uri":  "your_redirect_uri",
        "client_id": "YOUR_CLIENT_ID",
        "client_secret": "YOUR_CLIENT_SECRET"
    }'
    

    You should receive a similar payload :

      {
          "access_token": "2d492d492d492d492d492d492d492d492d492d49",
          "token_type": "Bearer",
          "created_at": 1545228401
      }
    

    5 - Use the Access Token

    You can now use the access token to make request on the public API. It might be useful to see how Aircall Public API works. Please follow this link to learn more about it.

    Here is an usage example:

    curl -i -H "Authorization: Bearer {YOUR_ACCESS_TOKEN}" -X GET https://api.aircall.io/v1/ping
    

    If everything goes right, then you should receive the following payload:

    { "ping": "pong" }
    

    We wrote other tutorials to help you out
    building awesome integrations

    Discover them now!