IPs

About IPs

The IPs API allows users to manage the IP addresses assigned to their accounts. In the future they will be able to fully manage dedicated IPs.

The common use case is adding proxy IPs that must be used when routing calls to upstream resources. If the upstream requires traffic to come from a specific set of IPs, adding those IPs here will cause outbound calls to carriers to be routed through the IP(s) supplied.

Schema

IP addresses assigned to the account

KeyDescriptionTypeDefaultRequiredSupport Level
ips.[]string()
ipsList of IP addressesarray(string())false

IP addresses can be either ipv4 or ipv6.

Fetch

GET /v2/accounts/{ACCOUNT_ID}/ips

curl -v -X GET \
    -H "X-Auth-Token: {AUTH_TOKEN}" \
    http://{SERVER}:8000/v2/accounts/{ACCOUNT_ID}/ips

Query String Options

This request can take two optional query string parameters:

KeyDescriptionType
zonefilter the results by Zonestring()
quantitylimit the number of results. Default quantity is 1integer()
{
    "auth_token": "{AUTH_TOKEN}",
    "data": [
        {
            "ip": "1.2.3.4",
            "zone": "us-east"
        }
    ],
    "request_id": "{REQUEST_ID}",
    "revision": "{REVISION}",
    "status": "success"
}

Assign IPs to the account

POST /v2/accounts/{ACCOUNT_ID}/ips

curl -v -X POST \
    -H "X-Auth-Token: {AUTH_TOKEN}" \
    -d '{"data": {"ips" :["1.2.3.4", "5.6.7.8"]}}' \
    http://{SERVER}:8000/v2/accounts/{ACCOUNT_ID}/ips
{
    "auth_token": "{AUTH_TOKEN}",
    "data": {
        "success": {
            "1.2.3.4": {
                "assigned_to": "{ACCOUNT_ID}",
                "host": "proxy1.us-east.myswitch.com",
                "id": "1.2.3.4",
                "ip": "1.2.3.4",
                "status": "assigned",
                "type": "dedicated_ip",
                "zone": "us-east"
            },
            "5.6.7.8": {
                "assigned_to": "{ACCOUNT_ID}",
                "host": "proxy1.us-west.myswitch.com",
                "id": "5.6.7.8",
                "ip": "5.6.7.8",
                "status": "assigned",
                "type": "dedicated_ip",
                "zone": "us-west"
            }
        },
        "error": {}
    },
    "request_id": "{REQUEST_ID}",
    "revision": "{REVISION}",
    "status": "success"
}

Remove IPs from Account

DELETE /v2/accounts/{ACCOUNT_ID}/ips

curl -v -X DELETE \
    -H "X-Auth-Token: {AUTH_TOKEN}" \
    -d '{"data": {"ips" :["1.2.3.4", "5.6.7.8"]}}' \
    http://{SERVER}:8000/v2/accounts/{ACCOUNT_ID}/ips
{
    "auth_token": "{AUTH_TOKEN}",
    "data": {
        "success": {
            "1.2.3.4": {
                "host": "proxy1.us-east.myswitch.com",
                "id": "1.2.3.4",
                "ip": "1.2.3.4",
                "status": "available",
                "type": "dedicated_ip",
                "zone": "us-east"
            },
            "5.6.7.8": {
                "host": "proxy1.us-west.myswitch.com",
                "id": "5.6.7.8",
                "ip": "5.6.7.8",
                "status": "available",
                "type": "dedicated_ip",
                "zone": "us-west"
            }
        },
        "error": {}
    },
    "request_id": "{REQUEST_ID}",
    "revision": "{REVISION}",
    "status": "success"
}

Remove an IP assignment

DELETE /v2/accounts/{ACCOUNT_ID}/ips/{IP_ADDRESS}

curl -v -X DELETE \
    -H "X-Auth-Token: {AUTH_TOKEN}" \
    http://{SERVER}:8000/v2/accounts/{ACCOUNT_ID}/ips/{IP_ADDRESS}
{
    "auth_token": "{AUTH_TOKEN}",
    "data": {
        "success": {
            "{IP_ADDRESS}": {
                "host": "proxy1.us-east.myswitch.com",
                "id": "{IP_ADDRESS}",
                "ip": "{IP_ADDRESS}",
                "status": "available",
                "type": "dedicated_ip",
                "zone": "us-east"
            }
        },
        "error": {}
    },
    "request_id": "{REQUEST_ID}",
    "revision": "{REVISION}",
    "status": "success"
}

