Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Import images from API and attach to a field

default discord avatar
christopher.nowlanlast year
2

Is there a way to import images from an API and attach to a field

  • discord user avatar
    denolfe
    last year

    From an external API? If you can get the file in the form of a file on disk or file buffer, yes this is possible.



    Here is an example of how to upload from disk using the local API:

    https://github.com/payloadcms/payload/blob/master/test/uploads/config.ts#L162

    You'd need a media collection to upload to, then a relationship field on a separate collection with

    relationTo: 'mediaSlug'
  • default discord avatar
    christopher.nowlanlast year

    Thanks. I had figure it out

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team..