{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/emailconnect/main/json-schema/emailconnect-attachment-info-schema.json",
  "title": "AttachmentInfo",
  "description": "A file stored for an email. Only offloaded files are listed: attachments delivered inline in the payload, excluded or rejected ones, and a file whose synchronous upload failed have no entry.",
  "x-generated": "2026-10-16",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/emailconnect-openapi.json#/components/schemas/AttachmentInfo",
  "type": "object",
  "required": [
    "fileId",
    "filename",
    "contentType",
    "size",
    "status",
    "failureReason",
    "storage",
    "storageConnectionName",
    "downloadUrl",
    "createdAt",
    "expiresAt",
    "downloadCount",
    "lastDownloadAt"
  ],
  "properties": {
    "fileId": {
      "type": "string"
    },
    "filename": {
      "type": "string"
    },
    "contentType": {
      "type": "string"
    },
    "size": {
      "type": "integer",
      "description": "Size in bytes"
    },
    "status": {
      "type": "string",
      "enum": [
        "pending",
        "completed",
        "failed",
        "expired"
      ],
      "description": "`pending`: still uploading. `completed`: available. `failed`: could not be stored. `expired`: the email reached the end of its retention."
    },
    "failureReason": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "content-unreadable",
        "storage-unreachable",
        "storage-rejected",
        "internal"
      ],
      "description": "Why storing failed. Set only when `status` is `failed`."
    },
    "storage": {
      "type": "string",
      "enum": [
        "platform",
        "custom"
      ],
      "description": "Whether the file is in EmailConnect storage or in your own bucket."
    },
    "storageConnectionName": {
      "type": [
        "string",
        "null"
      ],
      "description": "The name of your storage connection the file was stored through. Null for EmailConnect storage, and when the connection no longer exists."
    },
    "downloadUrl": {
      "type": "string",
      "description": "The tracked download URL on EmailConnect, as sent in the webhook payload."
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "expiresAt": {
      "type": "string",
      "format": "date-time",
      "description": "When the email, and with it this file and these statistics, is deleted."
    },
    "downloadCount": {
      "type": "integer",
      "description": "Times the download link was fetched. Counts redirects issued, not files received."
    },
    "lastDownloadAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "When the download link was last fetched."
    }
  }
}