Table of Contents

API

Use ITFlow's API to work with ITFlow in scripts third-party applications.

The current version of the ITFlow API is v1. It can be accessed at itflow.example.com/api/v1/{module}/{function}.php

Generating an API Key

  1. Login and navigate to the Admin Settings page
  2. Select API Keys
  3. Select Create to open the New Key modal
  4. On Details tab, input the key name and expiration date. Select whether the key will allow access to all clients or a specific client
  5. On Keys tab, note down the API key and credential password and select the checkbox to confirm you've made a copy of the keys. You will not see these admin in the admin interface.
  6. Select Create to add the key into the database

Modules with API support at present

API Functions

Request Methods

Data Returned

Notes

API Docs/Examples

Documentation / an example of how to use a module API endpoint is shown on that module's doc page. Additional examples are available here.


API Reference Guide

Current API v1 Endpoints, Authentication, Examples, and Integration Guide

Quick Start Guide

Your First API Call in 5 Minutes

  1. Generate API Key
    1. Login to ITFlow as admin
    2. Navigate to Admin > API
    3. Click New Key
    4. Choose scope: All Clients (for testing) or Specific Client
    5. Copy the generated key
  1. Test Connection
curl "https://itflow.yourdomain.com/api/v1/clients/read.php?api_key=YOUR_KEY&limit=1"
  1. Expected Response
{
  "success": "True",
  "count": 1,
  "data": [{"client_id": "123", "client_name": "Example Corp"}]
}

API Overview

Source: ITFlow official documentation at docs.itflow.org/api

Standard Response Format

Source: ITFlow official API documentation

{
  "success": "True|False",
  "message": "Descriptive status message",
  "count": 50,
  "data": [
    {
      "id": 123,
      "field": "value"
    }
  ]
}

Authentication & Security

API Key Management

Best Practices

Source: MSP community recommendations and security standards

Currently Available Modules

Source: ITFlow official API documentation confirms these modules have API support:

Assets ''/api/v1/assets/''

Purpose: Computer and equipment inventory management

Source: ITFlow Assets Documentation

Complete Fields (from ITFlow Assets API Documentation):

{
  "asset_id": 123,
  "client_id": 456,
  "asset_name": "Sample Laptop",
  "asset_type": "Laptop",
  "asset_make": "Dell",
  "asset_model": "Optiplex",
  "asset_serial": "XYZ",
  "asset_os": "Win 10",
  "asset_ip": "",
  "asset_mac": "",
  "asset_status": "Deployed",
  "asset_purchase_date": "0000-00-00",
  "asset_warranty_expire": "0000-00-00",
  "install_date": "0000-00-00",
  "asset_notes": "",
  "asset_vendor_id": "",
  "asset_location_id": "",
  "asset_contact_id": "",
  "asset_network_id": ""
}

Certificates ''/api/v1/certificates/''

Purpose: SSL/TLS certificate management and expiration tracking

Source: ITFlow Certificates Documentation

Complete Fields (from ITFlow Certificates API Documentation):

{
  "certificate_id": 123,
  "client_id": 456,
  "certificate_name": "ITFlow Demo",
  "certificate_domain": "demo.itflow.org",
  "certificate_issued_date": "2024-01-01",
  "certificate_expire_date": "2025-01-01",
  "certificate_issuer": "Let's Encrypt",
  "certificate_public_key": "[Certificate content]",
  "certificate_notes": "Auto-renewal enabled"
}

Clients ''/api/v1/clients/''

Purpose: Customer/company management

Source: ITFlow Clients Documentation

Complete Fields (from ITFlow Clients API Documentation):

{
  "client_id": 111,
  "client_lead": 0,
  "client_name": "Let it burn Inc",
  "client_type": "Safety and Fire",
  "client_website": "example.com"
}

<wrap em>Note: Full field list is partially documented. The API returns numbered keys alongside named keys in the response format.</wrap>

Contacts ''/api/v1/contacts/''

Purpose: Individual contact management within client organizations

Source: ITFlow official API documentation lists contacts as supported module

Available Fields: Contact table structure includes fields like contact_department as confirmed by GitHub Issue #458, but complete API field specification is not fully documented.

Credentials ''/api/v1/credentials/''

Purpose: Password and login management (encrypted storage)

Source: ITFlow official API documentation lists credentials (logins) as supported module

Available Fields: Database migration scripts confirm login_folder_id field addition, but complete API field specification requires further documentation.

Domains ''/api/v1/domains/''

Purpose: Domain name management and renewal tracking

Source: ITFlow Domains Documentation

Complete Fields (from ITFlow Domains API Documentation):

{
  "domain_id": 123,
  "client_id": 456,
  "domain_name": "itflow.org",
  "domain_registrar": "GoDaddy",
  "domain_webhost": "SiteGround",
  "domain_expire": "2025-03-15",
  "domain_ip": "192.168.1.1",
  "domain_name_servers": "ns1.example.com, ns2.example.com",
  "domain_mail_servers": "mx1.example.com",
  "domain_notes": "Auto-renewal enabled"
}

Networks ''/api/v1/networks/''

