Document

A document is a catch-all term for a PDF uploaded, an image uploaded, or a custom document created from a document-template.

The document model

Properties

  • Name
    id
    Type
    string
    Description

    Unique identifier for the document.

  • Name
    object
    Type
    string
    Description

    Always 'document'.

  • Name
    type
    Type
    string
    Description

    Type of document.

    Possible values:
    pdf
    image
    template
  • Name
    document_template
    Type
    string
    Description

    Template this document is based on.

  • Name
    document_template_version
    Type
    string
    Description

    Template version this document is based on.

  • Name
    patient
    Type
    string
    Description

    Patient this document is for.

  • Name
    score
    Type
    number
    Description

    Score of the document.

  • Name
    filename
    Type
    string
    Description

    Name of the document.

  • Name
    file
    Type
    string
    Description

    File of the document in base64 format.

  • Name
    name
    Type
    string
    Description

    Name of the document.

  • Name
    share_with_patient
    Type
    boolean
    Description

    Whether this document should be shared with the patient.

  • Name
    sections
    Type
    array of objects
    Description

    List of sections in the document, each holding its answered questions.

  • Name
    comments
    Type
    array of objects
    Description

    List of comments added to the document.

  • Name
    addendums
    Type
    array of objects
    Description

    List of addendums appended to the document after the document has been signed and locked.

  • Name
    tags
    Type
    array of objects
    Description
    List of tags associated with this document.
  • Name
    reviews
    Type
    array of objects
    Description
    Review history of the document.
  • Name
    signers
    Type
    array of objects
    Description
    Signing history of the document.
  • Name
    is_entered_in_error
    Type
    boolean
    Description

    Whether this document is marked as entered in error.

  • Name
    entered_in_error
    Type
    object
    Description

    Audit record for a document marked as entered in error.

  • Name
    external_id
    Type
    string
    Description

    A client-specified unique ID to associate with this document.

  • Name
    created_by
    Type
    string
    Description

    Creator of the document.

  • Name
    created_at
    Type
    date-time
    Description

    Timestamp (in ISO 8601 format) of when the document was created.

  • Name
    last_updated_at
    Type
    date-time
    Description

    Timestamp (in ISO 8601 format) of when the document was last updated.

Response

{
    "id": "doc_2UxtAULYUrX7GVsTKePy",
    "object": "document",

    "type": "template",
    "document_template": "dtmp_NOIYLBGOBNhSwTWCUzfu",
    "document_template_version": "dtmv_1JtjV1QEY84Fv395Hl7h",

    "patient": "user_Z1zXZKvqrpwxbznuW6lJ",
    "score": 8,

    "filename": "Group Meeting Notes — 9/18/22.pdf",
    "file": "JVBERi0xLjQKJeLjz9MNCjQgMCBvYm...",
    "name": "Group Meeting Notes — 9/18/22",
    "share_with_patient": false,

    "sections": [{
          "id": "dsec_U8xtAULYUrX7GVsTKePy",
          "object": "document_section",
          "name": "Section 1",
         "logic": [{
            "field": "dqst_3951JtjV1QEY84FvHl7h",
            "condition": "equal_to",
            "value": "Yes"
          }],
          "answers": [
            {
              "id": "dans_U8xtAULYUrX7GVsTKePy",
              "object": "document_answer",
              "document": "doc_841JtjV1QEYFv395Hl7h",
              "question": "dqst_1JtjV1QEY84Fv395Hl7h",
              "patient": "user_3951JtjV1QEY84FvHl7h",
              "type": "short_answer",
              "name": "What's your first name?",
              "response": "Sally Chen"
            }
          ],
    }],
    "comments": [{
        "id": "cmmt_op0jVVAdR23DgkQPpdX8",
        "object": "comment",
        "comment": "This is a comment.",
        "created_by": "user_xeDpGyt67wTor93qKtS7",
        "created_at": "2024-04-10T13:20:21.724Z",
    }],
    "addendums": [{
        "id": "addm_pdX8op0jVVAdR23DgkQP",
        "object": "addendum",
        "addendum": "This is an addendum.",
        "committed_to_record": true,
        "created_by": "user_xeDpGyt67wTor93qKtS7",
        "created_at": "2024-04-10T13:20:21.724Z",
    }],

    "tags": [{
      "id": "tag_VAdR23Dp0jVVAdR23DgkQP",
      "name": "Lab Result",
    }]

    "reviews": [],
    "signers": [{
        "status": "signed_by_provider",
        "signed_by": "user_xeDpGyt67wTor93qKtS7",
        "signed_at": "2024-04-10T13:20:21.724Z"
    }],

    "external_id": "tS7xeDpGytFHKJK01ksjnfwwro",

    "created_by": "user_xeDpGyt67wTor93qKtS7",
    "created_at": "2024-04-10T13:20:21.724Z",
    "last_updated_at": "2024-04-10T13:20:21.724Z"
}


