Like what we’re doing? Star us on GitHub!

Images showing as strings and not the image information

4 weeks ago

Hi all

I have a block that returns some items and one of which is an image.

I can't however get the actual image to return, it just returns me the image id. Is there any way to get the actual image to be returned with all the data?

I can see the image data in the API URL so I believe it is probably related to the image being of type

string | Media


Do I need to query the images separately?

I'm also using the REST API by the way.

Ahh figured out the issue, I didn't have the right access set on the Media collection!

access: {
  read: () => true
  • ElliotYoYo
    4 weeks ago

    You need to set/increase the


    parameter in your request. Payload doesn't populate nested document by default and only gives you the


    of it.

    Well you were too fast 😀

  • MRL
    4 weeks ago

    Ah haha sorry mate, we were right on the same submit time. Thanks for your reply though. I was checking the depth but could see I was getting the data back in the API. I just couldn’t access it. Then when querying the media by itself, I realised that it wasn’t working which is when I tested the access.

Open the post
Continue the discussion in Discord
Can't find what you're looking for?
Get help straight from the Payload team with an Enterprise License.Learn More