---
updatedAt: 2026-05-14T19:31:34.000Z
agentTools:
  projectIndex: https://developer.maximizer.com/llms.txt
---

# Document

Document allows users to manage files associated with objects in Maximizer CRM.

A Document is a reference to identify a binary (file) previously loaded and stored in Maximizer CRM. See below some considerations for Document object:

* Documents are associated to Maximizer objects (AbEntry, Opportunity, Case, etc) through the ParentKey property.

* A special endpoint to load binaries has to be used. See examples in the HowTo's section for specific details.

* When binaries are loaded, they are stored in a swap area. When a Document is created using the BinaryDataId (a.k.a. AttachmentId) reference, the default behavior is for the temporary file to be deleted from the swap area. It won't be available for further usage.

* To override this behavior (and use the very same binary file for creating multiple Documents), the option "BinaryFileCleanup" needs to be specified when creating a document. See examples in the HowTo's section for specific details.

# HowTo's

**Create a document in Maximizer (Step 1 - Upload Binary)**

```json js
// POST https://api.maximizer.com/octopus/BinaryUpload
// Authorization: Bearer <token>

```

**Example: Response**

```json js
// Request →
// POST https://api.maximizer.com/octopus/BinaryUpload
// Authorization: Bearer <token>

```

```json js
// Response ←
// When POST to BinaryUpload endpoint, the body provided must be the actual binary file.
// The binary file will be uploaded to a swap area and you are provided with a BinaryDataId identifier.
// You can use the BinaryDataId to reference this binary when creating the actual Document later on.
{
    "Code": 0,
    "BinaryData": {
        "Data": {
            "Size": 14493,
            "BinaryDataId": "429e276b-4e5f-44b0-ae37-064565eac287"
        }
    }
}
```

**Create a document in Maximizer (Step 2 - Create document entry)**

```json js
// POST https://api.maximizer.com/octopus/Create
// Authorization: Bearer <token>
{
    "Document": {
        "Data": {
            "Key": null,
            "Name": "Created Document From Postman",
            "Description": "This is an .xlsx document created from Postman",
            // At first, load the binary and use BinaryDataId returned here
            "BinaryDataId": "6bed8c90-d8e6-4f5e-8ab3-3afc3e5a44c7", // After File creation the binary won't be available to use anymore
            "Ext": ".xlsx", // Should be the same as binary data loaded
            // Type could be one of the following:
            // 1 = MaximizerDocuments, 
            // 3 = Emails, 
            // 7 = Others, 
            // 8 = LinkedDocuments, 
            // 12 = HyperlinkDocuments
            "Type": 1,
            // ParentKey can be OpportunityKey, AbEntryKey, LeadKey, CaseKey
            "ParentKey": "QWJFbnRyeQlERU1PXzFDCTA="
        }
    },
    "Configuration": {
        "Drivers": {
            "IDocumentAccess": "Maximizer.Model.Access.Sql.DocumentAccess"
        }
    }
}
```

**Create a document in Maximizer (Step 2b - Create document entry and keep binary)**

```json js
// POST https://api.maximizer.com/octopus/Create
// Authorization: Bearer <token>
{
    "Document": {
        "Data": {
            "Key": null,
            "Name": "Created Document From Postman",
            "Description": "This is an .xlsx document created from Postman",
            // At first, load the binary and use BinaryDataId returned here
            "BinaryDataId": "6bed8c90-d8e6-4f5e-8ab3-3afc3e5a44c7",
            "Ext": ".xlsx", // Should be the same as binary data loaded
            // Type could be one of the following:
            // 1 = MaximizerDocuments, 
            // 3 = Emails, 
            // 7 = Others, 
            // 8 = LinkedDocuments, 
            // 12 = HyperlinkDocuments
            "Type": 1,
            // ParentKey can be OpportunityKey, AbEntryKey, LeadKey, CaseKey
            "ParentKey": "QWJFbnRyeQlERU1PXzFDCTA="
        },
        "Options": {
            "BinaryFileCleanup": false // Use this option to keep the binary available for other Document creations
        }
    },
    "Configuration": {
        "Drivers": {
            "IDocumentAccess": "Maximizer.Model.Access.Sql.DocumentAccess"
        }
    }
}
```

**Get documents that are email attachments**

