{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/faxterra-com/json-schema/faxterra-com-fax-schema.json",
  "title": "Fax",
  "x-generated": "2026-12-02",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/faxterra-com-openapi.json#/components/schemas/Fax",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "ref": {
      "type": "string"
    },
    "direction": {
      "const": "outbound"
    },
    "status": {
      "type": "string",
      "enum": [
        "pending",
        "payment_pending",
        "waiting_number",
        "queued",
        "sending",
        "retry_scheduled",
        "waiting_for_part",
        "awaiting_resume",
        "delivered",
        "delivered_partial",
        "failed",
        "cancelled"
      ],
      "description": "The status of the whole document. A long document goes as several faxes, and a call that breaks partway can be finished by another; each is in parts. delivered only when every page is; failed when it stopped with pages missing (pagesDelivered says how many arrived); cancelled when every part was stopped; while any part is still going, that part’s status. delivered_partial is a part status and never the document’s."
    },
    "to": {
      "type": "string"
    },
    "toName": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "from": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "pageCount": {
      "anyOf": [
        {
          "type": "integer",
          "description": "Pages in the whole document"
        },
        {
          "type": "null"
        }
      ]
    },
    "pagesDelivered": {
      "type": "integer",
      "description": "Pages of the document that reached the recipient so far"
    },
    "pageRanges": {
      "type": "object",
      "properties": {
        "delivered": {
          "anyOf": [
            {
              "type": "array",
              "items": {
                "type": "integer"
              },
              "minItems": 2,
              "maxItems": 2,
              "description": "First and last page that arrived; pages arrive in order"
            },
            {
              "type": "null"
            }
          ]
        },
        "notDelivered": {
          "anyOf": [
            {
              "type": "array",
              "items": {
                "type": "integer"
              },
              "minItems": 2,
              "maxItems": 2,
              "description": "Once the fax has stopped short: the first and last page that did not arrive"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "delivered",
        "notDelivered"
      ]
    },
    "pagesTransmitted": {
      "anyOf": [
        {
          "type": "integer",
          "description": "Pages the carrier reported sending, cover sheets included, across every part. Read pagesDelivered for the pages of the document that arrived."
        },
        {
          "type": "null"
        }
      ]
    },
    "coverPage": {
      "type": "boolean"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "submittedAt": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "deliveredAt": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "error": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "code": {
              "enum": [
                "busy",
                "no_answer",
                "not_a_fax_line",
                "call_dropped",
                "rejected",
                "invalid_number",
                "document_problem",
                "carrier_error",
                "number_not_ready",
                "insufficient_pages",
                "account_suspended",
                "cancelled",
                "unknown"
              ],
              "description": "Why it wasn't delivered: busy: The line was busy. Trying again later usually works. no_answer: No fax machine answered. Check the number, or try again later. not_a_fax_line: The number answered, but not as a fax machine. Check that it is a fax number. call_dropped: The call dropped before every page went through. Trying again usually works. rejected: The receiving line refused the call. invalid_number: The number cannot be called as a fax. Check it. document_problem: The document could not be faxed as it is. Fix or re-export it and send it again. carrier_error: The call could not be placed or finished. Trying again usually works; error.message says if the document needs uploading again. number_not_ready: The account's own fax number was not ready to send from. insufficient_pages: The account's pages did not cover the fax. account_suspended: Sending is turned off for this account. cancelled: The fax was stopped before every page went: by you, by us, when the offer to finish it lapsed, or because an earlier part failed or a newer copy replaced it. unknown: The fax was not delivered, for a reason this list does not name yet. error.message says what happened."
            },
            "message": {
              "type": "string",
              "description": "The status page’s explanation of the failure"
            }
          },
          "required": [
            "code",
            "message"
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "retry": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "at": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ]
            },
            "attempt": {
              "type": "integer"
            },
            "maxAttempts": {
              "type": "integer"
            }
          },
          "required": [
            "at",
            "attempt",
            "maxAttempts"
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "source": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "reference": {
      "anyOf": [
        {
          "type": "string",
          "description": "Your own id for the fax, as sent"
        },
        {
          "type": "null"
        }
      ]
    },
    "cost": {
      "type": "object",
      "properties": {
        "charged": {
          "type": "boolean",
          "description": "true once its pages arrived; false for a fax in progress (what it holds) or one that cost nothing"
        },
        "pages": {
          "type": "integer"
        },
        "unitsPerPage": {
          "type": "integer",
          "description": "More than 1 to a number outside the US and Canada"
        },
        "pageUnits": {
          "type": "integer"
        },
        "paidFrom": {
          "type": "object",
          "properties": {
            "included": {
              "type": "integer"
            },
            "free": {
              "type": "integer"
            },
            "credits": {
              "type": "integer"
            }
          },
          "required": [
            "included",
            "free",
            "credits"
          ]
        }
      },
      "required": [
        "charged",
        "pages",
        "unitsPerPage",
        "pageUnits",
        "paidFrom"
      ]
    },
    "test": {
      "type": "boolean",
      "description": "Sent to a test number: never dialled and never charged"
    },
    "parts": {
      "type": "array",
      "description": "Each fax the document went as, in page order: one for a fax sent in one piece. Any part’s id answers GET /faxes/{id} with the whole document.",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "ref": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "payment_pending",
              "waiting_number",
              "queued",
              "sending",
              "retry_scheduled",
              "waiting_for_part",
              "awaiting_resume",
              "delivered",
              "delivered_partial",
              "failed",
              "cancelled"
            ]
          },
          "firstPage": {
            "type": "integer"
          },
          "lastPage": {
            "type": "integer"
          },
          "pagesDelivered": {
            "type": "integer"
          }
        },
        "required": [
          "id",
          "ref",
          "status",
          "firstPage",
          "lastPage",
          "pagesDelivered"
        ]
      }
    },
    "nextCheckAfter": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "description": "When to check again; null once every part has finished."
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "required": [
    "id",
    "ref",
    "direction",
    "status",
    "to",
    "toName",
    "from",
    "pageCount",
    "pagesDelivered",
    "pageRanges",
    "pagesTransmitted",
    "coverPage",
    "createdAt",
    "submittedAt",
    "deliveredAt",
    "error",
    "retry",
    "source",
    "reference",
    "cost",
    "test",
    "parts",
    "nextCheckAfter"
  ]
}