ESI refresh_token

I got an access token and a refresh token for the first time, but I cannot get a new access token from the refresh token.

def refresh_token(refresh_token):
    basic_auth = base64.urlsafe_b64encode(
        f"{client_id}:{client_secret}".encode("utf-8")
    ).decode()
    headers = {
        "Authorization": f"Basic {basic_auth}",
        "Content-Type": "application/x-www-form-urlencoded",
    }
    payload = {
        "grant_type": "refresh_token",
        "code": refresh_token,
    }
    response = requests.post(
        "https://login.eveonline.com/v2/oauth/token", headers=headers, data=payload
    )


    response.raise_for_status()

    return response.json()
OUTPUT:

requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://login.eveonline.com/v2/oauth/token
def refresh_token(refresh_token):
    basic_auth = base64.urlsafe_b64encode(
        f"{client_id}:{client_secret}".encode("utf-8")
    ).decode()
    headers = {
        "Authorization": f"Basic {basic_auth}",
        "Content-Type": "application/x-www-form-urlencoded",
    }
    payload = {
        "grant_type": "refresh_token",
        "refresh_token": refresh_token,
    }
    response = requests.post(
        "https://login.eveonline.com/v2/oauth/token", headers=headers, data=payload
    )


    response.raise_for_status()

    return response.json()