`add_file_to_column` mutation returning a 500 server error

Hello, I am using the SDK to upload an image to a column on a board, and I’m receiving a 500 error. I am passing the file through an HTML input which returns a File e.g:

File: {name: 'sample.pdf', lastModified: 1653471602427, etc...}

I am using the SDK as stated in this post: Announcement: Uploading files to monday.com has just become easier :)

My code:

const RESPONSE = await monday.api(
  mutation addFile($id: Int!, $file: File!) {
    add_file_to_column(item_id: $id, column_id: "files", file: $file) {
    variables: {
      id: parseInt(id),

When I run the mutation I get a 500 POST error from the https://api.monday.com/v2 url.

Hoping someone can help me understand what’s going wrong. Cheers!

Hello @rhymnz and welcome to the community!

I hope you like it here :muscle:

You have to use the endpoint https://api.monday.com/v2/file for this!

Let me know if that does it :slightly_smiling_face:

Thanks! I have a CORS issue with v2/file/, but /v2/ works fine.

For anyone who stumbles across this question here’s the working solution:

export async function submitFileToColumn(data: { id: number; file: File }) {
  try {
    const { id, file } = data;

    const FORM_DATA = new FormData();
    FORM_DATA.append("query", `mutation addFile($file: File!) { add_file_to_column(item_id: ${id}, column_id: "files", file: $file) {id}}`);
    FORM_DATA.append("variables[file]", file, file.name);

    const RESPONSE = await fetch("https://api.monday.com/v2/", {
      method: "POST",
      body: FORM_DATA,
      headers: {
        "Authorization": process.env.MONDAY_API_TOKEN || ""

    const RESPONSE_DATA = await RESPONSE.json();

    if (RESPONSE_DATA.status === 200) {
      return Promise.resolve(RESPONSE_DATA);
    } else {
      throw new Error(RESPONSE_DATA);
  } catch (errResponse) {
    return Promise.reject(errResponse);