About
A Simple Public IP Address API
Want to get started right away? Don't wait, run one of the code samples below in your terminal and check it out!
IPv4
$ curl 'https://api.ipsimple.org?format=json'
IPv6
$ curl 'https://api6.ipsimple.org?format=json'
Why IpSimple?
Ever needed to get your public IP address programmatically? Maybe you're provisioning new cloud servers and need to know your IP -- maybe you're behind a corporate firewall and need to tunnel information -- whatever the reason: sometimes having a public IP address API is useful!
- Unlimited usage: No restrictions on the number of requests, even if you're making millions of requests.
- Seamless compatibility: Supports both IPv4 and IPv6 addresses, ensuring compatibility with all technologies.
- High availability: Hosted on Azure with a multi-zone and multi-region setup, guaranteeing reliability and uptime.
- Open source: Completely open source, fostering transparency and community contributions.
- Privacy-focused: No visitor information is ever logged, ensuring complete privacy.
- Future-proof: Built to last, with a commitment to maintaining the service indefinitely.
API Usage
Using IpSimple is straightforward. You have three options. You can get your public IP directly (in plain text), you can get your public IP in JSON format, or you can get your public IP information in JSONP format (useful for JavaScript developers).
IPv4
API URL | Response Type | Sample Output (IPv4) |
---|---|---|
https://api.ipsimple.org | text | 98.207.254.136 |
https://api.ipsimple.org?format=json | json | {"ip":"98.207.254.136"} |
IPv6
The api6.ipsimple.org is used for IPv6 requests only. If you don't have an IPv6 address, the request will fail.
API URL | Response Type | Sample Output (IPv6) |
---|---|---|
https://api6.ipsimple.org | text | 2a00:1450:400f:80d::200e |
https://api6.ipsimple.org?format=json | json | {"ip":"2a00:1450:400f:80d::200e"} |
Code Samples
This section contains some common usage patterns from a variety of programming languages. Want something included that isn't listed here? feel free to do a PR to this repo!
Bash
#!/bin/bash
ip=$(curl -s https://api.ipsimple.org)
echo "My public IP address is: $ip"
Python
from requests import get
ip = get('https://api.ipsimple.org').text
print('My public IP address is: {}'.format(ip))
JavaScript
fetch('https://api.ipsimple.org')
.then(response => response.text())
.then(ip => console.log('My public IP address is:', ip));
Libraries
If you want to use IpSimple in your favorite programming language, but want to keep your code nice and tidy, feel free to use one of our libraries below! They'll make your life a little bit easier and more enjoyable =)
NOTE: Don't see a library for your favorite programming language? If you create one, I'll be happy to link to it below! Just message us in the discussions area with the details and I'll gladly link to it!
Library URL | Language | Author | Official |
---|---|---|---|
https://github.com/ipsimple/go-ipsimple | Go | IpSimple | TODO |
https://github.com/ipsimple/python-ipsimple | Python | IpSimple | TODO |
https://github.com/ipsimple/js-ipsimple | JavaScript | IpSimple | TODO |