{
  "openapi": "3.0.1",
  "info": {
    "title": "eNote Custom Data",
    "version": "v1.1"
  },
  "tags": [
    {
      "name": "eNote Custom Data"
    }
  ],
  "paths": {
    "/documents/{document_id}/custom_data": {
      "put": {
        "summary": "Update custom data for a document",
        "tags": [
          "eNote Custom Data"
        ],
        "description": "Use this endpoint to update custom data for a document. Keys are matched case-insensitively\nagainst the custom field names configured on the eVault (or a custom field id); a blank value\nclears the field, and fields not named in the request are left unchanged. If any key does not\nmatch a custom field the response is 422 and nothing is saved. Requires\nthe `custom_fields:basic` scope.\n",
        "parameters": [
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "5279e4ca-cd04-49b3-9863-d94e9acc35fe",
              "description": "the unique identifier for the document"
            }
          }
        ],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK: the updated document",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/document"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "bad request: custom_data is missing or empty",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "errors": {
                      "type": "object",
                      "example": {
                        "custom_data": "is required"
                      },
                      "properties": {
                        "custom_data": {
                          "type": "string",
                          "example": "is required"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: authentication is missing or invalid"
          },
          "403": {
            "description": "forbidden: the token does not carry the custom_fields:basic scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/forbidden_error"
                }
              }
            }
          },
          "404": {
            "description": "not found: no document with this id in the eVault"
          },
          "422": {
            "description": "unprocessable content: a key does not match any custom field on the eVault",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/custom_data_update_errors"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/custom_data_update_request_payload"
              }
            }
          }
        }
      }
    }
  },
  "servers": [
    {
      "url": "https://demo.snapdocsevault.com/api",
      "description": "Snapdocs Evault demo environment"
    },
    {
      "url": "https://www.snapdocsevault.com/api",
      "description": "Snapdocs Evault production environment"
    }
  ],
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "custom_data_update_request_payload": {
        "type": "object",
        "required": [
          "custom_data"
        ],
        "properties": {
          "custom_data": {
            "type": "object",
            "description": "The custom field values to write. Each key is matched case-insensitively against the custom field names configured on the eVault, or against a custom field id (UUID). A blank value clears the field. Fields not named in the request keep their current values. The request must include at least one key; an empty object is rejected with 400.",
            "example": {
              "CustomField": "value"
            }
          }
        }
      },
      "custom_data_update_errors": {
        "type": "object",
        "properties": {
          "errors": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "Unrecognized field Loan Officer"
            ],
            "description": "one \"Unrecognized field <key>\" entry per key that does not match a custom field. Nothing is saved when this error is returned"
          }
        }
      },
      "forbidden_error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string",
            "example": "Insufficient Scope, a scope of custom_fields:basic is required.",
            "description": "the scope the token is missing"
          }
        }
      },
      "borrower": {
        "type": "object",
        "properties": {
          "id": {
            "oneOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "integer"
              }
            ],
            "description": "id of the Borrower object. When the document has no borrower records but borrower names were extracted from the note XML, the borrowers are built from those names instead and `id` is the 0-based position of the name; only `id` and `full_name` are present in that case.",
            "example": "69a157f4-47d5-4b6a-9cca-a3778b524ec1"
          },
          "person": {
            "type": "boolean",
            "description": "true when the borrower is a person, false when it is an entity",
            "example": true
          },
          "name": {
            "type": "object",
            "nullable": true,
            "description": "Structured name. For a person: `first_name`, `middle_name`, `last_name` and `name_suffix`. For an entity: `name` only. `null` when no name is recorded.",
            "properties": {
              "first_name": {
                "type": "string",
                "nullable": true,
                "example": "David"
              },
              "middle_name": {
                "type": "string",
                "nullable": true,
                "example": "F."
              },
              "last_name": {
                "type": "string",
                "nullable": true,
                "example": "Green"
              },
              "name_suffix": {
                "type": "string",
                "nullable": true,
                "example": "Jr"
              },
              "name": {
                "type": "string",
                "description": "entity name (entities only)",
                "example": "Green Holdings LLC"
              }
            }
          },
          "order": {
            "type": "integer",
            "description": "Borrower order number",
            "example": 1
          },
          "full_name": {
            "type": "string",
            "nullable": true,
            "description": "Full name of the borrower",
            "example": "David F. Green Jr"
          },
          "signed_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the borrower signed the note",
            "example": "2023-07-25T20:06:17.931Z"
          }
        }
      },
      "document": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "5279e4ca-cd04-49b3-9863-d94e9acc35fe",
            "description": "The document id"
          },
          "type": {
            "type": "string",
            "example": "documents",
            "description": "The type of object"
          },
          "attributes": {
            "type": "object",
            "properties": {
              "evault_id": {
                "type": "string",
                "format": "uuid",
                "example": "e726f0ee-7c5b-441c-804c-0e91e9ab404a",
                "description": "id of the evault object"
              },
              "primary_package_id": {
                "type": "string",
                "format": "uuid",
                "example": "e4bac3b7-4133-4b3f-a41e-75c65a14bb95",
                "description": "id of the active version of the document"
              },
              "min_number": {
                "type": "string",
                "example": "999938091211784532",
                "description": "MERS min number associated with the relevant enote"
              },
              "loan_number": {
                "type": "string",
                "description": "the identifier assigned by the originating lender to be referenced as the loan ID/Number on all settlement documents, notes, riders, etc…"
              },
              "created_at": {
                "type": "string",
                "format": "date-time",
                "example": "2023-07-25T20:06:17.903Z",
                "description": "When the document was created in the eVault"
              },
              "updated_at": {
                "type": "string",
                "format": "date-time",
                "example": "2023-07-25T20:06:17.903Z",
                "description": "When the document record was last updated"
              },
              "tamper_sealed_at": {
                "type": "string",
                "format": "date-time",
                "nullable": true,
                "example": "2023-07-25T20:06:17.903Z",
                "description": "When the tamper seal for the note was applied"
              },
              "registered_at": {
                "type": "string",
                "format": "date-time",
                "nullable": true,
                "example": "2023-07-25T20:06:17.903Z",
                "description": "When the note was registered with MERS"
              },
              "last_inquiry_date": {
                "type": "string",
                "format": "date-time",
                "nullable": true,
                "example": "2023-07-25T20:06:17.903Z",
                "description": "When the note was last updated with data from MERS"
              },
              "stored": {
                "type": "boolean",
                "example": true,
                "description": "Whether the signed note file has been stored in the eVault"
              },
              "stored_and_sealed": {
                "type": "boolean",
                "example": true,
                "description": "Whether the note has been signed and tamper sealed"
              },
              "borrower_names": {
                "type": "array",
                "items": {
                  "type": "string",
                  "nullable": true
                },
                "example": [
                  "Green"
                ],
                "description": "One display name per borrower: the last name for a person, the entity name for an entity"
              },
              "primary_borrower_name": {
                "type": "string",
                "nullable": true,
                "example": "Green",
                "description": "The primary borrower's display name: the last name for a person, the entity name for an entity"
              },
              "transferrable": {
                "type": "boolean",
                "description": "Whether the note is available to be transferred"
              },
              "authoritative_copy": {
                "type": "boolean",
                "description": "Whether the note is the authoritative copy"
              },
              "has_power_of_attorney": {
                "type": "boolean",
                "example": false,
                "description": "Whether any borrower on the current version signed under a power of attorney"
              },
              "is_arm": {
                "type": "boolean",
                "example": false,
                "description": "Whether the note is an adjustable-rate note"
              },
              "inquiry_signature_validation": {
                "type": "boolean",
                "nullable": true,
                "example": null,
                "description": "Result of the signature validation reported by the last MERS inquiry; null until an inquiry has reported one"
              },
              "loan_modification_indicator": {
                "type": "boolean",
                "description": "Whether the loan has been modified"
              },
              "loan_modification_type": {
                "type": "string",
                "nullable": true,
                "enum": [
                  "Paper",
                  "Electronic",
                  null
                ],
                "description": "If modified, what type of modification was performed"
              },
              "assumption_indicator": {
                "type": "boolean",
                "description": "Whether the loan has been assumed"
              },
              "source": {
                "type": "string",
                "example": "originated",
                "description": "whether the document was originated in the system or edelivered",
                "enum": [
                  "originated",
                  "edelivered"
                ]
              },
              "status": {
                "type": "string",
                "example": "active",
                "description": "lifecycle status of this document",
                "enum": [
                  "initiated",
                  "sealed",
                  "edelivered",
                  "active",
                  "inactive",
                  "canceled"
                ]
              },
              "status_description": {
                "type": "string",
                "nullable": true,
                "example": "Registration Reversal",
                "description": "human-readable form of `deactivation_reason`; null when the document is not inactive"
              },
              "auto_val_status": {
                "type": "string",
                "nullable": true,
                "example": "passed",
                "description": "the auto-validations status of this document; null when auto-validation has not run",
                "enum": [
                  "passed",
                  "failed",
                  "cleared",
                  null
                ]
              },
              "deactivation_reason": {
                "type": "string",
                "nullable": true,
                "example": "RegistrationReversal",
                "description": "if this document is inactive, the MERS inactive status type (for example RegistrationReversal, PaidOff, ChargedOff, TransferredToProprietaryRegistry, ConvertedToPaper), or the free-text description when MERS reports the type as Other"
              },
              "deactivated_at": {
                "type": "string",
                "format": "date",
                "nullable": true,
                "example": "2025-07-30",
                "description": "if this document is inactive, the date of deactivation (date only, no time component)"
              },
              "locked_by": {
                "type": "object",
                "nullable": true,
                "description": "the certified paper copy or convert-to-paper process currently locking the document; null when the document is not locked",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "example": "c46c0412-09c7-4161-a4b0-e98c022dcae2"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "CertifiedPaperCopyProcess",
                      "ConvertToPaperProcess"
                    ]
                  },
                  "status": {
                    "type": "string",
                    "example": "in_progress"
                  },
                  "unlock_at": {
                    "oneOf": [
                      {
                        "type": "string",
                        "format": "date-time"
                      },
                      {
                        "type": "boolean"
                      }
                    ],
                    "nullable": true,
                    "description": "when the lock expires; `false` when the lock is not currently active"
                  },
                  "user_id": {
                    "type": "string",
                    "format": "uuid",
                    "nullable": true,
                    "description": "the user who started the process"
                  }
                }
              },
              "borrowers": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/borrower"
                }
              },
              "document_sections": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/document_section"
                }
              },
              "rights_holders": {
                "description": "current MERS rights holders by role. Roles with no holder are returned as null; on eVaults where the complete-rights-holders rollout is not yet enabled, roles with no holder are omitted instead.",
                "allOf": [
                  {
                    "$ref": "#/components/schemas/rights_holders"
                  }
                ]
              },
              "previous_right_holders": {
                "description": "rights holders before the most recent transfer, by role. Roles with no previous holder are returned as null; on eVaults where the complete-rights-holders rollout is not yet enabled, they are omitted instead.",
                "allOf": [
                  {
                    "$ref": "#/components/schemas/rights_holders"
                  }
                ]
              },
              "custom_data": {
                "type": "object",
                "example": {
                  "CustomField": "value"
                },
                "description": "optional set of custom data fields saved on the document, keyed by custom field name"
              }
            }
          },
          "relationships": {
            "type": "object",
            "properties": {
              "property_address": {
                "type": "object",
                "description": "JSON:API relationship pointer to the property address of the current version; `data` is null when no address is recorded",
                "properties": {
                  "data": {
                    "type": "object",
                    "nullable": true,
                    "properties": {
                      "id": {
                        "type": "string",
                        "format": "uuid",
                        "example": "6d474b0f-6950-4455-be99-b4771009bfc8"
                      },
                      "type": {
                        "type": "string",
                        "example": "property_addresses"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "document_section": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "id of the Document Section object",
            "example": "c46c0412-09c7-4161-a4b0-e98c022dcae2"
          },
          "file_name": {
            "type": "string",
            "description": "name of the file associated with the section",
            "example": "note.xml"
          },
          "file_type": {
            "type": "string",
            "description": "type of the file",
            "example": "xml"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "when the section was created",
            "example": "2023-07-25T20:06:17.903Z"
          },
          "document_type": {
            "type": "string",
            "description": "type of the section",
            "example": "Note"
          },
          "display_document_type": {
            "type": "string",
            "description": "display label for the section: `HELOC` for a HELOC note, otherwise the same as `document_type`",
            "example": "Note"
          }
        }
      },
      "right_holder": {
        "type": "object",
        "properties": {
          "mers_org": {
            "type": "string",
            "description": "MERS identifier for the right holder",
            "example": "0000001"
          },
          "name": {
            "type": "string",
            "description": "name of the right holder",
            "example": "Example Organization"
          }
        }
      },
      "rights_holders": {
        "type": "object",
        "properties": {
          "controller": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/right_holder"
              }
            ]
          },
          "location": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/right_holder"
              }
            ]
          },
          "master_servicer": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/right_holder"
              }
            ]
          },
          "subservicer": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/right_holder"
              }
            ]
          },
          "delegatee_for_transfers": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/right_holder"
              }
            ]
          },
          "secured_party": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/right_holder"
              }
            ]
          },
          "secured_party_delegatee": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/right_holder"
              }
            ]
          }
        }
      }
    }
  }
}