POST/v2/documents

Create a document

Creates a new visit document.

Required attributes

  • Name
    patient
    Type
    string
    Description

    Patient this document is for.

  • Name
    type
    Type
    string
    Description

    Type of document.

    Possible values:
    pdf
    image
    template
  • Name
    filename
    Type
    string
    Description

    Only applies to PDFs. Name of the document.

  • Name
    file
    Type
    string
    Description

    Only applies to PDFs and images. File of the document in base64 format.

  • Name
    document_template
    Type
    string
    Description

    Only applies to templates. Template this document is based on.

Optional attributes

  • Name
    name
    Type
    string
    Description

    Name of the document.

  • Name
    share_with_patient
    Type
    boolean
    Description

    Whether this document should be shared with the patient.

  • Name
    answers
    Type
    array of objects
    Description

    Answers to set on the document when it is created.

  • Name
    review
    Type
    object
    Description
    Review of document.
  • Name
    signer
    Type
    string
    Description

    Signer of document.

  • Name
    tags
    Type
    array of objects
    Description
    List of tags associated with this document.
  • Name
    external_id
    Type
    string
    Description

    A client-specified unique ID to associate with this document.

Request

POST
/v2/documents
curl -X POST "https://{{base_subdomain}}.avonhealth.com/v2/documents" \
  -H "Authorization: Bearer {{token}}" \
  -H "x-jwt: {{jwt}}" \
  -H "Content-Type: application/json" \
  --data '{
    "patient": "user_Z1zXZKvqrpwxbznuW6lJ",
    "type": "template",
    "document_template": "dtmp_NOIYLBGOBNhSwTWCUzfu",
    "answers": [
      {
        "question": "dqst_1JtjV1QEY84Fv395Hl7h",
        "response": "Sally Chen"
      }
    ],
    "tags": [
      { "id": "tag_VAdR23Dp0jVVAdR23DgkQP" }
    ]
  }'

