Base URL
The API is available at:You can also configure URL rewriting to use cleaner URLs like
http://your-domain/api/. See the Server Configuration section below.API Features
Session Management
- Initialize and terminate API sessions
- Manage user profiles and entities
- Session-based authentication with tokens
CRUD Operations
- Create: Add new items to ITSM-NG
- Read: Retrieve single items or collections
- Update: Modify existing items
- Delete: Remove items (with trash bin support)
Advanced Features
- Search Engine: Complex queries with multiple criteria
- Batch Operations: Create, update, or delete multiple items in one request
- Relationships: Retrieve related items (HATEOAS support)
- Expand Dropdowns: Get human-readable names instead of IDs
- File Upload/Download: Handle document attachments
Supported Content Types
The API supports the following content types:application/json- Primary format for all requests/responsesmultipart/form-data- For file uploadsapplication/x-www-form-urlencoded- For form data
HTTP Methods
The API uses standard HTTP methods:| Method | Purpose | Example |
|---|---|---|
| GET | Retrieve data | Get a computer, list tickets |
| POST | Create new items | Add a new user |
| PUT/PATCH | Update existing items | Modify a ticket |
| DELETE | Remove items | Delete an asset |
| OPTIONS | CORS preflight | Check allowed methods |
GET requests must have an empty body. All parameters should be passed in the URL query string.
Response Format
All API responses are returned in JSON format. Successful responses include the requested data, while errors return error codes and messages.Success Response Example
Error Response Example
Pagination
When retrieving collections, the API uses range-based pagination:- Default range:
0-50(first 51 items) - Custom range: Use the
rangeparameter (e.g.,range=100-149)
Item Types
The API works with ITSM-NG itemtypes - classes that inherit fromCommonDBTM. Common itemtypes include:
- Assets:
Computer,Monitor,Printer,Phone,NetworkEquipment - ITIL:
Ticket,Problem,Change - Management:
User,Group,Entity,Profile - Configuration:
Location,Manufacturer,Software
Search Options
Each itemtype has searchOptions - numbered field identifiers used for searching and filtering:1- typically the ID field2- typically the name field3+- various other fields
listSearchOptions endpoint to discover available fields for any itemtype.
Session Management
The API uses session-based authentication:- Call
initSessionto authenticate and receive asession_token - Include the
session_tokenin all subsequent requests - Call
killSessionwhen finished
By default, API sessions are read-only to support parallel calls. Only certain methods write to the session. You can override this with
session_write=true.IP Filtering
For security, the API can be restricted to specific IP addresses:- Configure IPv4 ranges and/or IPv6 addresses in ITSM-NG
- Navigate to: Setup > General > API
- Define API clients with allowed IP addresses
CORS Support
The API includes Cross-Origin Resource Sharing (CORS) headers:HATEOAS
The API supports HATEOAS (Hypermedia as the Engine of Application State) by including related resource links in responses:get_hateoas=false parameter.
Special Features
Expand Dropdowns
Convert foreign key IDs to human-readable names:Get SHA1 Signature
Retrieve a SHA1 hash instead of full data (useful for change detection):Additional Data
Retrieve related information withwith_* parameters:
with_devices- Hardware componentswith_disks- File systems (computers)with_softwares- Installed softwarewith_networkports- Network connectionswith_infocoms- Financial informationwith_contracts- Associated contractswith_documents- Attached documentswith_tickets- Related ticketswith_problems- Related problemswith_changes- Related changeswith_notes- Noteswith_logs- History/logs
Server Configuration
Apache HTTP Server
To enable URL rewriting, uncomment these lines in the root.htaccess file:
API Configuration
Enable and configure the API in ITSM-NG:- Navigate to Setup > General > API
- Enable the API
- Configure:
- Enable login with credentials: Allow user/password authentication
- Enable login with external token: Allow user_token authentication
- API Clients: Define applications with App-Tokens and IP restrictions
Quick Start Example
Next Steps
Authentication
Learn about authentication methods and token management
Error Handling
Understand error codes and how to handle them