# Models

## ActiveProxyItem

```json
{
  "type": "object",
  "properties": {
    "ip": {
      "type": "string"
    },
    "username": {
      "type": "string"
    },
    "password": {
      "type": "string"
    },
    "http_port": {
      "type": "integer"
    },
    "socks_port": {
      "type": "integer"
    },
    "until": {
      "type": "string",
      "description": "ISO 8601 date string"
    },
    "status": {
      "type": "string"
    },
    "signature": {
      "type": "string",
      "nullable": true,
      "description": "p0f signature assigned to the IP, null when not set"
    }
  },
  "required": [
    "ip",
    "username",
    "password",
    "http_port",
    "socks_port",
    "until",
    "status"
  ]
}
```

## ApiError

```json
{
  "type": "object",
  "properties": {
    "success": {
      "type": "boolean"
    },
    "message": {
      "type": "string"
    }
  },
  "required": [
    "success",
    "message"
  ]
}
```

## AddonLine

```json
{
  "type": "object",
  "description": "One add-on line stored on an order",
  "properties": {
    "addon_key": {
      "type": "string"
    },
    "catalog_id": {
      "type": "integer"
    },
    "qty": {
      "type": "integer",
      "description": "Units active in the current period"
    },
    "price_per_unit": {
      "type": "integer",
      "description": "Unit price in cents at purchase time"
    },
    "pending": {
      "description": "Change scheduled for the next renewal, or `null`",
      "nullable": true,
      "type": "object",
      "properties": {
        "action": {
          "type": "string",
          "enum": [
            "cancel",
            "downgrade"
          ]
        },
        "next_qty": {
          "type": "integer",
          "description": "Target quantity after downgrade"
        }
      }
    }
  }
}
```

## PurchaseRequestDcIsp

```json
{
  "type": "object",
  "description": "Purchase for Datacenter/ISP; the location field is required.",
  "properties": {
    "product": {
      "type": "string",
      "enum": [
        "Datacenter Proxy",
        "ISP Proxy"
      ]
    },
    "location": {
      "type": "string"
    },
    "cycle": {
      "type": "string"
    },
    "quantity": {
      "type": "integer",
      "minimum": 1,
      "default": 1
    },
    "promo_code": {
      "type": "string",
      "nullable": true
    },
    "auto_renewal": {
      "type": "boolean",
      "default": false
    },
    "addons": {
      "type": "array",
      "nullable": true,
      "description": "Add-ons attached at purchase time, for example `p0f_slots` for DC or ISP",
      "items": {
        "$ref": "#/components/schemas/CreateOrderAddonRequest"
      }
    }
  },
  "required": [
    "product",
    "location",
    "cycle"
  ]
}
```

## PurchaseRequestResidentialStandard

```json
{
  "type": "object",
  "description": "Purchase for Standart Residential Proxy; location is not required; the cycle is fixed (lifetime).",
  "properties": {
    "product": {
      "type": "string",
      "enum": [
        "Standart Residential Proxy"
      ]
    },
    "quantity": {
      "type": "integer",
      "minimum": 1,
      "default": 1
    },
    "promo_code": {
      "type": "string",
      "nullable": true
    },
    "addons": {
      "type": "array",
      "nullable": true,
      "description": "Add-ons attached at purchase time, for example `p0f_slots` for DC or ISP",
      "items": {
        "$ref": "#/components/schemas/CreateOrderAddonRequest"
      }
    }
  },
  "required": [
    "product"
  ]
}
```

## PurchaseRequestResidentialPremium

```json
{
  "type": "object",
  "description": "Purchase for Premium Residential Proxy; location is not required; the cycle is fixed (lifetime).",
  "properties": {
    "product": {
      "type": "string",
      "enum": [
        "Premium Residential Proxy"
      ]
    },
    "quantity": {
      "type": "integer",
      "minimum": 1,
      "default": 1
    },
    "promo_code": {
      "type": "string",
      "nullable": true
    },
    "addons": {
      "type": "array",
      "nullable": true,
      "description": "Add-ons attached at purchase time, for example `p0f_slots` for DC or ISP",
      "items": {
        "$ref": "#/components/schemas/CreateOrderAddonRequest"
      }
    }
  },
  "required": [
    "product"
  ]
}
```

