For Modular Content, Structured Text and Single Block fields. If set, returns full payload for nested blocks instead of IDs
Whether you want the currently published versions (published
, default) of your records, or the latest available (current
)
"published"
Returns a resource object of type item.
Sometimes, you may wish to fetch a record that has embedded blocks inside Structured Text or Modular Content fields.
By default, those nested blocks are returned as references, like:
But if you add the nested=true
query parameter, we'll embed the blocks content inline for you.
1GET https://site-api.datocms.com/items/FEzWmQhjQgeHsCrUtvlEMw?nested=true HTTP/1.12Authorization: Bearer YOUR-API-TOKEN3Accept: application/json4X-Api-Version: 3
1curl -g 'https://site-api.datocms.com/items/FEzWmQhjQgeHsCrUtvlEMw?nested=true' \2 \3 -H "Authorization: Bearer YOUR-API-TOKEN" \4 -H "Accept: application/json" \5 -H "X-Api-Version: 3"
1await fetch(2 "https://site-api.datocms.com/items/FEzWmQhjQgeHsCrUtvlEMw?nested=true",3 {4 headers: {5 Authorization: "Bearer YOUR-API-TOKEN",6 Accept: "application/json",7 "X-Api-Version": "3",8 },9 },10);
1HTTP/1.1 200 OK2Content-Type: application/json3Cache-Control: cache-control: max-age=0, private, must-revalidate4X-RateLimit-Limit: 305X-RateLimit-Remaining: 286
7{8 "data": {9 "id": "FEzWmQhjQgeHsCrUtvlEMw",10 "type": "item",11 "attributes": {12 "structured_text_field": {13 "schema": "dast",14 "document": {15 "children": [16 {17 "item": {18 "type": "item",19 "attributes": {20 "button_label": "Example button",21 "button_url": "https://www.example.com"22 },23 "relationships": {24 "item_type": {25 "data": {26 "id": "SkVjHJSGR5CyK16E8TfJxg",27 "type": "item_type"28 }29 }30 },31 "id": "ahxSnFQEQ02K3TjttWAg-Q"32 },33 "type": "block"34 },35 {36 "item": {37 "type": "item",38 "attributes": {39 "nested_structured_text_field": {40 "schema": "dast",41 "document": {42 "children": [43 {44 "children": [45 {46 "type": "span",47 "value": "This is a "48 },49 {50 "marks": ["emphasis"],51 "type": "span",52 "value": "nested"53 },54 {55 "type": "span",56 "value": " structured text block inside the parent structured text field."57 }58 ],59 "type": "paragraph"60 },61 {62 "item": {63 "type": "item",64 "attributes": {65 "button_label": "And this is a button inside the nested structured text block",66 "button_url": "https://www.example2.com"67 },68 "relationships": {69 "item_type": {70 "data": {71 "id": "SkVjHJSGR5CyK16E8TfJxg",72 "type": "item_type"73 }74 }75 },76 "id": "CGqwjPDsTHKGFy1IbC0RAQ"77 },78 "type": "block"79 }80 ],81 "type": "root"82 }83 }84 },85 "relationships": {86 "item_type": {87 "data": {88 "id": "Ty4S40cbQH6_VMNnGdd9KA",89 "type": "item_type"90 }91 }92 },93 "id": "AppHB06oRBm-er3oooL_LA"94 },95 "type": "block"96 }97 ],98 "type": "root"99 }100 }101 },102 "relationships": {103 "item_type": {104 "data": {105 "id": "UVa_hHEBSeefLEUnwoQFig",106 "type": "item_type"107 }108 },109 "creator": {110 "data": {111 "id": "104280",112 "type": "account"113 }114 }115 },116 "meta": {117 "created_at": "2024-03-13T17:01:19.243+00:00",118 "updated_at": "2024-03-13T17:14:17.444+00:00",119 "published_at": "2024-03-13T17:14:17.597+00:00",120 "publication_scheduled_at": null,121 "unpublishing_scheduled_at": null,122 "first_published_at": "2024-03-13T17:01:19.326+00:00",123 "is_valid": true,124 "is_current_version_valid": true,125 "is_published_version_valid": true,126 "status": "published",127 "current_version": "DLtyHZ2MTDqYMg7g5mgYEw",128 "stage": null129 }130 }131}