Write API for lists

Hi, I have another doubt (I’ve been posting for a while now haha, ps thanks for all your help). How can I write a list field with the write API? I have a list of references and I don’t know how to post it to the write API…

Hi @emiliano, you can see a response from our content API for a piece of content that has a list (called navigationLinks) with sub-lists inside (subLinks), here:

So if you are writing a post to the write API you would just need to make sure the list follows the similar format:

fetch('https://builder.io/api/v1/write/blog-model', {
    method: 'POST',
    headers: {
      Authorization: `Bearer YOUR_PRIVATE_KEY`,
      'Content-Type': 'application/json'
    body: JSON.stringify({
      name: 'test',
      data: {
        listName: [
                '@type': '@builder.io/core:Reference',
                'id': 'contentID',
               'model': 'modelName'
             '@type': '@builder.io/core:Reference',
             'id': 'contentID',
             'model': 'modelName'

Or similar. Try using the content API to test the shape of lists if you have content that includes a list and just match that in your write API calls.

Hope that helps!