Seed remote files

default discord avatar
francocdevlast year

Hi, it's possible to seed data from a remote url?

I'm migrating a website with 50k+ posts to payload, but can't find a way to upload the images of each post with the previous url.

And also, I would like to know how to transform text build in plain html (Only <p> tags) to the format that require payload to seed the data.


  • discord user avatar
    last year

    Yes, you can do this for sure

    you can write a simple node script to seed data using payload's local API

    and you can even upload files with the local api as well

    const payload = require('payload');
    const {
    } = process.env;
      secret: PAYLOAD_SECRET_KEY,
      mongoURL: MONGO_URL,
      local: true,
    const seed = async () => {
      // fetch your documents
      const docs = await fetch('').then(res => res.json())
      const promises = (doc) => {
        await payload.create({
          collection: 'docs',
          data: doc
      await Promise.all(promises)

    something like that

    and then you'd call the script like

    node seed.js

    or whatever your file is called

  • default discord avatar
    francocdevlast year

    I understand the use of the local API, but I got problems to upload my old images to /media.

    Also I realize that the tree schema of rich content is really different from my old <p> website structure

    Sorry if I didn't communicate well on the first message. I'm not native, so it's probably unclear.

  • default discord avatar
    martin.rahbeklast year

    const result = await payload.create({

        collection: "media",

        data: {

          alt: "your alt description",


        filePath: path.resolve(__dirname, "./assets/logo.png"),


    You can transform your data at

    to fit payload cms.

  • default discord avatar
    francocdevlast year


Star on GitHub


Chat on Discord



Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.