Error code 7000 and 7003 while attempting to get all accounts, zones, and DNS recor

I want to get a list of all our Cloudflare accounts, zones, and DNS records for our asset management database. I want to export each of these into its own text file, so we can ingest it later. I have a bash script with functions for each of the GET requests I want to make. Each function calls the next when it runs, so it starts with fetching the accounts, then uses the account ID to fetch the respective zones, then uses the zone ID to fetch the respective DNS records, then the details for each record. When I run my script, I am getting error code 7000 and 7003. My user is Administrator Read Only for all of our accounts. I am using a global API key, and when I run individual GET requests for accounts, zones, DNS, I get a successful response. Here is my script; can someone assist?

#!/bin/bash

auth_email="[email protected]"
auth_key="myKey"


# Initialize output files
> cloudflare_account_ids.txt
> cloudflare_zone_ids_for_all_accounts.txt
> cloudflare_all_dns_records_for_all_zones.txt
> cloudflare_dns_record_details.txt

# Function to fetch DNS record details for a specific DNS record
fetch_dns_record_details() {
    local dns_record_id=$1
    # Make API call to fetch details for the DNS record
    response=$(curl -X GET "https://api.cloudflare.com/client/v4/zones/$zone_id/dns_records/$dns_record_id" \
    -H "X-Auth-Email: $auth_email" \
    -H "X-Auth-Key: $auth_key" \
    -H "Content-Type: application/json")
    
    # Check if curl command failed
    if [ $? -ne 0 ]; then
        echo "Error: Failed to fetch DNS record details for DNS record ID $dns_record_id" >&2
        return 1
    fi

    if [ "$(echo "$response" | jq -r '.success')" != "true" ]; then
    	echo "Error: Failed to fetch Cloudflare DNS records. API response: $response" >&2
    	return 1
	fi
    
    # Append DNS record details to cloudflare_dns_record_details.txt
    echo "$response" >> cloudflare_dns_record_details.txt
}

# Function to fetch DNS records for a zone
fetch_dns_records() {
    local zone_id=$1
    local page=1
    while true; do
        # Make API call to fetch DNS records for the zone
        response=$(curl -X GET "https://api.cloudflare.com/client/v4/zones/$zone_id/dns_records?page=$page&per_page=50" \
        -H "X-Auth-Email: $auth_email" \
    	-H "X-Auth-Key: $auth_key" \
     	-H "Content-Type: application/json")
        
        # Check if curl command failed
        if [ $? -ne 0 ]; then
            echo "Error: Failed to fetch DNS records for zone ID $zone_id" >&2
            break
        fi
        
        if [ "$(echo "$response" | jq -r '.success')" != "true" ]; then
    		echo "Error: Failed to fetch Cloudflare DNS records. API response: $response" >&2
    		return 1
		fi

        # Extract DNS record IDs from the response and append to cloudflare_all_dns_records_for_all_zones.txt
        echo "$response" | jq -r '.result[] | "\(.id)"' >> cloudflare_all_dns_records_for_all_zones.txt
        
        # Fetch DNS record details for each DNS record
        for dns_record_id in $(echo "$response" | jq -r '.result[].id'); do
            fetch_dns_record_details "$dns_record_id"
        done
        
        # Check if there are more pages to fetch
        next_page=$(echo "$response" | jq -r '.result_info.page + 1')
        if [ $next_page -gt $(echo "$response" | jq -r '.result_info.total_pages') ]; then
            break
        else
            ((page++))
        fi
    done
}

# Function to fetch zones for a Cloudflare account
fetch_zones() {
    local account_id=$1
    # Make API call to fetch zones for the account
    response=$(curl -X GET "https://api.cloudflare.com/client/v4/accounts/$account_id/zones?per_page=400" \
    -H "X-Auth-Email: $auth_email" \
    -H "X-Auth-Key: $auth_key" \
    -H "Content-Type: application/json")
    
    # Check if curl command failed
    if [ $? -ne 0 ]; then
        echo "Error: Failed to fetch zones for account ID $account_id" >&2
        return 1
    fi

    if [ "$(echo "$response" | jq -r '.success')" != "true" ]; then
    	echo "Error: Failed to fetch Cloudflare zones. API response: $response" >&2
    	return 1
	fi
    
    # Extract zone IDs from the response and append to zone_ids.txt
    echo "$response" | jq -r '.result[] | "\(.id)"' >> cloudflare_zone_ids_for_all_accounts.txt
    
    # Fetch DNS records for each zone
    for zone_id in $(echo "$response" | jq -r '.result[].id'); do
        fetch_dns_records "$zone_id"
    done
}

# Function to fetch all Cloudflare accounts
fetch_accounts() {
    # Make API call to fetch Cloudflare accounts
    response=$(curl -X GET "https://api.cloudflare.com/client/v4/accounts" \
    -H "X-Auth-Email: $auth_email" \
    -H "X-Auth-Key: $auth_key" \
    -H "Content-Type: application/json")
    
    # Check if curl command failed and print to console
    if [ $? -ne 0 ]; then
        echo "Error: Failed to fetch Cloudflare accounts" >&2
        return 1
    fi

    if [ "$(echo "$response" | jq -r '.success')" != "true" ]; then
    	echo "Error: Failed to fetch Cloudflare accounts. API response: $response" >&2
    	return 1
	fi
    
    # Extract account IDs and append to cloudflare_account_ids.txt
    echo "$response" | jq -r '.result[] | "\(.id)"' >> cloudflare_account_ids.txt
    
    # Fetch zones for each account
    for account_id in $(echo "$response" | jq -r '.result[].id'); do
        fetch_zones "$account_id"
    done
}

# Fetch all Cloudflare accounts, zones, and DNS records
fetch_accounts

I get errors like the following:

Error: Failed to fetch Cloudflare zones. API response: {"success":false,"errors":[{"code":7003,"message":"Could not route to \/accounts\/{account_id}\/zones, perhaps your object identifier is invalid?"},{"code":7000,"message":"No route for that URI"}],"messages":[],"result":null}