MyIpMeow Logo

JSON API Usage Examples

Fetch and parse your public IPv4 and IPv6 address from our JSON endpoint using your favorite tools!

← Back to API Docs
JSON Output Example
GET https://myipmeow.com/json
{
  "ipv4": "203.0.113.100",
  "ipv6": "2001:0db8:85a3:0000:0000:8a2e:0370:7334"
}
Parsing with curl and jq
Bash
curl -sL https://myipmeow.com/json | jq -r '.ipv4'
curl -sL https://myipmeow.com/json | jq -r '.ipv6'

Install jq: sudo apt-get install jq (Debian) or sudo yum install jq (RedHat)

Parsing with curl and grep
Bash
curl -sL https://myipmeow.com/json | grep -oP '(?<="ipv4": ")[^"]+'
curl -sL https://myipmeow.com/json | grep -oP '(?<="ipv6": ")[^"]+'
Parsing Both Addresses
Bash
addresses=$(curl -sL https://myipmeow.com/json)
ipv4=$(echo $addresses | jq -r '.ipv4')
ipv6=$(echo $addresses | jq -r '.ipv6')
echo "IPv4: $ipv4, IPv6: $ipv6"
Code Examples in Different Languages
PHP
<?php
$json = file_get_contents('https://myipmeow.com/json');
$data = json_decode($json, true);
echo $data['ipv4'];
echo $data['ipv6'];
?>
Python
import requests
r = requests.get('https://myipmeow.com/json')
data = r.json()
print(data['ipv4'])
print(data['ipv6'])