{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/cm-com/main/json-schema/cm-com-api-porting-request-order-schema.json",
  "title": "Porting Request Order",
  "description": "Order for porting request retrieved from administration api",
  "x-generated": "2026-10-13",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cm-com-voice-number-requests-v1-openapi.yml#/components/schemas/ApiPortingRequestOrder",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Unique identifier",
      "format": "uuid"
    },
    "orderId": {
      "type": [
        "string",
        "null"
      ],
      "description": "The order id"
    },
    "createdOn": {
      "type": "string",
      "description": "Date and time of creation",
      "format": "date-time"
    },
    "portingData": {
      "$ref": "#/$defs/ApiPortingRequest"
    },
    "firstPossibleDate": {
      "type": [
        "string",
        "null"
      ],
      "description": "Date and time of the first possible date on which the porting can be performed",
      "format": "date-time"
    },
    "status": {
      "$ref": "#/$defs/ApiPortingRequestOrderStatus"
    },
    "statusReason": {
      "type": [
        "string",
        "null"
      ],
      "description": "Optional comment describing the reason for the current status of the porting request"
    },
    "errorDetails": {
      "type": [
        "string",
        "null"
      ],
      "description": "Optional error details showing the details of why a porting request has been blocked automatically"
    },
    "documents": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "#/$defs/ApiPortingRequestDocument"
      },
      "description": "Documents associated with this porting request (LoA, Telco Invoice, etc.)"
    }
  },
  "additionalProperties": false,
  "$defs": {
    "ApiPortingPhoneNumber": {
      "title": "Porting Phone Number",
      "type": "object",
      "properties": {
        "phoneNumber": {
          "minimum": 0,
          "exclusiveMinimum": true,
          "type": "integer",
          "description": "The (first) phone number to be ported.",
          "format": "int64"
        },
        "lastPhoneNumber": {
          "type": [
            "integer",
            "null"
          ],
          "description": "When a range of phone numbers are being ported, this number should be the last number in the range. If you are porting a single number, this value can be left empty.",
          "format": "int64"
        }
      },
      "additionalProperties": false,
      "description": "Phone number to be ported"
    },
    "ApiPortingRequest": {
      "title": "Porting Request",
      "type": "object",
      "properties": {
        "phoneNumbers": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/ApiPortingPhoneNumber"
          },
          "description": "Phone numbers to be ported over."
        },
        "providerCompanyName": {
          "type": [
            "string",
            "null"
          ],
          "description": "Company name of the current number provider."
        },
        "preferredPortingDateTime": {
          "type": [
            "string",
            "null"
          ],
          "description": "**Only used for porting non-dutch numbers.** Preferred date and time to port the phone number(s) in UTC time. Will be picked up between 6:00 and 20:00 UTC time. Should be null when the porting request should be handled as soon as possible.",
          "format": "date-time"
        },
        "companyProfileGuid": {
          "type": "string",
          "description": "Unique identifier of the company profile that will be operating the ported numbers.",
          "format": "uuid"
        },
        "comment": {
          "type": [
            "string",
            "null"
          ],
          "description": "Additional comment for customers to for example add a distribution group or IP address."
        },
        "callbackUrl": {
          "type": [
            "string",
            "null"
          ],
          "description": "URL that we'll send a POST request to when the status of the request has been updated. The body of this post request will contain the entire porting request order including the updated status."
        }
      },
      "additionalProperties": false,
      "description": "A porting requests that allows you to port you phone numbers from your current provider to the CM.com platform."
    },
    "ApiPortingRequestDocument": {
      "title": "Porting Request Document",
      "type": "object",
      "properties": {
        "documentType": {
          "type": [
            "string",
            "null"
          ],
          "description": "Type of document (LoA, TelcoInvoice, Other)"
        },
        "documentGuid": {
          "type": "string",
          "description": "Unique identifier of the document",
          "format": "uuid"
        },
        "uploadedAt": {
          "type": "string",
          "description": "Date and time when the document was uploaded",
          "format": "date-time"
        },
        "status": {
          "type": [
            "string",
            "null"
          ],
          "description": "Current status of the document (Pending, Approved, Rejected)"
        },
        "approvedAt": {
          "type": [
            "string",
            "null"
          ],
          "description": "Date and time when the document was approved (if applicable)",
          "format": "date-time"
        },
        "rejectionReason": {
          "type": [
            "string",
            "null"
          ],
          "description": "Reason for rejection if the document was rejected"
        },
        "fileName": {
          "type": [
            "string",
            "null"
          ],
          "description": "Original filename of the document"
        }
      },
      "additionalProperties": false,
      "description": "Represents a document associated with a porting request"
    },
    "ApiPortingRequestOrderStatus": {
      "title": "Porting Request Order Status",
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "description": "Unique identifier",
          "format": "int32"
        },
        "key": {
          "type": [
            "string",
            "null"
          ],
          "description": "Status key"
        },
        "displayValue": {
          "type": [
            "string",
            "null"
          ],
          "description": "The value to display"
        }
      },
      "additionalProperties": false,
      "description": "The status of a porting request"
    }
  }
}