Comment on page


Authenticate with API Key
Alphamoon Workspace API uses API keys to authenticate requests.
To authorize your API calls, you can choose between two methods: using the API key in the request header or using the API key in Basic Auth. Choose the method that best suits your requirements and follow the instructions below.

Using Basic Auth

API key Basic Auth allows a user agent, such as a web browser, to provide credentials to the server in order to access protected resources.
Here's an example of Basic Authentication requests using the Alphamoon Workspace API key:
curl -u "API_KEY"
import requests
basic = requests.auth.HTTPBasicAuth('user', 'pass')
resp = requests.get(url=GET_PROCESSES_URL, auth=basic)
Replace API_KEY in the request above with the value of the Your new API key field.

Using the API key in the request header

To include the API key in your API calls using Basic Auth, follow these steps:
  • Set the Authorization header in your HTTP requests.
  • The header value should be in the format: Basic BASE64_ENCODED_API_KEY, where BASE64_ENCODED_API_KEY is the Base64 encoding of the string API_KEY.
  • Send your API request to the appropriate endpoint.
Take a look at the example:
curl -H "Authorization: Basic API_KEY_BASE64_ENCODED"
import requests
import base64
api_key = 'user:pass'.encode('ascii')
api_key_base64_encoded = base64.b64encode(api_key).decode('ascii')
headers={"Authorization": f"Basic {api_key_base64_encoded}"}
resp = requests.get(url=GET_PROCESSES_URL, headers=headers)
To encode the credentials, you can use a tool like base64 in Linux or macOS, or an online Base64 encoding tool.
Replace BASE64_ENCODED_API_KEY with the Base64-encoded value of the Your new API key field.

See next: