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

Key Description Type Default Required Support Level
ips.[] string()|string()
ips List of IP addresses array() false

Fetch

GET /v2/accounts/{ACCOUNT_ID}/ips

This can take an optional query string parameter zone to filter the results.

curl -v -X GET \
    -H "X-Auth-Token: {AUTH_TOKEN}" \
    http://{SERVER}:8000/v2/accounts/{ACCOUNT_ID}/ips
{
    "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": {
        "ips": ["1.2.3.4", "5.6.7.8"]
    },
    "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}" \
    http://{SERVER}:8000/v2/accounts/{ACCOUNT_ID}/ips
{
    "auth_token": "{AUTH_TOKEN}",
    "data": {
        "ips": ["1.2.3.4", "5.6.7.8"]
    },
    "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": {
        "host": "proxy1.us-east.myswitch.com",
        "id": "1.2.3.4",
        "ip": "{IP_ADDRESS}",
        "status": "available",
        "type": "dedicated_ip",
        "zone": "us-east"
    },
    "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": {
        "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"
}

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 Piston_ips_maintenance add {IP} {ZONE} {HOST} command:

sup Piston_ips_maintenance add "1.2.3.4" "us-east" "proxy1.us-east.myswitch.com"
added IP 1.2.3.4 to available dedicated ips
Key Description Type Default Required
{IP} The IP address of the proxy string true
{ZONE} The Piston zone this proxy is assigned string true
{HOST} The Hostname associated with the IP string true

Once you've added IPs to the system, you can assign those to different customer accounts to proxy their calls through using the below 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/accounts/{ACCOUNT_ID}/ips