---
title: "managedDocumentProfileV2"
url: https://developers.dagio.ai/reference/managed-document-profile-v2/
---

# managedDocumentProfileV2

   
                                 
                                                                                   
                                             
                  
           
          
   

This reference describes the full structure of `managedDocumentProfileV2`. Paths include nested objects, list items and conditional branches. A branch selected by `kind`, `contract` or `mode` only admits its own properties.

## Structure and values

| Field | Options / expected values | Description |
| --- | --- | --- |
| `contract` | `"DocumentProfile@2"` | **Required.** Exact discriminant of this contract variant. Match the literal value shown. |
| `key` | `string; min length 1` | **Required.** Stable semantic identifier used by references; changing it changes identity. |
| `sourceSurfaceDefinitionPaths` | `Array<string; min length 1; semantic validation>` | **Required.** Exact path of the relevant definition type; each reference must exist in the Model and respect declared scope. |
| `template` | `"article" \| "report" \| "manuscript" \| "project-brief"` | **Required.** Defines template for this object. Observe the type, variants and bounds in the Options column. |
| `sectionPolicy` | `"ordered" \| "grouped"` | **Required.** Defines section Policy for this object. Observe the type, variants and bounds in the Options column. |
| `exportFormats` | `Array<"docx" \| "markdown" \| "pdf">` | **Required.** Defines export Formats for this object. Observe the type, variants and bounds in the Options column. |
| `composition` | `closed object` | **Required.** Declarative organization of components, sources or Spaces for the selected variant. |
| `composition.contract` | `"SurfaceDocumentComposition@1"` | **Required.** Exact discriminant of this contract variant. Match the literal value shown. |
| `composition.maximumSources` | `integer; ≥ 1; ≤ 1000` | **Required.** Cardinality or budget bound for the named resource. Exceeding the bound is refused; null denotes no bound only where admitted by the schema. |
| `composition.maximumEntries` | `integer; ≥ 1; ≤ 2000` | **Required.** Cardinality or budget bound for the named resource. Exceeding the bound is refused; null denotes no bound only where admitted by the schema. |
| `composition.maximumOutputBytes` | `integer; ≥ 1024; ≤ 16777216` | **Required.** Cardinality or budget bound for the named resource. Exceeding the bound is refused; null denotes no bound only where admitted by the schema. |
| `composition.historicalCapturePolicyKey` | `string; min length 1; null` | **Required.** Stable key reference to the corresponding named declaration; the compiler checks existence and compatibility. |
| `composition.sections` | `Array<closed object>; min length 1; max length 20` | **Required.** Declared sections in reading or rendering order. |
| `composition.sections[].key` | `string; min length 1` | **Required.** Stable semantic identifier used by references; changing it changes identity. |
| `composition.sections[].parentSectionKey` | `string; min length 1; null` | **Required.** Stable key reference to the corresponding named declaration; the compiler checks existence and compatibility. |
| `composition.sections[].queryKey` | `string; min length 1` | **Required.** Reference to a declared Query; scope and authorization remain enforced by the data engine. |
| `composition.sections[].sourceParameterKey` | `string; min length 1` | **Required.** Stable key reference to the corresponding named declaration; the compiler checks existence and compatibility. |
| `composition.sections[].headingLevel` | `integer; ≥ 2; ≤ 6` | **Required.** Defines heading Level for this object. Observe the type, variants and bounds in the Options column. |
| `composition.sections[].orderBy` | `Array<closed object>; min length 1; max length 4` | **Required.** Declared sort order using keys within the authorized scope. |
| `composition.sections[].orderBy[].fieldKey` | `string; min length 1` | **Required.** Key of a Field declared on the referenced Surface definition. |
| `composition.sections[].orderBy[].direction` | `"ascending" \| "descending"` | **Required.** Traversal or presentation direction using this contract’s closed values. |
| `composition.sections[].historicalTraversal` | `closed object; null` | **Required.** Defines historical Traversal for this object. Observe the type, variants and bounds in the Options column. |
| `composition.sections[].historicalTraversal.pathIndex` | `integer; ≥ 0; ≤ 31` | **Required.** Defines path Index for this object. Observe the type, variants and bounds in the Options column. |
| `composition.sections[].historicalTraversal.stepIndex` | `integer; ≥ 0; ≤ 7` | **Required.** Defines step Index for this object. Observe the type, variants and bounds in the Options column. |

## Reading the contract

A path ending in `[]` describes each list item; `{key}` describes each dictionary value. The `↻` marker refers to the same recursive expression. Closed objects reject additional properties. Semantic validation denotes an additional check: matching a type does not make a reference, permission or transition valid. References must resolve in the Model and the current user context.

