{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/clarifymedical/json-schema/clarifymedical-get-record-attachments-list-response-schema.json",
  "title": "GetRecordAttachmentsListResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/clarifymedical-recordattachments-api-openapi.yml#/components/schemas/GetRecordAttachmentsListResponse",
  "type": "object",
  "properties": {
    "links": {
      "type": "object",
      "properties": {
        "next": {
          "type": [
            "string",
            "null"
          ],
          "description": "URL of the next page, or `null` on the last page."
        },
        "prev": {
          "type": [
            "string",
            "null"
          ],
          "description": "URL of the previous page, or `null` on the first page."
        }
      },
      "required": [
        "next",
        "prev"
      ],
      "description": "Pagination links."
    },
    "meta": {
      "type": "object",
      "properties": {
        "total_records": {
          "type": "number",
          "description": "Total number of attachments across all pages."
        },
        "total_pages": {
          "type": "number",
          "description": "Total number of pages at the current page size."
        }
      },
      "required": [
        "total_records",
        "total_pages"
      ],
      "description": "Pagination metadata."
    },
    "data": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "_id": {
            "type": "string",
            "description": "The unique ID of the attachment."
          },
          "name": {
            "type": "string",
            "description": "The file name, including its extension."
          },
          "_created_at": {
            "type": "string",
            "description": "ISO 8601 timestamp of when the attachment was added."
          },
          "_created_by": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ID of the user who added the attachment, if known."
          },
          "source": {
            "type": "string",
            "enum": [
              "user",
              "email"
            ],
            "description": "How the attachment reached the record: uploaded by a user or extracted from an email."
          },
          "mime_type": {
            "type": [
              "string",
              "null"
            ],
            "description": "The MIME type of the file."
          },
          "size_bytes": {
            "type": [
              "integer",
              "null"
            ],
            "description": "The file size in bytes, if known."
          },
          "messageRef": {
            "type": "object",
            "properties": {
              "_id": {
                "type": "string",
                "description": "The unique ID of the source email message."
              },
              "_created_at": {
                "type": "string",
                "description": "ISO 8601 timestamp of the source email message."
              },
              "received_at": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "ISO 8601 timestamp when the source email was received (the true email date). Null if unknown."
              },
              "account_email": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Email address of the connected account that ingested the source email. Null for messages ingested before provenance tracking."
              }
            },
            "required": [
              "_id",
              "_created_at",
              "received_at",
              "account_email"
            ],
            "description": "Reference to the email message the attachment came from; present for `email`-sourced attachments."
          },
          "sender": {
            "type": "object",
            "properties": {
              "personId": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The person record ID of the sender, if matched."
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The display name of the sender."
              }
            },
            "required": [
              "personId",
              "name"
            ],
            "description": "The sender of the source email; present for `email`-sourced attachments."
          }
        },
        "required": [
          "_id",
          "name",
          "_created_at",
          "_created_by",
          "source",
          "mime_type",
          "size_bytes"
        ]
      },
      "description": "The page of attachments."
    }
  },
  "required": [
    "links",
    "meta",
    "data"
  ]
}