# IPstack: agents start here

Steps for AI coding agents that add IPstack to a project.

## 1. Get an API key

A person creates the account: an agent cannot sign up. Sign up at https://app.apilayer.com/signup/ipstack/ and subscribe to IPstack. The Free plan includes 100 requests / month and needs no credit card.

Copy the API key from the APILayer dashboard and give it to the agent as an environment variable (step 2).

## 2. Keep the key out of code

Read the key from an environment variable named `APILAYER_ACCESS_KEY`. Do not write the key into source code, commit it to git, or paste it into a chat.

Call IPstack from server code. The key travels in the request URL, so a request sent from a browser shows the key to every visitor.

```
# add .env to .gitignore
APILAYER_ACCESS_KEY=your_api_key
```

## 3. Make the first request

- Base URL: `https://api.apilayer.net/ipstack`
- Auth: `access_key` query parameter
- Formats: JSON, XML
- Endpoints:
  - `/{ip_address}` Standard lookup
  - `/check` Requester lookup
  - `/{ip_address},{ip_address}` Bulk lookup (Enterprise, up to 50 IPs)

```sh
curl "https://api.apilayer.net/ipstack/134.201.250.155?access_key=$APILAYER_ACCESS_KEY"
```

## 4. Check the plan before you use a feature

Each plan adds features to the plan before it. Check that the account's plan includes a feature before writing code that uses it.

| Plan | Requests / month | Adds |
|---|---|---|
| Free | 100 | SSL Encryption (HTTPS), Location Module |
| Starter | 50,000 | Time Zone Module, Connection Module, Currency Module, Standard Support included, Commercial use |
| Professional | 500,000 | Same features as Starter |
| Enterprise | 2,000,000 | Security Module, Bulk Endpoint support |

Prices: https://apilayer.com/products/ipstack/#pricing

## 5. Use the machine-readable docs

- IPstack documentation: https://docs.apilayer.com/apilayer/docs/ipstack
- APILayer llms.txt: https://apilayer.com/llms.txt