Importing data from Google Sheets using AppScripts

Hi, I wanted to use App Scripts to migrate my Google sheets data to my Monday board. I have multiple rows with common identifiers that I want to group together in one parent item, while their data will be shown as subitems. But I keep getting the same error:

Exception: Request failed for https://api.monday.com returned code 400. Truncated server response: {“errors”:[{“message”:“Unknown argument "board_id" on field "Query.items".”,“locations”:[{“line”:3,“column”:14}],“extensions”:{“code”:"GRAPHQL_… (use muteHttpExceptions option to examine full response)

This is the part that causes the error:
function createOrGetParentItem(name, data) {
const query = query ($boardId: [ID!]!) { boards(ids: $boardId) { items { id name } } };

const res = callMondayAPI(query, { boardId: [MONDAY_BOARD_ID] });
const existing = res?.data?.boards?.[0]?.items.find(i => i.name === name);
if (existing) return existing.id;

const mutation = mutation ($boardId: ID!, $itemName: String!, $columnValues: JSON!) { create_item (board_id: $boardId, item_name: $itemName, column_values: $columnValues) { id } };

const variables = {
boardId: MONDAY_BOARD_ID,
itemName: name,
columnValues: JSON.stringify(data)
};

const response = callMondayAPI(mutation, variables);
return response?.data?.create_item?.id;
}