Documentation
MyOpsAgent Overview API Reference Architecture Overview Customer Setup & Onboarding Guide Deployment & Environment Setup Guide Documentation Placement & Access Guide Error Codes & Operational Guarantees

Developer Documentation ยท Version 1.0

MyOpsAgent API Reference

The MyOpsAgent API provides secure, multi-tenant access to the MyOpsAgent decision engine. It is designed to be simple enough for small organisations to integrate quickly, yet robust enough to support enterprise-scale operational workloads.

This reference describes all available endpoints, authentication requirements, request and response formats, error structures, and operational guarantees. It is the definitive contract between your systems and the MyOpsAgent platform.

Base URL

All API interactions are performed over HTTPS and return JSON-encoded responses.

Base URL
https://myopsagent.com/api.php

All requests use the route query parameter to specify the operation.

Example
POST https://myopsagent.com/api.php?route=decide

Authentication

MyOpsAgent uses API keys to authenticate requests. There are two types of keys:

1. Organisation API Keys (Customer Keys)

These keys authenticate requests made by your organisation to the decide endpoint. Include them in the request headers:

Header
X-API-Key: <your_api_key>
  • Scoped to a single organisation
  • Revocable at any time
  • Used for all decision requests
  • Subject to rate limits and usage caps

2. Admin API Key

This key is used to manage organisations and their API keys. It should be stored securely and never exposed to customer systems.

Header
X-Admin-Key: <admin_key>

The admin key allows:

  • Creating API keys
  • Revoking API keys
  • Managing organisations

Content Type

All POST requests must include the following header:

Header
Content-Type: application/json

Endpoints

The MyOpsAgent API exposes four primary endpoints:

  • /?route=create_api_key
  • /?route=revoke_api_key
  • /?route=decide
  • /?route=health

Each endpoint is documented in detail below.

1. POST /?route=create_api_key

Creates a new API key for an organisation.

Headers

X-Admin-Key: <admin_key>
Content-Type: application/json

Request Body

JSON
{
  "org_id": 1,
  "label": "Production Key"
}

Response

JSON
{
  "status": "ok",
  "api_key": "0783392d76aaefcc916d89586670f19a718c6ef2c4d475fa51fbc92dc18bfbe6",
  "org_id": 1,
  "label": "Production Key",
  "correlation_id": "a6f2ae35d15b1c34283c7cbcb93859c5",
  "duration_ms": 1.3
}

Notes

  • API keys are long, cryptographically secure tokens.
  • Keys cannot be retrieved once lost; generate a new one instead.
  • Each key is associated with a label for easy identification.

2. POST /?route=revoke_api_key

Revokes an existing API key. Once revoked, the key can no longer be used to authenticate requests.

Headers

X-Admin-Key: <admin_key>
Content-Type: application/json

Request Body

JSON
{
  "api_key": "0783392d76aaefcc916d89586670f19a718c6ef2c4d475fa51fbc92dc18bfbe6"
}

Response

JSON
{
  "status": "ok",
  "api_key": "0783392d76aaefcc916d89586670f19a718c6ef2c4d475fa51fbc92dc18bfbe6",
  "correlation_id": "f9303db0a443c520117e8d72dfac93a8",
  "duration_ms": 0.9
}

Notes

  • Revocation is immediate.
  • Revoked keys cannot be reactivated.
  • Use this endpoint to rotate keys or remove compromised credentials.

3. POST /?route=decide

This is the core endpoint of the MyOpsAgent platform. It evaluates a work item, available resources, constraints, and context, and returns the optimal operational decision.

Headers

X-API-Key: <your_api_key>
Content-Type: application/json

Request Body Structure

The request body contains four main sections:

  • work_item
  • resources
  • constraints
  • context

Example Request

JSON
{
  "work_item": {
    "id": "WI-123",
    "required_capabilities": ["temperature", "pressure"],
    "location": null,
    "metadata": {}
  },
  "resources": [
    {
      "id": "engineer-001",
      "capabilities": ["temperature", "pressure"],
      "location": null,
      "availability": null,
      "metadata": {}
    }
  ],
  "constraints": [],
  "context": {
    "current_time": "2026-01-16T17:47:02Z",
    "org_rules": {},
    "environment": {}
  }
}

Response Structure

The response includes:

  • Chosen resource
  • Confidence score
  • Reasoning factors
  • Decision ID
  • Correlation ID
  • Engine version
  • Execution time

Example Response

JSON
{
  "decision_id": "ccf1e43c-8b7f-4e1a-bf2a-9f4d8c1a2e7f",
  "org_id": 1,
  "work_item_id": "WI-123",
  "chosen_resource_id": "engineer-001",
  "alternatives": {},
  "confidence": 0.5,
  "reasoning_factors": [
    {"factor": "capability_match", "weight": 0.5, "value": 1},
    {"factor": "distance", "weight": 0.3, "value": 0.5},
    {"factor": "availability", "weight": 0.2, "value": 0.5}
  ],
  "engine_version": "v1.0.0",
  "correlation_id": "d6b6ada7-3f2c-4b1e-8c5a-9e1f2b3c4d5e",
  "duration_ms": 4.98
}

Usage Limits

Each organisation has:

  • Per-minute rate limits
  • Daily usage caps
  • Monthly usage caps

If limits are exceeded, the API returns:

429 Too Many Requests

With error code:

HARD_USAGE_LIMIT_EXCEEDED

4. GET /?route=health

A simple health check endpoint.

Response

JSON
{
  "status": "ok",
  "service": "myopsagent",
  "time": "2026-01-16T17:47:02Z",
  "correlation_id": "f9303db0a443c520117e8d72dfac93a8",
  "duration_ms": 0
}

Error Handling

All errors follow a consistent structure:

JSON
{
  "status": "error",
  "error_code": "INVALID_INPUT",
  "message": "Description of the error",
  "correlation_id": "abc123",
  "duration_ms": 0.7
}

A full list of error codes is provided in the next document.

Operational Guarantees

  • Every request receives a correlation ID
  • Every decision is logged
  • Every API key is organisation-scoped
  • No cross-tenant data leakage
  • All decisions are deterministic
  • All responses are JSON encoded
  • All failures are graceful and structured