Metadata-Version: 2.4
Name: infomaniak
Version: 0.2.0
Summary: CLI tool for managing Infomaniak services — DNS records, domains, and more.
Author-email: Doruk Tan Ozturk <peak@peaktwilight.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/peaktwilight/infomaniak-cli
Project-URL: Repository, https://github.com/peaktwilight/infomaniak-cli
Project-URL: Issues, https://github.com/peaktwilight/infomaniak-cli/issues
Keywords: infomaniak,dns,cli,domain,api
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Internet :: Name Service (DNS)
Classifier: Topic :: System :: Systems Administration
Classifier: Topic :: Utilities
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.32.4
Dynamic: license-file

# infomaniak

CLI tool for managing your [Infomaniak](https://www.infomaniak.com) services from the terminal.

Currently supports **DNS management** — more services planned.

## Install

### With pipx (recommended)

```bash
pipx install infomaniak
```

### With pip

```bash
pip install infomaniak
```

### From source

```bash
git clone https://github.com/peaktwilight/infomaniak-cli.git
cd infomaniak-cli
pip install .
```

## Configuration

### 1. Get an API token

1. Go to [Infomaniak API tokens](https://manager.infomaniak.com/v3/infomaniak-api)
2. Create a new token with these scopes:
   - `domain:read`
   - `dns:read`
   - `dns:write`
3. Copy the token

### 2. Set the token

**Option A** — environment variable:

```bash
export INFOMANIAK_API_TOKEN=your-token-here
```

**Option B** — `.env` file:

```bash
cp .env.example .env
# Edit .env and paste your token
```

## Usage

```bash
# List all domains
infomaniak dns domains

# List DNS records for a domain
infomaniak dns records example.com

# Filter by record type
infomaniak dns records example.com --type CNAME

# Check if a record resolves correctly
infomaniak dns check example.com 12345

# Create a new record
infomaniak dns add example.com A blog 93.184.216.34
infomaniak dns add example.com CNAME app target.example.net --ttl 300

# Update a record
infomaniak dns update example.com 12345 --target 93.184.216.35
infomaniak dns update example.com 12345 --ttl 300

# Delete a record (with confirmation)
infomaniak dns delete example.com 12345

# Delete without confirmation
infomaniak dns delete example.com 12345 --yes

# Show version
infomaniak --version
```

### Example output

```
$ infomaniak dns domains

Domains (2):

  ID       Domain           DNSSEC  DNS@IK
  ───────  ───────────────  ──────  ──────
  100001   example.com      yes     yes
  100002   example.org      yes     yes

$ infomaniak dns records example.com --type A

DNS records for example.com (type=A) — 2 records:

  ID      Type  Name  Target          TTL
  ──────  ────  ────  ──────────────  ────
  200001  A     @     93.184.216.34   3600
  200002  A     www   93.184.216.34   3600
```

## Why not OAuth?

Infomaniak's OAuth2 apps only support `openid`, `profile`, `email`, and `phone` scopes. The DNS management scopes (`domain:read`, `dns:read`, `dns:write`) are only available through API tokens — so there's no way to implement a browser-based login flow.

## API reference

Built on the [Infomaniak API](https://developer.infomaniak.com/docs/api):

| Endpoint | Description |
|---|---|
| `GET /1/domain/account/{id}` | List domains |
| `GET /2/zones/{zone}/records` | List DNS records |
| `POST /2/zones/{zone}/records` | Create record |
| `PUT /2/zones/{zone}/records/{id}` | Update record |
| `DELETE /2/zones/{zone}/records/{id}` | Delete record |
| `GET /2/zones/{zone}/records/{id}/check` | Check record health |

## License

MIT