Purpose: Network infrastructure documentation

Source: ITFlow official API documentation lists networks as supported module

Available Fields: Database migration scripts show network interface relationships, but complete API field specification requires further documentation.

Software ''/api/v1/software/''

Purpose: Software license and application tracking

Source: ITFlow official API documentation lists software as supported module

Status: Module confirmed as available but dedicated documentation page not found. Database includes software table as confirmed by installation scripts.

Tickets ''/api/v1/tickets/''

Purpose: Help desk and issue tracking

Source: ITFlow Tickets Documentation

Complete Fields (from ITFlow Tickets API Documentation):

{
  "ticket_id": 3,
  "ticket_prefix": "TCK-",
  "ticket_number": 3,
  "ticket_category": null,
  "ticket_subject": "Computer broken"
}

<wrap em>Note: Full field list is partially documented. The API returns numbered keys alongside named keys in the response format.</wrap>

Current API Capabilities

Standard Operations (All Modules)

Query Parameters (read.php endpoints)

Response Format (Standardized)

{
  "success": "True|False",
  "message": "Descriptive message",
  "count": 1,
  "data": [
    {
      // Record data with both numbered and named keys
    }
  ]
}

Current Authentication

API Key Generation

  1. Navigate to Admin panel in ITFlow
  2. Click on API section
  3. Click New Key to generate
  4. Choose scope: specific client or all clients
  5. Copy generated key for use

API Key Usage

Security Features

Current Limitations

Missing CRUD Operations

Missing Advanced Features

Missing Business Modules

Authentication Limitations

API Usage Examples

Get All Clients

GET /api/v1/clients/read.php?api_key=YOUR_KEY

Get Specific Asset

GET /api/v1/assets/read.php?api_key=YOUR_KEY&asset_id=123

Create New Ticket

POST /api/v1/tickets/create.php
Content-Type: application/json
 
{
  "api_key": "YOUR_KEY",
  "client_id": 456,
  "ticket_subject": "Printer offline",
  "ticket_details": "Office printer not responding",
  "ticket_priority": "Medium"
}

List Client Assets

GET /api/v1/assets/read.php?api_key=YOUR_KEY&client_id=456

Integration Capabilities

What Works Today

What's Missing for Full Automation

Error Handling & Troubleshooting

Standard Error Codes

Source: HTTP standard codes - ITFlow API observed behavior

Common Error Messages

Source: Observed API responses

{
  "success": "False",
  "message": "Invalid API key",
  "count": 0,
  "data": []
}

Troubleshooting Steps

Source: Community experience and ITFlow Installation Documentation

  1. API Key Issues
    • Verify key is correct (copy/paste errors common)
    • Check key scope (client-specific vs all clients)
    • Confirm key hasn't been deactivated
  1. Permission Errors
    • Add client_id parameter for scoped keys
    • Verify client_id exists and is accessible
  1. Server Errors
    • Check Apache/PHP error logs: /var/log/apache2/error.log
    • Verify ITFlow database connectivity
    • Check PHP memory limits for large requests
  1. Data Issues
    • Validate required fields for POST requests
    • Check data types (strings, integers, dates)
    • Verify foreign key relationships exist

Debug Mode

Source: ITFlow admin settings and ITFlow FAQ

Enable PHP error reporting in ITFlow settings for detailed error messages during development.

Integration Examples

PowerShell Examples

Source: ITFlow PowerShell Repository

List All Clients:

$apiKey = "YOUR-API-KEY"
$baseUrl = "https://itflow.yourdomain.com"
$uri = "$baseUrl/api/v1/clients/read.php?api_key=$apiKey"
 
Invoke-RestMethod -Uri $uri | ConvertTo-Json

Create New Asset:

$uri = "https://itflow.yourdomain.com/api/v1/assets/create.php"
$body = @{
    "api_key" = "YOUR-API-KEY"
    "asset_name" = "Sample Laptop"
    "asset_type" = "Laptop"
    "asset_make" = "Dell"
    "asset_model" = "Optiplex"
    "client_id" = "1"
} | ConvertTo-Json
 
Invoke-RestMethod -Method Post -Uri $uri -Body $body -ContentType "application/json"

PHP Examples

<?php
$api_key = 'YOUR_API_KEY';
$base_url = 'https://itflow.yourdomain.com/api/v1/';
 
// Get clients
$url = $base_url . 'clients/read.php?api_key=' . $api_key;
$response = file_get_contents($url);
$data = json_decode($response, true);
 
print_r($data);
?>

Python Examples

import requests
 
api_key = "YOUR_API_KEY"
base_url = "https://itflow.yourdomain.com/api/v1/"
 
# Get all clients
response = requests.get(f"{base_url}clients/read.php?api_key={api_key}")
data = response.json()
print(data)
 
# Create new ticket
ticket_data = {
    "api_key": api_key,
    "client_id": 456,
    "ticket_subject": "Network issue",
    "ticket_details": "Unable to access shared drive",
    "ticket_priority": "High"
}
 
response = requests.post(f"{base_url}tickets/create.php", json=ticket_data)
result = response.json()
print(result)