Accessing assets (files) in Monday through API

I have a GraphQL query that I’m running to get access to files uploaded to my board for a certain item. I’m using the following assets query:

query {
  boards (ids:<board_id>) {
    items (ids: <item_id>) {
      assets {
        id
        name
        url
        file_extension
      }
    }
  }
}

but it’s only returning a single file that is actually in one of the columns. It’s not returning the other files that are uploaded with and associated with that item (I can see the files on the UI, just not through API)

any ideas why?

Hello there @davidenergy,

Are these links too or only files that have been uploaded to monday? Where are the other files located? In other columns? In the updates?

Hi @Matias.Monday , thanks so much for your response.

I’m very new to Monday so I’m not sure how to differentiate between ‘links’ vs ‘only files’. I’ll attempt to answer with screenshots.

When I open the row, using this screenshot:

image

It brings me to a panel that has these tabs:

When I click on the Files tab there, I see a bunch of files that I can’t access from the API using the assests query above. Am I doing something wrong?

Thanks

Hello again @davidenergy and thank you for that information!

The files you are seeing are the ones that are uploaded in a column.

It looks like the files you also are trying to access are the ones you have in your updates.

You can use a query like this one to access both of them:

{
  items(ids: 1234567890) {
    updates {
      assets {
        name
      }
    }
    assets {
      name
    }
  }
}

The first one (updates->assets) will be the assets from your updates.

The second one (assets directly) will be the assets from your columns.

I hope that helps!

Cheers,
Matias

Hi @Matias.Monday ,

Unfortunately the updates->assets only returned empty results (here is the top part of the return):

    "boards": [
      {
        "items": [
          {
            "updates": [
              {
                "assets": []
              }
            ],

Any other ideas?

Hello again @davidenergy,

That result can appear if:

A. You have no assets in the updates for that item.
or
B. The API being used does not have access to those assets (because of some permissions in place).

If none of those is the case, you should send an email to appsupport@monday.com with a screen recording of the situation and writing down:

  • Your account ID (or account name)
  • Board ID of the board you are using
  • Item ID of the item you are using
  • Timestamp of when you tried the query (date, hour, minute and location)

With the screen recording and that information, our team can take a closer look into it.

Cheers,
Matias

Thanks, there are four files in the Files tab (see screenshot):

image

I can access and download all files on the UI. I’m assuming my API key has the same permissions as the UI.

I’ll figure out how to create a screen recording and send to the email you provided. Thanks!

Hello again,

Those 4 files might be in file columns.

If none of them are in the updates of the item, then you will not see them in

updates {
  assets {
    name
  }
}

If the assets are in file columns, you will see them in:

    assets {
      name
    }

@Matias.Monday thanks for your reply.

The files are not in the updates tab, they’re in the files tab (see screenshot). They’re also not in the columns, only on the Files tab. Any way to access that?

@davidenergy oh, you uploaded the assets directly in the gallery.

In that case there is only one way to access them. You would need to manually open the file using the UI, check the ID of the asset at the end of the URL in your browser’s address bar and then use that ID in a query like this one:

{
  assets (ids:1234567890){
    name
  }
}

There is no other way of accessing files that were uploaded directly to the gallery as of today.

Very helpful - thank you. Hopefully providing an ability to query the ids of these assets in the future will be feasible. I can see that using the assets query with the id that I get from the UI, I can get at the file itself. But this doesn’t help me much since I need a list of ids programmatically.

Hello again @davidenergy,

I have opened a request for this :slightly_smiling_face:

I would like to second this.
It was breaking my brain that I had assets but couldn’t see them in the API unless they where in a file column.

We have so many files added through conversation, so being able to search through all files on an item and filter on file type would be a huge help.

Hello @Kega,

Thank you for the feedback!

I have added your vote in this request :slightly_smiling_face:

Cheers,
Matias

1 Like

Hi @Matias.Monday , can you please share the feature request link?
Also is there any update to this?

Cheers

Hello there @beepboop and welcome to the community!

The requests board is internal and it is not shared with the public.

I do not have an update on this yet but we will let you know if that changes. I have added your vote for this :grin:

Cheers,
Matias

Hey @Matias.Monday and @davidenergy , this is possible by using the assets_source argument

assets(assets_source: all)

Hello there @beepboop,

I missed that completely! My bad!

Thank you for mentioning it :grin:

1 Like