Using the Infomaniak API to Automate Your Tasks | InfoSwitch - Migration vers Infomaniak

Back to blog Integrations

Using the Infomaniak API to Automate Your Tasks

The InfoSwitch Team 4 mai 2026 12 min read

Want to automate the management of your Infomaniak services? Create accounts programmatically, manage your domains, or interact with kDrive from your applications? The Infomaniak APIs make it possible. This technical guide shows you how to get started.

Discover Infomaniak

Overview of Infomaniak APIs

Infomaniak exposes several APIs to interact with its services:

  • Manager API – Product, user, and billing management
  • kDrive API – File management, sharing, metadata
  • Mail API – Mailbox, alias, and filter management
  • DNS API – DNS record management

The APIs follow REST standards and return JSON.

Authentication

Obtaining an API Token

  1. Log in to Infomaniak Manager
  2. Go to your profile → "API" or "Tokens"
  3. Create a new token
  4. Define the required permissions (scopes)
  5. Copy the generated token (it will not be displayed again)

Using the Token

Include the token in your request headers:

``` Authorization: Bearer YOUR_TOKEN_HERE ```

Token Security

  • Never commit a token to a Git repository
  • Use environment variables
  • Create tokens with the minimum required permissions
  • Revoke unused tokens

Usage Examples

List Your Products (Manager API)

```bash curl -X GET "https://api.infomaniak.com/1/products" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" ```

Response:

```json { "result": "success", "data": [ { "id": 12345, "name": "Mail Hosting", "status": "active" }, { "id": 12346, "name": "kSuite", "status": "active" } ] } ```

Upload a File to kDrive (kDrive API)

```bash curl -X POST "https://api.infomaniak.com/2/drive/{drive_id}/files/upload" \ -H "Authorization: Bearer YOUR_TOKEN" \ -F "file=@/path/to/file.pdf" \ -F "directory_id=1" ```

Add a DNS Record

```bash curl -X POST "https://api.infomaniak.com/1/domain/{domain_id}/dns/record" \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "type": "A", "source": "www", "target": "123.45.67.89", "ttl": 3600 }' ```

SDKs and Libraries

You can call the API directly with any language capable of making HTTP requests. Here are some examples:

Python

```python import requests API_TOKEN = "your_token" BASE_URL = "https://api.infomaniak.com" headers = { "Authorization": f"Bearer {API_TOKEN}", "Content-Type": "application/json" } # List products response = requests.get(f"{BASE_URL}/1/products", headers=headers) products = response.json() for product in products["data"]: print(f"{product['name']}: {product['status']}") ```

JavaScript (Node.js)

```javascript const axios = require('axios'); const API_TOKEN = process.env.INFOMANIAK_TOKEN; const BASE_URL = 'https://api.infomaniak.com'; const client = axios.create({ baseURL: BASE_URL, headers: { 'Authorization': `Bearer ${API_TOKEN}`, 'Content-Type': 'application/json' } }); // List products async function listProducts() { const response = await client.get('/1/products'); return response.data.data; } listProducts().then(products => { products.forEach(p => console.log(`${p.name}: ${p.status}`)); }); ```

PHP

```php Automation Use Cases

User Provisioning

Automate account creation when new team members join:

  1. HR registers the new hire in the HRIS
  2. A script detects the new entry
  3. Via the API, it creates the email account and kDrive access
  4. A welcome email is sent automatically

Automated Backup

Regularly download your kDrive data to another location:

  1. Scheduled script (cron) every night
  2. Lists recently modified files via the API
  3. Downloads the relevant files
  4. Stores them on a local NAS or Swiss Backup

Dynamic DNS Management

Update your DNS records automatically:

  1. Your public IP changes (connection without a static IP)
  2. A script detects the change
  3. Via the DNS API, it updates the A record
  4. Your domain always points to the correct IP

Reporting

Generate automatic reports on service usage:

  1. Weekly script
  2. Collects statistics via the various APIs
  3. Generates a report (PDF, email)
  4. Sends it to managers

Limits and Best Practices

Rate Limiting

APIs have request limits to prevent abuse:

  • Respect the documented limits
  • Implement delays between requests if necessary
  • Handle 429 (Too Many Requests) errors

Error Handling

APIs return explicit error codes:

  • 200 – Success
  • 400 – Malformed request
  • 401 – Invalid or expired token
  • 403 – Insufficient permissions
  • 404 – Resource not found
  • 429 – Too many requests
  • 500 – Server error

Handle these errors in your code for robust automations.

Idempotency

Design your scripts to be idempotent: running the same script twice should not create duplicates or errors.

Documentation

The official Infomaniak API documentation is available on the Infomaniak developer site. You will find:

  • Complete list of endpoints
  • Accepted parameters
  • Request and response examples
  • Version changelog

Need Help?

For complex integrations or custom development, InfoSwitch can assist you. We know the Infomaniak APIs well and can develop the automations you need.

Contact Us

Conclusion

Infomaniak APIs open up many automation possibilities. Whether for user provisioning, file management, or DNS administration, you can integrate Infomaniak into your automated workflows.

Start with simple scripts, test thoroughly, and expand gradually. The development investment is quickly recouped through daily time savings.

Discover Infomaniak

Ready to migrate to Infomaniak?

Contact us for a free 15-minute audit. We will analyze your situation and provide you with a personalized quote.

Request a free audit
Share this article:

Also read