SummaryA description of the methods for authentication with the API (API Key and username/password).

The first step in almost every task is to connect to your Alooma system by creating an instance. In fact, all of the examples and tasks we'll cover in the documentation require this.

Alooma supports two methods for authentication: API Key and Username/Password. We recommend that you use API Key authentication even if you have usernames and passwords defined. The two methods are not exclusive but authentication will fail if you try to use both authentication methods in the same script.

API Key authentication

If you want to authenticate via key when using the Alooma API, you'll first need to generate a key. Click Generate Key on the API Key page available from the Settings page. IMPORTANT: Copy the key somewhere secure as this is the ONLY time the key will be displayed in the Alooma user interface.

Each user can only ever have one active key.


If you want to prevent the API key from working, you can revoke the current active key by clicking the Revoke Key button on the API Key page. Once you do, all API access using the current API key will be disallowed.


If you revoke your API key, you cannot re-enable it. You must create a new key. 

You can re-enable API key authentication by generating another key and then updating your existing authentication scripts/code.

To authenticate via API Key, you'll need to specify:

  • API Key

  • Account Name (optional)

 **** **** **** ******** **** **** ****
 **** Getting an Alooma API Object ****
 **** **** **** ******** **** **** ****
API_KEY = "7ef90863dd9b5ae1009b41b0c7542c020dc62e" # example
ACCOUNT_NAME = "alooma" # optional, depending on your deployment

## We will use this api object throughout the documentation ##
api = alooma.Client(api_key=API_KEY, account_name=ACCOUNT_NAME)
Username/Password authentication

Username/Password authentication is based on the Alooma users created in the User Management page. Once a user is created, to authenticate, you'll need to specify:

  • User Name

  • Password

  • Account Name (optional)

 **** **** **** ******** **** **** ****
 **** Getting an Alooma API Object ****
 **** **** **** ******** **** **** ****
import os
import alooma
## Using Environment Variables ##
ACCOUNT_NAME = '<DEPLOYMENT NAME>' # Used to specify which deployment to use if you have more than one

## We will use this api object throughout the documentation ##
api = alooma.Client(ALOOMA_USERNAME, ALOOMA_PASSWORD, account_name=ACCOUNT_NAME)
Passing credentials

You can provide your credentials in different ways: directly in the code, included via a module, exported environment variables, etc. For example, in unix/linux/macOS you can export the variables:

# for username/password
export ALOOMA_PASSWORD=myPassword

# or for API KEY authentication
export API_KEY=<your_api_key>
What's next?

Now that you can initialize the API and authenticate, you can move along to actually using the API to:

See the client reference for more information.

Search results

    No results found