{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/sinch/main/json-schema/sinch-number-order-schema.json",
  "title": "NumberOrder",
  "x-generated": "2026-10-08",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/sinch-numbers-api-openapi.yml#/components/schemas/NumberOrder",
  "type": "object",
  "properties": {
    "projectId": {
      "type": "string",
      "nullable": false
    },
    "idNumberOrder": {
      "type": "string",
      "nullable": false
    },
    "regionCode": {
      "$ref": "#/$defs/RegionCode"
    },
    "state": {
      "$ref": "#/$defs/NumberOrderState"
    },
    "numberType": {
      "$ref": "#/$defs/NumberType"
    },
    "orderNumbers": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/OrderNumber"
      }
    },
    "smsConfiguration": {
      "$ref": "#/$defs/OrderSmsConfiguration"
    },
    "voiceConfiguration": {
      "$ref": "#/$defs/OrderVoiceConfiguration"
    },
    "expireTime": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "createTime": {
      "type": "string",
      "nullable": false,
      "format": "date-time"
    },
    "updateTime": {
      "type": "string",
      "nullable": false,
      "format": "date-time"
    }
  },
  "$defs": {
    "NumberCapability": {
      "type": "string",
      "enum": [
        "SMS",
        "VOICE"
      ],
      "x-enumDescriptions": {
        "SMS": "The SMS product can use the number.",
        "VOICE": "The Voice product can use the number."
      },
      "default": "SMS",
      "description": "The capabilities the phone number supports: SMS, Voice, or both",
      "title": "Capability"
    },
    "NumberOrderState": {
      "type": "string",
      "x-enumDescriptions": {
        "NUMBER_ORDER_STATE_UNSPECIFIED": "State not specified.",
        "CREATED": "Created state.",
        "EXPIRED": "Expired state.",
        "IN_REVIEW": "Order in review.",
        "BLOCKED": "Order blocked.",
        "REJECTED": "Order rejected.",
        "COMPLETED": "Order completed."
      },
      "enum": [
        "NUMBER_ORDER_STATE_UNSPECIFIED",
        "CREATED",
        "EXPIRED",
        "IN_REVIEW",
        "BLOCKED",
        "REJECTED",
        "COMPLETED"
      ],
      "description": "The state of the number order",
      "title": "Number Order State"
    },
    "NumberPrice": {
      "type": "object",
      "properties": {
        "setupPrice": {
          "$ref": "#/$defs/money"
        },
        "monthlyPrice": {
          "$ref": "#/$defs/money"
        },
        "paymentIntervalMonths": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "NumberType": {
      "type": "string",
      "enum": [
        "MOBILE",
        "LOCAL",
        "TOLL_FREE"
      ],
      "x-enumDescriptions": {
        "MOBILE": "Numbers that belong to a specific range.",
        "LOCAL": "Numbers that are assigned to a specific geographic region.",
        "TOLL_FREE": "Numbers that are free of charge for the calling party but billed for all arriving calls."
      },
      "description": "The number type.",
      "title": "Type",
      "nullable": false
    },
    "OrderNumber": {
      "type": "object",
      "properties": {
        "phoneNumber": {
          "$ref": "#/$defs/PhoneNumber"
        },
        "numberPrice": {
          "$ref": "#/$defs/NumberPrice"
        },
        "capabilities": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/NumberCapability"
          }
        }
      }
    },
    "OrderSmsConfiguration": {
      "type": "object",
      "title": "KYC SMS Configuration",
      "description": "SMS Configuration for KYC numbers, containing the `servicePlanId` and `campaignId`.",
      "allOf": [
        {
          "$ref": "#/$defs/smsConfigurationBase"
        }
      ]
    },
    "OrderVoiceConfiguration": {
      "title": "OrderVoiceConfiguration",
      "type": "object",
      "oneOf": [
        {
          "$ref": "#/$defs/OrderVoiceConfigurationRTC"
        },
        {
          "$ref": "#/$defs/OrderVoiceConfigurationEST"
        },
        {
          "$ref": "#/$defs/OrderVoiceConfigurationFAX"
        }
      ]
    },
    "OrderVoiceConfigurationBase": {
      "title": "OrderVoiceConfigurationBase",
      "type": "object",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "$ref": "#/$defs/VoiceApplicationType"
        }
      }
    },
    "OrderVoiceConfigurationEST": {
      "title": "OrderVoiceConfigurationEST",
      "type": "object",
      "allOf": [
        {
          "$ref": "#/$defs/OrderVoiceConfigurationBase"
        },
        {
          "$ref": "#/$defs/VoiceConfigurationEST"
        }
      ]
    },
    "OrderVoiceConfigurationFAX": {
      "title": "OrderVoiceConfigurationFAX",
      "type": "object",
      "allOf": [
        {
          "$ref": "#/$defs/OrderVoiceConfigurationBase"
        },
        {
          "$ref": "#/$defs/VoiceConfigurationFAX"
        }
      ]
    },
    "OrderVoiceConfigurationRTC": {
      "title": "OrderVoiceConfigurationRTC",
      "type": "object",
      "allOf": [
        {
          "$ref": "#/$defs/OrderVoiceConfigurationBase"
        },
        {
          "$ref": "#/$defs/VoiceAppId"
        }
      ]
    },
    "PhoneNumber": {
      "type": "string",
      "description": "The phone number in [E.164](https://community.sinch.com/t5/Glossary/E-164/ta-p/7537) format with leading `+`. Example `+12025550134`.",
      "title": "Phone Number"
    },
    "ProvisioningStatus": {
      "default": "WAITING",
      "description": "The provisioning status. It will be either `WAITING`, `IN_PROGRESS` or `FAILED`. If the provisioning fails, a reason for the failure will be provided. [See a full list of provisioning error descriptions]<(https://developers.sinch.com/docs/numbers/api-reference/error-codes/provisioning-errors) and troubleshooting recommendations.",
      "enum": [
        "PROVISIONING_STATUS_UNSPECIFIED",
        "WAITING",
        "IN_PROGRESS",
        "FAILED"
      ],
      "x-enumDescriptions": {
        "PROVISIONING_STATUS_UNSPECIFIED": "The status is currently unknown.",
        "WAITING": "Waiting for provisioning",
        "IN_PROGRESS": "Provisioning in progress",
        "FAILED": "Provisioning failed. See [provisioning error descriptions](https://developers.sinch.com/docs/numbers/api-reference/error-codes/provisioning-errors)"
      },
      "title": "Provisioning Status"
    },
    "RegionCode": {
      "type": "string",
      "description": "ISO 3166-1 alpha-2 country code of the phone number. Example: US, GB or SE.",
      "title": "Region Code",
      "nullable": false
    },
    "ScheduledVoiceProvisioning": {
      "type": "object",
      "readOnly": true,
      "description": "Represents the ongoing or failed scheduled voice provisioning job. This field will be empty if the number was successfully provisioned provisioned for voice.",
      "required": [
        "type"
      ],
      "oneOf": [
        {
          "$ref": "#/$defs/ScheduledVoiceProvisioningEST"
        },
        {
          "$ref": "#/$defs/ScheduledVoiceProvisioningFAX"
        },
        {
          "$ref": "#/$defs/ScheduledVoiceProvisioningRTC"
        }
      ],
      "title": "Scheduled Voice Provisioning"
    },
    "ScheduledVoiceProvisioningCommon": {
      "type": "object",
      "required": [
        "type"
      ],
      "allOf": [
        {
          "type": "object",
          "properties": {
            "type": {
              "$ref": "#/$defs/VoiceApplicationType"
            },
            "lastUpdatedTime": {
              "type": "string",
              "description": "Timestamp when the status was last updated.",
              "format": "date-time",
              "readOnly": true
            },
            "status": {
              "$ref": "#/$defs/ProvisioningStatus"
            }
          }
        }
      ]
    },
    "ScheduledVoiceProvisioningEST": {
      "type": "object",
      "allOf": [
        {
          "$ref": "#/$defs/ScheduledVoiceProvisioningCommon"
        },
        {
          "$ref": "#/$defs/VoiceTrunkId"
        }
      ]
    },
    "ScheduledVoiceProvisioningFAX": {
      "type": "object",
      "allOf": [
        {
          "$ref": "#/$defs/ScheduledVoiceProvisioningCommon"
        },
        {
          "$ref": "#/$defs/VoiceServiceId"
        }
      ]
    },
    "ScheduledVoiceProvisioningRTC": {
      "type": "object",
      "allOf": [
        {
          "$ref": "#/$defs/ScheduledVoiceProvisioningCommon"
        },
        {
          "$ref": "#/$defs/VoiceAppId"
        }
      ]
    },
    "VoiceAppId": {
      "type": "object",
      "properties": {
        "appId": {
          "type": "string",
          "description": "Your app ID for the Voice API. The `appId` can be found in your [Sinch Customer Dashboard](https://dashboard.sinch.com/voice/apps)."
        }
      }
    },
    "VoiceApplicationType": {
      "type": "string",
      "description": "The voice application type. Examples are RTC, EST, FAX",
      "x-enumDescriptions": {
        "RTC": "Voice [see documentation](https://developers.sinch.com/docs/voice)",
        "EST": "Elastic SIP Trunking [see documentation](https://developers.sinch.com/docs/est)",
        "FAX": "FAX application [see documentation](https://developers.sinch.com/docs/fax/overview)"
      },
      "enum": [
        "RTC",
        "EST",
        "FAX"
      ],
      "default": "RTC"
    },
    "VoiceConfigurationCommon": {
      "title": "Common VoiceConfiguration fields",
      "type": "object",
      "properties": {
        "type": {
          "$ref": "#/$defs/VoiceApplicationType"
        },
        "lastUpdatedTime": {
          "type": "string",
          "description": "Timestamp when the status was last updated.",
          "format": "date-time",
          "readOnly": true
        },
        "scheduledVoiceProvisioning": {
          "readOnly": true,
          "allOf": [
            {
              "$ref": "#/$defs/ScheduledVoiceProvisioning"
            }
          ]
        }
      }
    },
    "VoiceConfigurationEST": {
      "title": "EST VoiceConfiguration",
      "type": "object",
      "required": [
        "type"
      ],
      "allOf": [
        {
          "$ref": "#/$defs/VoiceConfigurationCommon"
        },
        {
          "$ref": "#/$defs/VoiceTrunkId"
        }
      ]
    },
    "VoiceConfigurationFAX": {
      "title": "FAX VoiceConfiguration",
      "type": "object",
      "required": [
        "type"
      ],
      "allOf": [
        {
          "$ref": "#/$defs/VoiceConfigurationCommon"
        },
        {
          "$ref": "#/$defs/VoiceServiceId"
        }
      ]
    },
    "VoiceServiceId": {
      "type": "object",
      "properties": {
        "serviceId": {
          "type": "string",
          "description": "The service ID if the type is FAX. The `serviceId` can be found in your [Sinch Customer Dashboard](https://dashboard.sinch.com/fax/services)."
        }
      }
    },
    "VoiceTrunkId": {
      "type": "object",
      "properties": {
        "trunkId": {
          "type": "string",
          "description": "The trunk ID if the type is EST. The `trunkId` can be found in your [Sinch Customer Dashboard](https://dashboard.sinch.com/trunks/your-trunks)."
        }
      }
    },
    "money": {
      "type": "object",
      "description": "An object giving details on currency code and the amount charged.",
      "properties": {
        "currencyCode": {
          "type": "string",
          "description": "The 3-letter currency code defined in [ISO 4217](https://www.iso.org/iso-4217-currency-codes.html)."
        },
        "amount": {
          "type": "string",
          "description": "The amount in decimal form.\nFor example `2.00`.\nThere are no guarantees on the precision unless documented by the message origin. The amount cannot be updated and is read-only."
        }
      },
      "title": "Money"
    },
    "smsConfigurationBase": {
      "title": "Base SMS Configuration",
      "type": "object",
      "required": [
        "servicePlanId"
      ],
      "properties": {
        "servicePlanId": {
          "type": "string",
          "description": "The `servicePlanId` can be found in the [Sinch Customer Dashboard](https://dashboard.sinch.com/sms/api/rest). The service plan ID is what ties this number to the configured SMS service."
        },
        "campaignId": {
          "type": "string",
          "description": "Only for US phone numbers. This `campaignId` is required to send SMS traffic to US; click [here](https://community.sinch.com/t5/10DLC/What-is-10DLC/ta-p/7845) to read more about 10DLC A2P messaging. So, it is the current campaign ID for this number. The `campaignId` is found on your TCR platform."
        }
      }
    }
  }
}