Skip to content
Last updated

Askara API Quickstart Guide

Welcome, this quickstart guide will help you get started with Askara API, allowing you to make your first API call and begin exploring the possibilities offered by Askara API.

Step 1: Sign Up

An Askara account is needed for setting up an API access.

  1. Visit the Askara Sign-Up Page.
  2. Create your account and log in.
  3. Once you have successfully logged to your account, proceed to step 2.

Step 2: Create your application

Once your account is ready, you will need an application to gain access to the API through your profile or other users profiles. We use the OAuth2 Authorization Code flow to issue JWT (Json Web Tokens) to access the API.

  1. Contact us to get your app running and get a client_id and client_secret key pair.
  2. You will be asked to provide a redirect url pointing to a page on your application which will process the authorisation code.
  3. To authorize your application to access the API on a user behalf using OAuth Authorization Code flow, use the following authorization URL, adapt the client id and the redirect url and paste it in your browser: https://app.askara.ai/authorize?response_type=code&client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&state=example&scope=profile%20organization
  4. Authorize access and check if your page is handling the generated code correctly.
  5. Copy and keep your access token (and the refresh token) for querying the API.

Read more about the OAuth2 Authorization Code flow and how to set it up in your application.

Step 3: Make Your First API Request

Now that you have your access token, let's try to get your own account information using the API.

Calling the API

Use the following curl command:

curl -X POST https://api.askara.ai/me \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Response Example

{
  "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
  "email": "user@example.com",
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z",
  "firstName": "John",
  "lastName": "Doe",
  "gender": "male",
  "isVerified": true,
  "phone": null,
  "rpps": "11111111",
  "am": "22222222",
  "lastLoginAt": "2019-08-24T14:15:22Z",
  "lastSessionAt": "2019-08-24T14:15:22Z",
  "organizations": [
    {
      "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
      "streetAddress": "5 rue des Lilas",
      "postalCode": "67000",
      "city": "Strasbourg",
      "country": "FR",
      "phone": null,
      "secretariatEmail": "secretariat@john-dentiste.com",
      "website": "john-dentiste.com"
    }
  ]
}

This response confirms that you have access to the API through your own user account. Any user can authenticate with the API through your application, so you can setup a link between the two applications like that, and keep the access token and refresh token stored in your database. After the access token expires, you can renew it through the OAuth2 Refresh Token flow

Congratulations!

You’ve completed the setup of your app with Askara API ! Explore more advanced features in our documentation or join our community to connect with other users.