Fetch details of the assignment

GET /v2/accounts/{ACCOUNT_ID}/ips/{IP_ADDRESS}

curl -v -X GET \
    -H "X-Auth-Token: {AUTH_TOKEN}" \
    http://{SERVER}:8000/v2/accounts/{ACCOUNT_ID}/ips/{IP_ADDRESS}
{
    "auth_token": "{AUTH_TOKEN}",
    "data": {
        "assigned_to": "{ACCOUNT_ID}",
        "host": "proxy1.us-east.myswitch.com",
        "id": "{IP_ADDRESS}",
        "ip": "{IP_ADDRESS}",
        "status": "assigned",
        "type": "dedicated_ip",
        "zone": "us-east"
    },
    "request_id":"{REQUEST_ID}",
    "revision":"{REVISION}",
    "status":"success"
}

Assign a single IP to the account

POST /v2/accounts/{ACCOUNT_ID}/ips/{IP_ADDRESS}

curl -v -X POST \
    -H "X-Auth-Token: {AUTH_TOKEN}" \
    -d '{"data": {}}' \
    http://{SERVER}:8000/v2/accounts/{ACCOUNT_ID}/ips/{IP_ADDRESS}
{
    "auth_token": "{AUTH_TOKEN}",
    "data": {
        "success": {
            "{IP_ADDRESS}": {
                "assigned_to": "{ACCOUNT_ID}",
                "host": "proxy1.us-east.myswitch.com",
                "id": "{IP_ADDRESS}",
                "ip": "{IP_ADDRESS}",
                "status": "assigned",
                "type": "dedicated_ip",
                "zone": "us-east"
            }
        },
        "error": {}
    },
    "request_id":"{REQUEST_ID}",
    "revision":"{REVISION}",
    "status":"success"
}

Fetch hosts

GET /v2/accounts/{ACCOUNT_ID}/ips/hosts

curl -v -X GET \
    -H "X-Auth-Token: {AUTH_TOKEN}" \
    http://{SERVER}:8000/v2/accounts/{ACCOUNT_ID}/ips/hosts
{
    "auth_token": "{AUTH_TOKEN}",
    "data": [
        "proxy1.us-east.myswitch.com"
    ],
    "request_id": "{REQUEST_ID}",
    "revision": "{REVISION}",
    "status": "success"
}

Fetch zone listings

GET /v2/accounts/{ACCOUNT_ID}/ips/zones

curl -v -X GET \
    -H "X-Auth-Token: {AUTH_TOKEN}" \
    http://{SERVER}:8000/v2/accounts/{ACCOUNT_ID}/ips/zones
{
    "auth_token": "{AUTH_TOKEN}",
    "data": [
        "us-east"
    ],
    "request_id": "{REQUEST_ID}",
    "revision": "{REVISION}",
    "status": "success"
}

Fetch IPs assigned to this account

GET /v2/accounts/{ACCOUNT_ID}/ips/assigned

curl -v -X GET \
    -H "X-Auth-Token: {AUTH_TOKEN}" \
    http://{SERVER}:8000/v2/accounts/{ACCOUNT_ID}/ips/assigned
{
    "auth_token": "{AUTH_TOKEN}",
    "data": [
        {
            "ip": "1.2.3.4",
            "zone": "us-east"
        }
    ],
    "request_id": "{REQUEST_ID}",
    "revision": "{REVISION}",
    "status": "success"
}

Adding IPs to the system

Via SUP

IPs can be configured by the system admin using the sup kazoo_ips_maintenance add {IP} {ZONE} {HOST} command:

sup kazoo_ips_maintenance add "1.2.3.4" "us-east" "proxy1.us-east.myswitch.com"
added IP 1.2.3.4 to available dedicated ips
KeyDescriptionTypeDefaultRequired
{IP}The IP address of the proxystring()true
{ZONE}The Kazoo zone this proxy is assignedstring()true
{HOST}The Hostname associated with the IPstring()true

Once you’ve added IPs to the system, you can assign those to different customer accounts to proxy their calls through using the above Crossbar APIs.

Via API

Note

This requires a super duper admin access:

PUT /v2/ips

curl -v -X PUT \
    -H "X-Auth-Token: {AUTH_TOKEN}" \
    -d '{"data":{"ip":"1.2.3.4", "zone":"us-east", "host":"proxy1.us-east.myswitch.com"}}'
    http://{SERVER}:8000/v2/ips