NextSign API
Tools

get_document

The get_document tool — one library document, its versions, and the exact fields to fill when creating a case from it.

Fetches one document from your library: its versions and, for a .docx, the fields a case built from it can fill — each with its path, type, label, whether it is required, its options and its bounds. It is the same operation as GET /v3/api/documents/{id} and runs through the same handler.

This is how the assistant learns what to ask you for. Given a 27-field employment contract it will read the fields, fill what it can from your message, and ask about the required ones that are still missing — rather than guessing.

Arguments

FieldTypeNotes
idObjectIdRequired. The document id, from list_documents
versionIdObjectIdDescribe a specific version instead of the current one

Result

The document, its versions, and the selected version with two lists:

  • fields — what may be sent as tags. Each has a path (the key to send; dotted for fields inside a group), a type (string, number, boolean, array), a subtype hint (date, dropdown, template, …), label, description, required, default, options for dropdown/radio fields, the author's validations, a visible rule for conditional fields, the row shape under item for arrays, and the embedded tags under template for template passages.
  • automaticFields — keys that exist in the document but are filled for you (global from the account, hidden from the field's default, computed from other fields). The assistant must not send values for these; doing so is rejected.
{
  "document": {
    "id": "6a394ed08ee8c3669f2c3e17",
    "name": "Offer letter.docx",
    "format": "docx",
    "version": {
      "id": "6a394ed08ee8c3669f2c3e1a",
      "fields": [
        { "path": "name", "type": "string", "subtype": "dropdown", "label": "Name", "required": true,
          "options": [{ "value": "inam", "label": "Inam" }, { "value": "andreas", "label": "Andreas" }] },
        { "path": "role", "type": "string", "label": "Role", "required": false },
        { "path": "start_date", "type": "string", "subtype": "date", "label": "Start date", "required": false },
        { "path": "is_senior", "type": "boolean", "label": "Is senior", "required": false },
        { "path": "terms", "type": "array", "label": "Terms",
          "item": { "type": "object", "fields": [ { "path": "title", "type": "string" }, { "path": "description", "type": "string" } ] } }
      ],
      "automaticFields": [
        { "path": "company_name", "source": "global" }
      ]
    }
  }
}

Abbreviated — every field carries the full set of keys. The REST page has the complete shape and the rules for each type.

A pdf document has an empty fields list: there is nothing to fill, and it is attached as it is.

404 document-not-found means the document is not yours to use — another company's, a colleague's private one, or an id that does not exist. The assistant should go back to list_documents rather than retry.