# OpenProvider Skill

Manage domains at OpenProvider via REST API.

## Credentials
File: `~/.config/openprovider.env`
```
OP_USERNAME=johan.jongsma@iasobackup.com
OP_PASSWORD=!!Helder06
```

## Authentication
Tokens are short-lived. Get a new one each session:
```bash
TOKEN=$(curl -s -X POST "https://api.openprovider.eu/v1beta/auth/login" \
  -H "Content-Type: application/json" \
  -d '{"username":"johan.jongsma@iasobackup.com","password":"!!Helder06"}' \
  | python3 -c "import json,sys;print(json.load(sys.stdin)['data']['token'])")
```

## Common Operations

### List all domains
```bash
curl -s "https://api.openprovider.eu/v1beta/domains" \
  -H "Authorization: Bearer $TOKEN" | python3 -c "
import json,sys
d=json.load(sys.stdin)
for dom in d['data']['results']:
    name = dom['domain']['name'] + '.' + dom['domain']['extension']
    print(f\"{name:30s} id={dom['id']} exp={dom.get('expiration_date','')} status={dom.get('status','')}\")
"
```

### Change nameservers
```bash
curl -s -X PUT "https://api.openprovider.eu/v1beta/domains/{DOMAIN_ID}" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name_servers":[{"name":"ns1.example.com"},{"name":"ns2.example.com"}]}'
```

### Check domain availability
```bash
curl -s "https://api.openprovider.eu/v1beta/domains/check" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"domains":[{"name":"example","extension":"com"}]}'
```

### Get TLD pricing
```bash
curl -s "https://api.openprovider.eu/v1beta/tlds/{EXT}?with_price=true" \
  -H "Authorization: Bearer $TOKEN"
```
Prices returned as `reseller` (our cost, EUR) and `product` (retail, USD).

### Get domain details
```bash
curl -s "https://api.openprovider.eu/v1beta/domains/{DOMAIN_ID}" \
  -H "Authorization: Bearer $TOKEN"
```

## Domain IDs (current)
| Domain | ID |
|---|---|
| busel.nl | 4144291 |
| e-consultants.nl | 4156002 |
| harryhaasjes.nl | 4167447 |
| johanjongsma.nl | 4177800 |
| muskepo.nl | 4191527 |
| zavtra.nl | 4237496 |
| 851brightwaters.com | 4376894 |
| inou.com | 4402885 |
| jongsma.me | 4404264 |
| muskepo.com | 4409213 |
| stpetersburgaquatics.com | 4418712 |
| unbelievable.club | 7303826 |
| x4.trading | 15826788 |
| localbackup.in | 25623799 |
| flourishevents.nl | 28736352 |

## Notes
- .ai domains require 2-year minimum registration
- Cloudflare does NOT support .nl or .in as registrar TLDs
- Strategy: DNS at Cloudflare, registrar stays at OpenProvider
- ~€80 credits remaining, use them as domains renew
- API base: `https://api.openprovider.eu/v1beta/`
