Get Access and Refresh Token Using curl

The quickest way to get an access token and a refresh token is to launch your terminal and run the following command:

Copy
Obtain Access and Refresh Tokens
curl --location --request POST 'https://yourcompany.searchunify.ai/oauth/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Basic {{authentication_code}}' \
--header 'Cache-Control: no-cache' \
--data-urlencode 'grant_type=password' \
--data-urlencode 'username={{youremail@searchunify.com' \
--data-urlencode 'password=yourpassword'

Prerequisite

In order to run the command, among other parameters, you need a client secret and client ID, both of which can be obtained by creating an app inside your SearchUnify instance. Check out Get Client ID and Client Secret with an API App for instructions.

Parameters

There are three parameters in the endpoint URL.

  1. Instance URL ({{hostname}}). For instance, yourcompany.searchunify.com.

  2. Your client ID and client secret ({{base64([clientID]:[clientSecret]}}). Concatenate the ID and secret, and encode the resulting string using Base64.

  3. SearchUnify log-in credentials (grant_type=password&username={{USERNAME}}). Enter the email and password used to log into your SearchUnify instance.

Generate Access Tokens Repeatedly

Once you have both refresh and access tokens, a more efficient way to generate access tokens repeatedly is to use the call described in Obtain an Access Token from a Refresh Token.

Last updatedThursday, April 25, 2024

Or, send us your review at help-feedback@searchunify.com