## PurchaseRequestResidentialUnmetered

```json
{
  "type": "object",
  "description": "Purchase for Unmetered Residential proxy; supports auto-renewal.",
  "properties": {
    "product": {
      "type": "string",
      "enum": [
        "Unmetered Residential proxy"
      ]
    },
    "cycle": {
      "type": "string"
    },
    "promo_code": {
      "type": "string",
      "nullable": true
    },
    "auto_renewal": {
      "type": "boolean",
      "default": false
    },
    "addons": {
      "type": "array",
      "nullable": true,
      "description": "Add-ons attached at purchase time, for example `p0f_slots` for DC or ISP",
      "items": {
        "$ref": "#/components/schemas/CreateOrderAddonRequest"
      }
    }
  },
  "required": [
    "product",
    "cycle"
  ]
}
```

## PurchaseRequest

```json
{
  "type": "object",
  "properties": {
    "product": {
      "type": "string"
    },
    "location": {
      "type": "string",
      "nullable": true
    },
    "cycle": {
      "type": "string"
    },
    "quantity": {
      "type": "integer",
      "minimum": 1,
      "default": 1
    },
    "promo_code": {
      "type": "string",
      "nullable": true
    },
    "auto_renewal": {
      "type": "boolean",
      "default": false
    },
    "addons": {
      "type": "array",
      "nullable": true,
      "description": "Add-ons attached at purchase time, for example `p0f_slots` for DC or ISP",
      "items": {
        "$ref": "#/components/schemas/CreateOrderAddonRequest"
      }
    }
  },
  "required": [
    "product",
    "cycle"
  ]
}
```

## PurchaseResponse

```json
{
  "type": "object",
  "properties": {
    "success": {
      "type": "boolean"
    },
    "message": {
      "type": "string"
    },
    "order_id": {
      "type": "integer"
    }
  },
  "required": [
    "success",
    "message",
    "order_id"
  ]
}
```

## ProductWithCycles

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string"
    },
    "description": {
      "type": "string",
      "nullable": true
    },
    "location": {
      "type": "string",
      "nullable": true
    },
    "cycles": {
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  },
  "required": [
    "name",
    "cycles"
  ]
}
```

## AvailableCountResponse

```json
{
  "type": "object",
  "properties": {
    "country": {
      "type": "string"
    },
    "product": {
      "type": "string"
    },
    "amount": {
      "type": "integer"
    }
  },
  "required": [
    "country",
    "product",
    "amount"
  ]
}
```

## ApiMeResponse

```json
{
  "type": "object",
  "properties": {
    "email": {
      "type": "string"
    },
    "active_orders": {
      "type": "integer"
    },
    "wallet_balance": {
      "type": "integer",
      "description": "in cents"
    }
  },
  "required": [
    "email",
    "active_orders",
    "wallet_balance"
  ]
}
```

## ApiSuccess

```json
{
  "type": "object",
  "properties": {
    "success": {
      "type": "boolean"
    }
  },
  "required": [
    "success"
  ]
}
```

## AvailableCountRequest

```json
{
  "type": "object",
  "properties": {
    "country": {
      "type": "string"
    },
    "product": {
      "type": "string"
    }
  },
  "required": [
    "country",
    "product"
  ]
}
```

## AddBandwidthRequest

```json
{
  "type": "object",
  "properties": {
    "amount": {
      "type": "integer",
      "description": "Amount in GB"
    },
    "promo_code": {
      "type": "string",
      "nullable": true
    }
  },
  "required": [
    "amount"
  ]
}
```

## GetSubUsersRequest

```json
{
  "type": "object",
  "properties": {
    "offset": {
      "type": "integer",
      "description": "Offset (default 0)"
    },
    "limit": {
      "type": "integer",
      "description": "Page size (default 20)"
    }
  }
}
```

## EditSubUserPayload

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string"
    }
  },
  "required": [
    "name"
  ]
}
```

## CreateSubUserPayload