An older variant cannot accept properties belonging to a newer variant. The compiler checks the version and consistency of the complete Model.

## Structural example

This fragment passes the schema for this section. Its business references must be defined in the enclosing Model.

```json
{
  "contract": "DocumentProfile@2",
  "key": "composed-manuscript",
  "sourceSurfaceDefinitionPaths": [
    "workspace/manuscript/surface/book"
  ],
  "template": "manuscript",
  "sectionPolicy": "ordered",
  "exportFormats": [
    "markdown",
    "docx",
    "pdf"
  ],
  "composition": {
    "contract": "SurfaceDocumentComposition@1",
    "maximumSources": 1000,
    "maximumEntries": 2000,
    "maximumOutputBytes": 16777216,
    "historicalCapturePolicyKey": "historical-book-export",
    "sections": [
      {
        "key": "chapters",
        "parentSectionKey": null,
        "queryKey": "export-book-chapters",
        "sourceParameterKey": "parentId",
        "headingLevel": 2,
        "orderBy": [
          {
            "fieldKey": "sequence",
            "direction": "ascending"
          }
        ],
        "historicalTraversal": {
          "pathIndex": 0,
          "stepIndex": 0
        }
      },
      {
        "key": "scenes",
        "parentSectionKey": "chapters",
        "queryKey": "export-chapter-scenes",
        "sourceParameterKey": "parentId",
        "headingLevel": 3,
        "orderBy": [
          {
            "fieldKey": "sequence",
            "direction": "ascending"
          }
        ],
        "historicalTraversal": {
          "pathIndex": 2,
          "stepIndex": 1
        }
      }
    ]
  }
}
```

## Related references

[Complete Model index](https://developers.dagio.ai/reference/) · [Build a Model](https://developers.dagio.ai/models/)

<!-- surface-examples:start -->

## Applied examples : Client notes and exported document

Content stays editable in the record; the export profile selects the authorized quotes.

### Configuration

Contract object `managedDocumentProfileV2`. [Properties and accepted values](https://developers.dagio.ai/reference/managed-document-profile-v2/).

```json
{
  "contract": "DocumentProfile@2",
  "key": "composed-manuscript",
  "sourceSurfaceDefinitionPaths": [
    "workspace/manuscript/surface/book"
  ],
  "template": "manuscript",
  "sectionPolicy": "ordered",
  "exportFormats": [
    "markdown",
    "docx",
    "pdf"
  ],
  "composition": {
    "contract": "SurfaceDocumentComposition@1",
    "maximumSources": 1000,
    "maximumEntries": 2000,
    "maximumOutputBytes": 16777216,
    "historicalCapturePolicyKey": "historical-book-export",
    "sections": [
      {
        "key": "chapters",
        "parentSectionKey": null,
        "queryKey": "export-book-chapters",
        "sourceParameterKey": "parentId",
        "headingLevel": 2,
        "orderBy": [
          {
            "fieldKey": "sequence",
            "direction": "ascending"
          }
        ],
        "historicalTraversal": {
          "pathIndex": 0,
          "stepIndex": 0
        }
      },
      {
        "key": "scenes",
        "parentSectionKey": "chapters",
        "queryKey": "export-chapter-scenes",
        "sourceParameterKey": "parentId",
        "headingLevel": 3,
        "orderBy": [
          {
            "fieldKey": "sequence",
            "direction": "ascending"
          }
        ],
        "historicalTraversal": {
          "pathIndex": 2,
          "stepIndex": 1
        }
      }
    ]
  }
}
```

### Variation and connection

Fragment placed in `documentProfiles[]`. [Properties and accepted values](https://developers.dagio.ai/reference/managed-document-profile-v3/).

```json
{
  "contract": "DocumentProfile@3",
  "key": "client-quotes-export",
  "source": {
    "kind": "record-query",
    "recordProfileKey": "client",
    "queryBindingKey": "client-quotes",
    "viewKey": "quotes-table"
  },
  "exportFormats": [
    "markdown"
  ],
  "budget": {
    "maximumRows": 100,
    "maximumPages": 4,
    "maximumOutputBytes": 1000000
  }
}
```

### UI layout example

The illustrative layout below places this configuration in the Clients/Quotes app. Insert each fragment at the stated location, with Field, Query and Action references matching the Model declarations.

1. Quote S-1042
2. Subject and need
3. Proposal
4. Retained references

<!-- surface-examples:end -->
