Getting StartedAuthenticating on the API

Authenticating on the API

Authenticate Apara API requests by creating a Basic Authentication header from your API credentials.

Step 1: Get API Credentials (From Apara Portal)

  1. Sign in to the Apara Portal.

  2. Copy your USERNAME.

  3. Copy your PASSWORD.

These credentials are required for every authenticated API request.

Step 2: Authenticate a request

  1. Combine your credentials in the format USERNAME:PASSWORD.

    Example:

    
    aparaUser:aparaPass
    
    
  2. Encode the combined string in Base64.

    Using:

    
    const axios = require("axios");
    
    const username = "aparaUser";
    
    const password = "aparaPass";
    
    const encoded = Buffer.from${username}:${password}).toString("base64");
    
    axios.get("https://sandbox-api.aparatech.io/v3/config/supported-currencies", {
    
      headers: {
    
        Authorization: Basic ${encoded},
    
        "Content-Type": "application/json"
    
      }
    
    })
    
    .then(res => console.log(res.data))
    
    .catch(err => console.error(err.response?.data));
    
    
    
    import requests
    
    import base64
    
    username = "aparaUser"
    
    password = "aparaPass"
    
    credentials = f"{username}:{password}"
    
    encoded = base64.b64encode(credentials.encode()).decode()
    
    url = "https://sandbox-api.aparatech.io/v3/config/supported-currencies"
    
    headers = {
    
        "Authorization": f"Basic {encoded}",
    
        "Content-Type": "application/json"
    
    }
    
    response = requests.get(url, headers=headers)
    
    print(response.json())
    
    

    Expected output: YXBhcmFVc2VyOmFwYXJhUGFzcw==

  1. Add the encoded value to the Authorization header with the Basic prefix.

    
    Authorization: Basic YXBhcmFVc2VyOmFwYXJhUGFzcw==
    
    
  2. Send your API request with the Authorization header.

    Example:

    
    curl -X GET "https://sandbox-api.aparatech.io/v3/config/supported-currencies" \
    
      -H "Authorization: Basic YXBhcmFVc2VyOmFwYXJhUGFzcw==" \
    
      -H "Content-Type: application/json"
    
    

The response depends on the endpoint you call, but every authenticated request must include the same Basic Authentication header format.