```json
{
  "type": "object",
  "properties": {
    "proxy_type": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "data": {
      "type": "integer",
      "description": "Amount in GB"
    }
  },
  "required": [
    "proxy_type",
    "name",
    "data"
  ]
}
```

## ChangeSubUserPasswordPayload

```json
{
  "type": "object",
  "properties": {
    "proxy_type": {
      "type": "string"
    }
  },
  "required": [
    "proxy_type"
  ]
}
```

## ModifyTrafficPayload

```json
{
  "type": "object",
  "properties": {
    "proxy_type": {
      "type": "string"
    },
    "data": {
      "type": "integer",
      "description": "Amount in GB"
    }
  },
  "required": [
    "proxy_type",
    "data"
  ]
}
```

## Country

```json
{
  "type": "object",
  "properties": {
    "code": {
      "type": "string",
      "maxLength": 10,
      "description": "ISO country code"
    },
    "name": {
      "type": "string",
      "maxLength": 255,
      "description": "Country name"
    }
  },
  "required": [
    "code",
    "name"
  ]
}
```

## Region

```json
{
  "type": "object",
  "properties": {
    "code": {
      "type": "string",
      "maxLength": 10,
      "description": "Region or state code"
    },
    "name": {
      "type": "string",
      "maxLength": 255,
      "description": "Region or state name"
    },
    "country": {
      "$ref": "#/components/schemas/Country"
    }
  },
  "required": [
    "code",
    "name",
    "country"
  ]
}
```

## City

```json
{
  "type": "object",
  "properties": {
    "code": {
      "type": "string",
      "maxLength": 50,
      "description": "City code, usually a slug"
    },
    "name": {
      "type": "string",
      "maxLength": 255,
      "description": "City name"
    },
    "country": {
      "$ref": "#/components/schemas/Country"
    },
    "region": {
      "type": "object",
      "nullable": true,
      "properties": {
        "code": {
          "type": "string",
          "maxLength": 10,
          "description": "Region code"
        },
        "name": {
          "type": "string",
          "maxLength": 255,
          "description": "Region name"
        }
      },
      "required": [
        "code",
        "name"
      ]
    }
  },
  "required": [
    "code",
    "name",
    "country"
  ]
}
```

## PagedCountriesResponse

```json
{
  "type": "object",
  "properties": {
    "count": {
      "type": "integer"
    },
    "results": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/Country"
      }
    }
  },
  "required": [
    "count",
    "results"
  ]
}
```

## PagedRegionsResponse

```json
{
  "type": "object",
  "properties": {
    "count": {
      "type": "integer"
    },
    "results": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/Region"
      }
    }
  },
  "required": [
    "count",
    "results"
  ]
}
```

## PagedCitiesResponse

```json
{
  "type": "object",
  "properties": {
    "count": {
      "type": "integer"
    },
    "results": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/City"
      }
    }
  },
  "required": [
    "count",
    "results"
  ]
}
```

## Isp

```json
{
  "type": "object",
  "properties": {
    "code": {
      "type": "string",
      "description": "ISP code, usually a slug"
    },
    "name": {
      "type": "string",
      "description": "ISP name"
    },
    "country": {
      "$ref": "#/components/schemas/Country"
    },
    "region": {
      "type": "object",
      "nullable": true,
      "properties": {
        "code": {
          "type": "string",
          "description": "Region code"
        },
        "name": {
          "type": "string",
          "description": "Region name"
        }
      },
      "required": [
        "code",
        "name"
      ]
    }
  },
  "required": [
    "code",
    "name",
    "country"
  ]
}
```

## PagedIspsResponse

```json
{
  "type": "object",
  "properties": {
    "count": {
      "type": "integer"
    },
    "results": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/Isp"
      }
    }
  },
  "required": [
    "count",
    "results"
  ]
}
```

## CreateOrderAddonRequest

```json
{
  "type": "object",
  "properties": {
    "addon_key": {
      "type": "string",
      "example": "p0f_slots"
    },
    "qty": {
      "type": "integer",
      "minimum": 1
    }
  },
  "required": [
    "addon_key",
    "qty"
  ]
}
```
