The Trooper AI API provides comprehensive access to GPU server management, including server provisioning, monitoring, migration, and administrative functions. This RESTful API allows you to programmatically manage your GPU infrastructure, create and monitor server orders, handle templates, and perform administrative tasks.
API endpoints and the API documentation are currently in Beta. Contact us with any issues: Support Contacts.
You find your API key at the API Console.
Pro Tip: Just give this documentation to your Development LLM Agent and it will integrate it into your code.
https://james.trooper.ai
Most endpoints require Bearer token authentication using your Trooper API key:
Authorization: Bearer YOUR_API_KEY
Get your API key from the API Console.
All API responses are in JSON format. Successful responses typically include:
success
: Boolean indicating operation successError responses include:
error
: String describing the errornext
: Optional field suggesting next action (e.g., “login”)GET /api/test
Simple test endpoint to verify API connectivity.
GET /api/test
{
"test": "meinstring5"
}
GET /api/blibs
Retrieve all publicly available GPU server configurations.
GET /api/blibs
Authorization: Bearer YOUR_API_KEY # Optional - includes your private networks if provided
[
{
"id": 1,
"name": "powerai.example",
"gpu_type": "RTX 4090",
"gpu_num": 1,
"gpu_ram": 24,
"cpu_cores": 8,
"cpu_ram": 32,
"hdd": 500,
"price_h": 0.85,
"is_public": 1,
"country_code": "DE",
"is_available": true,
"available_hosts": ["ai18", "ai89"],
"fitCount": 2,
"maxPossibleInstances": 5
}
]
{
"error": "Error fetching Blibs"
}
GET /api/blibs-private
Retrieve GPU servers accessible to your account, including private configurations.
GET /api/blibs-private
Authorization: Bearer YOUR_API_KEY
[
{
"id": 2,
"name": "RTX 4090 Dual Private",
"gpu_type": "RTX 4090",
"gpu_num": 2,
"gpu_ram": 24,
"cpu_cores": 16,
"cpu_ram": 64,
"hdd": 1000,
"price_h": 1.65,
"is_public": 1,
"country_code": "DE"
}
]
{
"error": "Missing or invalid Authorization header"
}
POST /api/order
Create a new GPU server order. You must submit the price provided, otherwise the order will not be accepted. This makes sure the current price matches your expectations!
POST /api/order
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{
"blib_id": 1,
"price_h": 0.85,
"total_price": 0.85,
"terms_accepted": true,
"contract_interval": "HOUR",
"second_partition_percentage": 20,
"templates": [
{
"id": 1,
"name": "PyTorch Environment"
}
]
}
{
"success": true,
"orderId": 123
}
{
"error": "You must accept the terms and conditions."
}
{
"error": "Invalid or missing contract interval."
}
GET /api/orders
Retrieve all your server orders with detailed information.
When handling server statuses, consider the interplay between desired_status
and current_status
. For example, a server might have a desired_status
of “stopped”, but its current_status
could still be “running” if the stop process is in progress. Your application should account for these transitions and handle them accordingly.
GET /api/orders
Authorization: Bearer YOUR_API_KEY
machine_name
(optional): Filter by specific machine name[
{
"order_id": 123,
"serverId": 123,
"title": "My PyTorch Server",
"status": "running",
"status_user": "running",
"server_name": "gpu-server-01",
"machine_name": "ai99_trooperai_000123",
"ip": "192.168.1.100",
"ssh_port": 22001,
"price_h": 0.85,
"paid_until": "2025-09-26T14:30:00.000Z",
"contract_interval": "HOUR",
"is_locked": false,
"is_low_priority": false,
"blib_name": "RTX 4090 Single",
"blib_gpu_type": "RTX 4090",
"blib_gpu_num": 1,
"country_code": "DE",
"template_installs": [
{
"id": 1,
"template_name": "PyTorch Environment",
"status": 1,
"status_readable": "Completed"
}
]
}
]
{
"error": "Missing or invalid Authorization header",
"next": "login"
}
POST /api/order-status
Update your server order status (running, stopped, restarted, frozen).
Set "migration_allowed": true
if you approve host migration when transitioning from a frozen to running state. This process may take 10–90 minutes and will change the Ports Range and potentially the CPU model/speed.
POST /api/order-status
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{
"serverId": 123,
"action": "running",
"migration_allowed": false
}
{
"success": true,
"message": "Server start initiated successfully",
"status": "starting"
}
{
"success": false,
"error": "Server is locked and cannot be modified"
}
POST /api/order-title
Update the display title of your server.
POST /api/order-title
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{
"serverId": 123,
"title": "My New Server Title"
}
{
"success": true,
"message": "Title updated successfully"
}
POST /api/order-lock
Lock or unlock a server to prevent/allow status changes.
POST /api/order-lock
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{
"serverId": 123,
"is_locked": true
}
{
"success": true,
"updated": 1
}
POST /api/credentials
Retrieve SSH credentials and connection details for your server.
POST /api/credentials
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{
"serverId": 123
}
{
"success": true,
"ip": "192.168.1.100",
"ssh_port": 22001,
"username": "root",
"password": "generated-password",
"status": "running"
}
{
"error": "Access denied or server not found"
}
GET /api/order-status-history
Get the last 5 status changes for a server order.
GET /api/order-status-history?order_id=123
Authorization: Bearer YOUR_API_KEY
{
"success": true,
"history": [
{
"id": 1,
"status_user": "running",
"status_txt": "Server started successfully",
"status_since": "2025-09-25T10:30:00.000Z"
},
{
"id": 2,
"status_user": "stopped",
"status_txt": "Server stopped by user",
"status_since": "2025-09-25T08:15:00.000Z"
}
]
}
Migration is used to bring your GPU server to a different configuration. We don’t recommend to use this for production. But you can try if you like!
GET /api/migration-options
Get available server configurations for migration.
GET /api/migration-options?order_id=123
Authorization: Bearer YOUR_API_KEY
{
"success": true,
"currentOrder": {
"id": 123,
"title": "My Server",
"status": "running",
"contract_interval": "HOUR",
"paid_until": "2025-09-26T14:30:00.000Z"
},
"currentBlib": {
"id": 1,
"name": "RTX 4090 Single",
"gpu_type": "RTX 4090",
"gpu_num": 1,
"price_h": 0.85
},
"availableBlibs": [
{
"id": 2,
"name": "RTX 4090 Dual",
"gpu_type": "RTX 4090",
"gpu_num": 2,
"price_h": 1.65,
"is_available": true,
"additionalCostPerCycle": 0.80
}
]
}
POST /api/migration-cost
Calculate the cost for migrating to a different server configuration.
POST /api/migration-cost
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{
"order_id": 123,
"target_blib_id": 2
}
{
"success": true,
"upgradeCost": 15.50,
"remainingValue": 12.30,
"totalDue": 3.20,
"additionalCostPerCycle": 0.80,
"nextBillingDate": "2025-09-26T14:30:00.000Z",
"currentRate": {
"amount": 0.85,
"display": "€0.85/hour"
},
"newRate": {
"amount": 1.65,
"display": "€1.65/hour"
}
}
POST /api/buy-migration
Execute the migration to a new server configuration.
IMPORTANT If you pass invalid data here, nothing is guaranteed. Support team can not restore your order if you missuse this endpoint for buying migrations. We recommend using the UI Dashboard.
POST /api/buy-migration
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{
"order_id": 123,
"target_blib_id": 2,
"keep_data": true
}
{
"success": true,
"message": "Migration initiated successfully",
"new_order_id": 124
}
{
"error": "Insufficient budget for migration"
}
GET /api/templates
Get all available software templates.
GET /api/templates
Authorization: Bearer YOUR_API_KEY # Optional
[
{
"id": 1,
"name": "PyTorch Environment",
"description": "Pre-configured PyTorch environment with CUDA support",
"category": "Machine Learning",
"is_public": true,
"options": [
{
"id": 1,
"name": "Python Version",
"type": "select",
"default_value": "3.9",
"possible_values": "3.8,3.9,3.10"
}
]
}
]
GET /api/template-config
Get template installation configuration for a specific order.
GET /api/template-config?order_id=123
Authorization: Bearer YOUR_API_KEY
{
"success": true,
"templates": [
{
"install_id": 1,
"template_id": 1,
"template_name": "PyTorch Environment",
"status": 1,
"status_readable": "Completed",
"config": {
"python_version": "3.9"
}
}
]
}
POST /api/template-install-add
Install a new template on your server.
POST /api/template-install-add
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{
"order_id": 123,
"template_id": 1,
"config": {
"python_version": "3.9"
}
}
{
"success": true,
"install_id": 5,
"message": "Template installation queued"
}
POST /api/template-install-delete
Remove a template installation from your server.
POST /api/template-install-delete
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{
"install_id": 5
}
{
"success": true,
"message": "Template removal initiated"
}
POST /api/template-install-retry
Retry a failed template installation.
POST /api/template-install-retry
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{
"install_id": 5
}
{
"success": true,
"message": "Template installation retry initiated"
}
"Missing or invalid Authorization header"
: Authentication required"Invalid Trooper key"
: API key is invalid"Unauthorized access"
: Insufficient permissions"You must accept the terms and conditions"
: Terms not accepted in order creation"Invalid or missing contract interval"
: Contract interval must be HOUR, WEEK, or MONTH"Insufficient budget"
: Not enough budget for the operation"Server is locked and cannot be modified"
: Server is locked for modificationsAPI endpoints may be rate-limited to prevent abuse. If you exceed the rate limit, you’ll receive a 429 status code. Implement appropriate retry logic with exponential backoff.
For API support and questions, contact: support@trooper.ai
For any question related to the API please contact us: Support Contacts