Skip to content

Authentication

If you are accessing our product programatically, the following options are available to successfully authenticate.

Note

If you are using our Python SDK, please see the Python SDK Docs

Using OAuth Credentials

The Azure CLI simplifies the process of acquiring an access token that can be used when making requests.

Azure CLI Prerequisites

  1. Follow the How to install the Azure CLI if you haven't installed it yet.
  2. Once you have a valid installation make sure you have logged in, specifying the correct scope:
    az login --scope api://app.optimeering.com/.default --allow-no-subscriptions
    

Acquiring a Token Using the Azure CLI

  1. To acquire an access token:
    export ACCESS_TOKEN=$(az account get-access-token --resource api://app.optimeering.com --query "[accessToken]" -o tsv)
    
  2. You can now use the ACCESS_TOKEN in the Bearer token when making requess to the API, for example:

    curl -s --header "Authorization: Bearer $ACCESS_TOKEN" "https://app.optimeering.com/api/predictions/series/?limit=2"
    

    Tip

    If you have jq installed in your shell you can get a well formatted response by piping the curl response to jq:

    curl -s --header "Authorization: Bearer $ACCESS_TOKEN" "https://app.optimeering.com/api/predictions/series/?limit=2" | jq .
    

Using an API Key

API Keys are useful for machine to machine scenarios, such as data processing jobs.

Obtaining an API Key

You can create an API Key through our Api Docs. See the video below for a detailed walk through:

Tip

If you remove the expires_at argument you will get an API Key valid for a year from today.

Making Requests

You can use the API key to authenticate a request by including it in the request headers. The header key is apikey. For example with Curl:

curl -s --header "apikey: $APIKEY" "https://app.optimeering.com/api/predictions/series/?limit=2"
Powered by the Engineering Team