Using Multiplay API authorization issue

I am trying to upload a dedicated server build to my Unity Gaming Services - Game Server Hosting.

I followed the documentation and made sure I have a key and secret from the services account and I made sure that I enabled everything for the Multiplayer roles. I have a script that always returns an error:

{
  "status": 401,
  "title": "Unauthorized",
  "requestId": "9fcac15a-21fc-4ea7-be8d-cf7d30181a7b",
  "detail": "Authentication Failed",
  "code": 51,
  "type": "https://services.docs.unity.com/docs/errors#51"
}

I am sure I am using the key and secret properly. I made sure to base64 them and use the result as my.

Is this the proper way to use this API or am I missing something?

#!/bin/bash

UNITY_API_KEY="MY_KEY"
SECRET_KEY="MY_SECRET"
PROJECT_ID="palceholder"
ENVIRONMENT_ID="placeholder"
BUILD_NAME="MainBuild"
BUILD_TYPE="FILE_UPLOAD"
OS_FAMILY="LINUX"

# Combine api_key and secret_key with a colon
UNITY_KEY="${UNITY_API_KEY}:${SECRET_KEY}"

# Base64 encode the Unity key
UNITY_KEY_BASE64=$(echo -n "$UNITY_KEY" | base64)

echo UNITY_KEY_BASE64

# Use the obtained access token in subsequent API request
curl -X POST "https://services.api.unity.com/multiplay/builds/v1/projects/$PROJECT_ID/environments/$ENVIRONMENT_ID/builds" \
     -H "Authorization: Bearer $UNITY_KEY_BASE64" \
     -H "Content-Type: application/json" \
     -d "{\"buildName\": \"$BUILD_NAME\", \"buildType\": \"$BUILD_TYPE\", \"osFamily\": \"$OS_FAMILY\"}"

# Pause for user input
read -p "Press Enter to continue..."