Response

    {
        "id": "doc_2UxtAULYUrX7GVsTKePy",
        "object": "document",

        "type": "template",
        "document_template": "dtmp_NOIYLBGOBNhSwTWCUzfu",
        "document_template_version": "dtmv_1JtjV1QEY84Fv395Hl7h",

        "patient": "user_Z1zXZKvqrpwxbznuW6lJ",
        "score": 8,

        "filename": "Group Meeting Notes — 9/18/22.pdf",
        "file": "JVBERi0xLjQKJeLjz9MNCjQgMCBvYm...",
        "name": "Group Meeting Notes — 9/18/22",
        "share_with_patient": false,

        "sections": [{
              "id": "dsec_U8xtAULYUrX7GVsTKePy",
              "object": "document_section",
              "name": "Section 1",
             "logic": [{
                "field": "dqst_3951JtjV1QEY84FvHl7h",
                "condition": "equal_to",
                "value": "Yes"
              }],
              "answers": [
                {
                  "id": "dans_U8xtAULYUrX7GVsTKePy",
                  "object": "document_answer",
                  "document": "doc_841JtjV1QEYFv395Hl7h",
                  "question": "dqst_1JtjV1QEY84Fv395Hl7h",
                  "patient": "user_3951JtjV1QEY84FvHl7h",
                  "type": "short_answer",
                  "name": "What's your first name?",
                  "response": "Sally Chen"
                }
              ],
        }],
        "comments": [{
            "id": "cmmt_op0jVVAdR23DgkQPpdX8",
            "object": "comment",
            "comment": "This is a comment.",
            "created_by": "user_xeDpGyt67wTor93qKtS7",
            "created_at": "2024-04-10T13:20:21.724Z",
        }],
        "addendums": [{
            "id": "addm_pdX8op0jVVAdR23DgkQP",
            "object": "addendum",
            "addendum": "This is an addendum.",
            "committed_to_record": true,
            "created_by": "user_xeDpGyt67wTor93qKtS7",
            "created_at": "2024-04-10T13:20:21.724Z",
        }],

        "tags": [{
          "id": "tag_VAdR23Dp0jVVAdR23DgkQP",
          "name": "Lab Result",
        }]

        "reviews": [],
        "signers": [{
            "status": "signed_by_provider",
            "signed_by": "user_xeDpGyt67wTor93qKtS7",
            "signed_at": "2024-04-10T13:20:21.724Z"
        }],

        "external_id": "tS7xeDpGytFHKJK01ksjnfwwro",

        "created_by": "user_xeDpGyt67wTor93qKtS7",
        "created_at": "2024-04-10T13:20:21.724Z",
        "last_updated_at": "2024-04-10T13:20:21.724Z"
    }

GET/v2/documents/:id

Retrieve a document

Retrieves the specified document.

Request

GET
/v2/documents/:id
curl "https://{{base_subdomain}}.avonhealth.com/v2/documents/:id" \
  -H "Authorization: Bearer {{token}}" \
  -H "x-jwt: {{jwt}}"

Response

    {
        "id": "doc_2UxtAULYUrX7GVsTKePy",
        "object": "document",

        "type": "template",
        "document_template": "dtmp_NOIYLBGOBNhSwTWCUzfu",
        "document_template_version": "dtmv_1JtjV1QEY84Fv395Hl7h",

        "patient": "user_Z1zXZKvqrpwxbznuW6lJ",
        "score": 8,

        "filename": "Group Meeting Notes — 9/18/22.pdf",
        "file": "JVBERi0xLjQKJeLjz9MNCjQgMCBvYm...",
        "name": "Group Meeting Notes — 9/18/22",
        "share_with_patient": false,

        "sections": [{
              "id": "dsec_U8xtAULYUrX7GVsTKePy",
              "object": "document_section",
              "name": "Section 1",
             "logic": [{
                "field": "dqst_3951JtjV1QEY84FvHl7h",
                "condition": "equal_to",
                "value": "Yes"
              }],
              "answers": [
                {
                  "id": "dans_U8xtAULYUrX7GVsTKePy",
                  "object": "document_answer",
                  "document": "doc_841JtjV1QEYFv395Hl7h",
                  "question": "dqst_1JtjV1QEY84Fv395Hl7h",
                  "patient": "user_3951JtjV1QEY84FvHl7h",
                  "type": "short_answer",
                  "name": "What's your first name?",
                  "response": "Sally Chen"
                }
              ],
        }],
        "comments": [{
            "id": "cmmt_op0jVVAdR23DgkQPpdX8",
            "object": "comment",
            "comment": "This is a comment.",
            "created_by": "user_xeDpGyt67wTor93qKtS7",
            "created_at": "2024-04-10T13:20:21.724Z",
        }],
        "addendums": [{
            "id": "addm_pdX8op0jVVAdR23DgkQP",
            "object": "addendum",
            "addendum": "This is an addendum.",
            "committed_to_record": true,
            "created_by": "user_xeDpGyt67wTor93qKtS7",
            "created_at": "2024-04-10T13:20:21.724Z",
        }],

        "tags": [{
          "id": "tag_VAdR23Dp0jVVAdR23DgkQP",
          "name": "Lab Result",
        }]

        "reviews": [],
        "signers": [{
            "status": "signed_by_provider",
            "signed_by": "user_xeDpGyt67wTor93qKtS7",
            "signed_at": "2024-04-10T13:20:21.724Z"
        }],

        "external_id": "tS7xeDpGytFHKJK01ksjnfwwro",

        "created_by": "user_xeDpGyt67wTor93qKtS7",
        "created_at": "2024-04-10T13:20:21.724Z",
        "last_updated_at": "2024-04-10T13:20:21.724Z"
    }

