Help converting an API call from CURL to YAML

Hi, I am trying to get the syntax correct for an API call to my household battery API. I can make the call from a Windows CMD line but I’m struggling to create the equivalent YAML syntax in my Sensors.YAML file. I’ve pasted below the CURL command that works and my attempt at the Sensors YAML. Any help will be hugely appreciated (the YouTube video I watched had the API call in one long HTTPS string, but I can’t seem to create that - plus I understand it’s not good practice to embed the API key in the HTTPs string.

CMD syntax:
curl -X GET “https://api.XXX.co.uk/v3/unit?customerAccountId=XXX” -H “accept: application/json” -H “x-api-key: xxxxx”

YAML attempt:

- platform: rest

    resource:  https://XXX.co.uk/v3/unit?customerAccountId=XXX

    headers:  

      Authorization: [API KEY]

    name:  "Battery SOC"

    value_template: '{{ (value_json ["units"] [0] .id)}}'

    scan_interval: 300