```json js
// POST https://api.maximizer.com/octopus/Read
// Authorization: Bearer <token>
{
    "Document": {
        "Scope": {
            "Fields": {
                "Key": 1,
                "Name": 1,
                "Description": 1,
                "Ext": 1,
                "Type": 1,
                "Size": 1,
                "ParentKey": 1,
                "Category": 1
            }
        },
        "Criteria": {
            "SearchQuery": {
                "$AND": [
                    {
                        "Key": {
                            "$EQ": "RG9jdW1lbnQJMTMxMDAwNjA0Nw==" // Interaction Key of Email
                        }
                    },
                    {
                        "Type": {
                            "$EQ": 3 // Type 3 = "Email"
                        }
                    }
                ]
            }
        },
        "Configuration": {
            "Drivers": {
                "IDocumentSearcher": "Maximizer.Model.Access.Sql.DocumentSearcher"
            }
        }
    }
}
```

**Download Binary**

```json js
// GET https://api.maximizer.com/octopus/BinaryDownload/document-key-here
// Authorization: Bearer <token>

```

# Metadata

**Read Document metadata (simple)**

```json js
// POST https://api.maximizer.com/octopus/Read
// Authorization: Bearer <token>
{
    "Schema": {
        "Scope": {
            "Fields": 1
        },
        "Criteria": {
            "SearchQuery": {
                "Key": {
                    "$TREE": "/Document"
                }
            }
        }
    },
    "Compatibility": {
        "SchemaObject": "1.0"
    }
}
```

**Read Document metadata (more)**

```json js
// POST https://api.maximizer.com/octopus/Read
// Authorization: Bearer <token>
{
    "Schema": {
        "Scope": {
            "Fields": {
                "Key": 1,
                "Alias": 1,
                "Type": 1,
                "Name": 1,
                "AppliesTo": 1,
                "Sortable": 1,
                "Queryable": 1,
                "Mandatory": 1,
                "Attributes": 1,
                "DisplayValue": 1,
                "HasOption": 1
            }
        },
        "Criteria": {
            "SearchQuery": {
                "Key": {
                    "$TREE": "/Document"
                }
            }
        }
    },
    "Compatibility": {
        "SchemaObject": "1.0"
    }
}
```

# FieldOptions

**Read Document FieldOptions - Category**

```json js
// POST https://api.maximizer.com/octopus/Read
// Authorization: Bearer <token>
{
    "Document": {
        "FieldOptions": {
            "Category": [
                {
                    "Key": 1,
                    "DisplayValue": 1
                }
            ]
        },
        "Data": {
            // Currently supported Entity Types:
            // 1 = AbEntry
            // 2 = Opportunity
            // 5 = Case
            "ParentKey": {
                "EntityType": 1
            }
        },
        "Compatibility": {
            "SchemaObject": "1.0"
        }
    }
}
```

# Document CRUD

**Create - Document**

```json js
// POST https://api.maximizer.com/octopus/Create
// Authorization: Bearer <token>
{
    "Document": {
        "Data": {
            "Key": null,
            "Name": "Created Document From Postman",
            "Description": "This is an .xlsx document created from Postman",
            // At first, load the binary and use BinaryDataId returned here
            "BinaryDataId": "6bed8c90-d8e6-4f5e-8ab3-3afc3e5a44c7", // After File creation the binary won't be available to use anymore
            "Ext": ".xlsx", // Should be the same as binary data loaded
            // Type could be one of the following:
            // 1 = MaximizerDocuments, 
            // 3 = Emails, 
            // 7 = Others, 
            // 8 = LinkedDocuments, 
            // 12 = HyperlinkDocuments
            // Please check "FieldOptions" folder for details on how to retrieve the options for this field
            "Type": 1,
            // ParentKey can be OpportunityKey, AbEntryKey, LeadKey, CaseKey
            "ParentKey": "QWJFbnRyeQlERU1PXzFDCTA="
        }
    },
    "Configuration": {
        "Drivers": {
            "IDocumentAccess": "Maximizer.Model.Access.Sql.DocumentAccess"
        }
    }
}
```

**Read - Document**

```json js
// POST https://api.maximizer.com/octopus/Read
// Authorization: Bearer <token>
{
    "Document": {
        "Scope": {
            "Fields": {
                "Key": 1,
                "Name": 1,
                "Description": 1,
                "Ext": 1,
                "Type": 1,
                "Size": 1,
                "ParentKey": 1,
                "Category": 1
            }
        },
        "Criteria": {
            "SearchQuery": {},
            "Top": 3
        }
    },
    "Configuration": {
        "Drivers": {
            "IDocumentSearcher": "Maximizer.Model.Access.Sql.DocumentSearcher"
        }
    }
}
```

**Delete - Document**

```json js
// POST https://api.maximizer.com/octopus/Delete
// Authorization: Bearer <token>
{
    "Document": {
        "Data": {
            "Key": "RG9jdW1lbnQJMTUyMDE4NzE5OA=="
        }
    },
    "Configuration": {
        "Drivers": {
            "IDocumentAccess": "Maximizer.Model.Access.Sql.DocumentAccess"
        }
    }
}
```