GET/v2/documents/:id/pdf

Retrieve a document in PDF format

Returns a signed URL to the PDF version of the document, which expires within 30 minutes.

Request

GET
/v2/documents/:id/pdf
curl "https://{{base_subdomain}}.avonhealth.com/v2/documents/:id/pdf" \
  -H "Authorization: Bearer {{token}}" \
  -H "x-jwt: {{jwt}}"

Response

    {
        "id": "doc_2UxtAULYUrX7GVsTKePy",
        "object": "document",
        "url": "https://....",
        "expires_at": "2024-04-03T04:12:01.781Z"
    }

POST/v2/documents/:id

Update a document

Update the specified document object by setting the values of the parameters passed. Any other parameters not provided will not be modified.

Required attributes

    Optional attributes

    • Name
      filename
      Type
      string
      Description

      Only applies to PDFs. Name of the document.

    • Name
      file
      Type
      string
      Description

      Only applies to PDFs and images. File of the document in base64 format.

    • Name
      name
      Type
      string
      Description

      Name of the document.

    • Name
      share_with_patient
      Type
      boolean
      Description

      Whether this document should be shared with the patient.

    • Name
      review
      Type
      object
      Description
      Review of document.
    • Name
      signer
      Type
      string
      Description

      Signer of document.

    • Name
      tags
      Type
      array of objects
      Description

      List of tags for this document, each an object with the tag's id. Replaces all of the document's existing tags. Pass an empty array to remove every tag. See Tag to create tags.

    • Name
      external_id
      Type
      string
      Description

      A client-specified unique ID to associate with this document.

    Request

    POST
    /v2/documents/:id
    curl -X POST "https://{{base_subdomain}}.avonhealth.com/v2/documents/:id" \
      -H "Authorization: Bearer {{token}}" \
      -H "x-jwt: {{jwt}}" \
      -H "Content-Type: application/json" \
      --data '{}'
    

    Response

        {
            "id": "doc_2UxtAULYUrX7GVsTKePy",
            "object": "document",
    
            "type": "template",
            "document_template": "dtmp_NOIYLBGOBNhSwTWCUzfu",
            "document_template_version": "dtmv_1JtjV1QEY84Fv395Hl7h",
    
            "patient": "user_Z1zXZKvqrpwxbznuW6lJ",
            "score": 8,
    
            "filename": "Group Meeting Notes — 9/18/22.pdf",
            "file": "JVBERi0xLjQKJeLjz9MNCjQgMCBvYm...",
            "name": "Group Meeting Notes — 9/18/22",
            "share_with_patient": false,
    
            "sections": [{
                  "id": "dsec_U8xtAULYUrX7GVsTKePy",
                  "object": "document_section",
                  "name": "Section 1",
                 "logic": [{
                    "field": "dqst_3951JtjV1QEY84FvHl7h",
                    "condition": "equal_to",
                    "value": "Yes"
                  }],
                  "answers": [
                    {
                      "id": "dans_U8xtAULYUrX7GVsTKePy",
                      "object": "document_answer",
                      "document": "doc_841JtjV1QEYFv395Hl7h",
                      "question": "dqst_1JtjV1QEY84Fv395Hl7h",
                      "patient": "user_3951JtjV1QEY84FvHl7h",
                      "type": "short_answer",
                      "name": "What's your first name?",
                      "response": "Sally Chen"
                    }
                  ],
            }],
            "comments": [{
                "id": "cmmt_op0jVVAdR23DgkQPpdX8",
                "object": "comment",
                "comment": "This is a comment.",
                "created_by": "user_xeDpGyt67wTor93qKtS7",
                "created_at": "2024-04-10T13:20:21.724Z",
            }],
            "addendums": [{
                "id": "addm_pdX8op0jVVAdR23DgkQP",
                "object": "addendum",
                "addendum": "This is an addendum.",
                "committed_to_record": true,
                "created_by": "user_xeDpGyt67wTor93qKtS7",
                "created_at": "2024-04-10T13:20:21.724Z",
            }],
    
            "tags": [{
              "id": "tag_VAdR23Dp0jVVAdR23DgkQP",
              "name": "Lab Result",
            }]
    
            "reviews": [],
            "signers": [{
                "status": "signed_by_provider",
                "signed_by": "user_xeDpGyt67wTor93qKtS7",
                "signed_at": "2024-04-10T13:20:21.724Z"
            }],
    
            "external_id": "tS7xeDpGytFHKJK01ksjnfwwro",
    
            "created_by": "user_xeDpGyt67wTor93qKtS7",
            "created_at": "2024-04-10T13:20:21.724Z",
            "last_updated_at": "2024-04-10T13:20:21.724Z"
        }
    

    POST/v2/documents/:id/sign

    Sign a document

    Signs a document. The user whose jwt is passed in the header is set as the signer.

    Request

    POST
    /v2/documents/:id/sign
    curl -X POST "https://{{base_subdomain}}.avonhealth.com/v2/documents/:id/sign" \
      -H "Authorization: Bearer {{token}}" \
      -H "x-jwt: {{jwt}}" \
      -H "Content-Type: application/json" \
      --data '{}'
    

    Response

        {
            "id": "doc_2UxtAULYUrX7GVsTKePy",
            "object": "document",
    
            "type": "template",
            "document_template": "dtmp_NOIYLBGOBNhSwTWCUzfu",
            "document_template_version": "dtmv_1JtjV1QEY84Fv395Hl7h",
    
            "patient": "user_Z1zXZKvqrpwxbznuW6lJ",
            "score": 8,
    
            "filename": "Group Meeting Notes — 9/18/22.pdf",
            "file": "JVBERi0xLjQKJeLjz9MNCjQgMCBvYm...",
            "name": "Group Meeting Notes — 9/18/22",
            "share_with_patient": false,
    
            "sections": [{
                  "id": "dsec_U8xtAULYUrX7GVsTKePy",
                  "object": "document_section",
                  "name": "Section 1",
                 "logic": [{
                    "field": "dqst_3951JtjV1QEY84FvHl7h",
                    "condition": "equal_to",
                    "value": "Yes"
                  }],
                  "answers": [
                    {
                      "id": "dans_U8xtAULYUrX7GVsTKePy",
                      "object": "document_answer",
                      "document": "doc_841JtjV1QEYFv395Hl7h",
                      "question": "dqst_1JtjV1QEY84Fv395Hl7h",
                      "patient": "user_3951JtjV1QEY84FvHl7h",
                      "type": "short_answer",
                      "name": "What's your first name?",
                      "response": "Sally Chen"
                    }
                  ],
            }],
            "comments": [{
                "id": "cmmt_op0jVVAdR23DgkQPpdX8",
                "object": "comment",
                "comment": "This is a comment.",
                "created_by": "user_xeDpGyt67wTor93qKtS7",
                "created_at": "2024-04-10T13:20:21.724Z",
            }],
            "addendums": [{
                "id": "addm_pdX8op0jVVAdR23DgkQP",
                "object": "addendum",
                "addendum": "This is an addendum.",
                "committed_to_record": true,
                "created_by": "user_xeDpGyt67wTor93qKtS7",
                "created_at": "2024-04-10T13:20:21.724Z",
            }],
    
            "tags": [{
              "id": "tag_VAdR23Dp0jVVAdR23DgkQP",
              "name": "Lab Result",
            }]
    
            "reviews": [],
            "signers": [{
                "status": "signed_by_provider",
                "signed_by": "user_xeDpGyt67wTor93qKtS7",
                "signed_at": "2024-04-10T13:20:21.724Z"
            }],
    
            "external_id": "tS7xeDpGytFHKJK01ksjnfwwro",
    
            "created_by": "user_xeDpGyt67wTor93qKtS7",
            "created_at": "2024-04-10T13:20:21.724Z",
            "last_updated_at": "2024-04-10T13:20:21.724Z"
        }
    

    GET/v2/documents

    List all documents

    Returns a list of all documents. The full base64 encoded file may not be returned in the list.

    Optional query parameters

    • Name
      limit
      Type
      number
      Description

      Maximum number of results to return.

    • Name
      offset
      Type
      number
      Description

      Number of results to skip.

    • Name
      document_template
      Type
      string
      Description

      Document template to filter by.

    • Name
      document_template_version
      Type
      string
      Description

      Document template version to filter by.

    • Name
      patient
      Type
      string
      Description

      Patient to filter by.

    Request

    GET
    /v2/documents
    curl "https://{{base_subdomain}}.avonhealth.com/v2/documents?document_template=Example&document_template_version=Example" \
      -H "Authorization: Bearer {{token}}" \
      -H "x-jwt: {{jwt}}"
    

    Response

        {
          "object": "list",
          "data": [
            {
                "id": "doc_2UxtAULYUrX7GVsTKePy",
                "object": "document",
    
                "type": "template",
                "document_template": "dtmp_NOIYLBGOBNhSwTWCUzfu",
                "document_template_version": "dtmv_1JtjV1QEY84Fv395Hl7h",
    
                "patient": "user_Z1zXZKvqrpwxbznuW6lJ",
                "score": 8,
    
                "filename": "Group Meeting Notes — 9/18/22.pdf",
                "file": "JVBERi0xLjQKJeLjz9MNCjQgMCBvYm...",
                "name": "Group Meeting Notes — 9/18/22",
                "share_with_patient": false,
    
                "sections": [{
                      "id": "dsec_U8xtAULYUrX7GVsTKePy",
                      "object": "document_section",
                      "name": "Section 1",
                     "logic": [{
                        "field": "dqst_3951JtjV1QEY84FvHl7h",
                        "condition": "equal_to",
                        "value": "Yes"
                      }],
                      "answers": [
                        {
                          "id": "dans_U8xtAULYUrX7GVsTKePy",
                          "object": "document_answer",
                          "document": "doc_841JtjV1QEYFv395Hl7h",
                          "question": "dqst_1JtjV1QEY84Fv395Hl7h",
                          "patient": "user_3951JtjV1QEY84FvHl7h",
                          "type": "short_answer",
                          "name": "What's your first name?",
                          "response": "Sally Chen"
                        }
                      ],
                }],
                "comments": [{
                    "id": "cmmt_op0jVVAdR23DgkQPpdX8",
                    "object": "comment",
                    "comment": "This is a comment.",
                    "created_by": "user_xeDpGyt67wTor93qKtS7",
                    "created_at": "2024-04-10T13:20:21.724Z",
                }],
                "addendums": [{
                    "id": "addm_pdX8op0jVVAdR23DgkQP",
                    "object": "addendum",
                    "addendum": "This is an addendum.",
                    "committed_to_record": true,
                    "created_by": "user_xeDpGyt67wTor93qKtS7",
                    "created_at": "2024-04-10T13:20:21.724Z",
                }],
    
                "tags": [{
                  "id": "tag_VAdR23Dp0jVVAdR23DgkQP",
                  "name": "Lab Result",
                }]
    
                "reviews": [],
                "signers": [{
                    "status": "signed_by_provider",
                    "signed_by": "user_xeDpGyt67wTor93qKtS7",
                    "signed_at": "2024-04-10T13:20:21.724Z"
                }],
    
                "external_id": "tS7xeDpGytFHKJK01ksjnfwwro",
    
                "created_by": "user_xeDpGyt67wTor93qKtS7",
                "created_at": "2024-04-10T13:20:21.724Z",
                "last_updated_at": "2024-04-10T13:20:21.724Z"
            },
          ]
        }