Working with Sections

Sections divide a document into logical groups and appear in the document content list like every other piece of content. They have a few important properties.

  • All document types support sections except entry subtemplates.
  • All entries and entry templates must start with a section.
  • Sections must include either a date or a title.
  • Sections that include dates must be in chronological order. You can place sections without a date anywhere in the document.
  • Sections are never empty. If a partsMutation creates an empty section, the API inserts an empty text document part after it.

Section children

In Benchling, collapsing a section hides all document content that follows it. The API represents document content as a flat list, so understand the implicit relationship between a section and the content that follows it.

This also means that a partsMutation such as move or delete automatically changes which document content each section collapses.

The example below shows this. Here, the Results section would collapse all content before the Conclusion section.

Entry with collapsed section
GET /api/v3/entry/etr_2uBIDQGZ9W/parts/items
{
  "items": [
    {
      "id": "docpart_Qm3nW8x1",
      "versionId": "etrver_Ax7b2kR9",
      "modifiedAt": "2025-01-15T10:30:00Z",
      "container": { "id": "etr_8rVKW0g7" },
      "content": {
        "__typename": "Benchling.SectionDocumentContent",
        "title": "Results",
        "date": "2025-01-15",
        "color": null
      }
    },
    {
      "id": "docpart_Kp9vR2y4",
      "versionId": "etrver_Ax7b2kR9",
      "modifiedAt": "2025-01-15T14:22:00Z",
      "container": { "id": "etr_8rVKW0g7" },
      "content": {
        "__typename": "Benchling.HeaderDocumentContent",
        "headerType": "HEADER_1",
        "text": "Experiment Results",
        "indentation": 0
      }
    },
    {
      "id": "docpart_Xt5bJ7z3",
      "versionId": "etrver_Ax7b2kR9",
      "modifiedAt": "2025-01-15T14:22:00Z",
      "container": { "id": "etr_8rVKW0g7" },
      "content": {
        "__typename": "Benchling.TextDocumentContent",
        "text": "The following data was collected on 2025-01-15.",
        "formats": [],
        "links": [],
        "mentions": [],
        "indentation": 0
      }
    },
    {
      "id": "docpart_Nw4mP1a8",
      "versionId": "etrver_Ax7b2kR9",
      "modifiedAt": "2025-01-15T14:22:00Z",
      "container": { "id": "etr_8rVKW0g7" },
      "content": {
        "__typename": "Benchling.UnstructuredTableDocumentContentSummary",
        "name": "Concentration Measurements",
        "columnCount": 2,
        "rowCount": 3
      }
    },
    {
      "id": "docpart_Fg7hL2m9",
      "versionId": "etrver_Ax7b2kR9",
      "modifiedAt": "2025-01-15T15:00:00Z",
      "container": { "id": "etr_8rVKW0g7" },
      "content": {
        "__typename": "Benchling.AttachmentDocumentContent",
        "externalFileId": "efl_RkQ2Xp7m",
        "filename": "western_blot_day3.tif",
        "downloadUrl": "https://s3.amazonaws.com/benchling-attachments/...?X-Amz-Expires=3600&...",
        "downloadUrlExpiresAt": "2025-01-15T16:00:00Z",
        "size": 2097152,
        "customWidth": null,
        "indentation": 0
      }
    },
    {
      "id": "docpart_Gq4zK9y5",
      "versionId": "etrver_Ax7b2kR9",
      "modifiedAt": "2025-01-15T10:30:00Z",
      "container": { "id": "etr_8rVKW0g7" },
      "content": {
        "__typename": "Benchling.SectionDocumentContent",
        "title": "Conclusion",
        "date": "2025-01-16",
        "color": null
      }
    }
  ],
  "nextToken": ""
}

Did this page help you?