API Reference

API Reference

All REST endpoints are served through the Gateway. Base URL: https://gateway.apexmcp.ai

Interactive API explorer: https://gateway.apexmcp.ai/swagger


Authentication

All endpoints (except /oauth/token) require an X-API-Key header or Authorization: Bearer <token> header.


Endpoints

POST /oauth/token

Exchange client credentials for a Bearer JWT.

Request body (application/x-www-form-urlencoded):

ParameterRequiredDescription
grant_typeYesMust be client_credentials
client_idYesOAuth client ID
client_secretYesOAuth client secret
scopeNoSpace-separated scopes (default: mcp:call)

Response:

{
  "access_token": "eyJhbGci...",
  "token_type": "Bearer",
  "expires_in": 3600,
  "scope": "mcp:call"
}

GET /api/connectors

List all connectors in the authenticated organisation.

Response:

{
  "connectors": [
    {
      "id": "conn_01j9x8k2m3n4p5q6r7s8t9u0v1",
      "name": "production-db",
      "type": "postgresql",
      "status": "healthy",
      "tool_count": 12,
      "created_at": "2024-10-01T09:00:00Z"
    }
  ]
}

POST /api/connectors

Create a new connector.

Request body (application/json):

{
  "name": "production-db",
  "type": "postgresql",
  "config": {
    "host": "db.example.com",
    "port": 5432,
    "database": "mydb",
    "username": "apexmcp_ro",
    "password": "••••••••",
    "ssl": true
  }
}

Response: 201 Created with connector object.


GET /api/agents

List registered agents for the organisation.

Response:

{
  "agents": [
    {
      "id": "agent_01abc",
      "name": "reporting-agent",
      "created_at": "2024-10-15T12:00:00Z",
      "last_seen_at": "2024-11-15T14:32:01Z"
    }
  ]
}

POST /api/agents

Register a new agent identity (used for audit trail).

Request body:

{
  "name": "reporting-agent",
  "description": "Automated reporting pipeline"
}

Response: 201 Created with agent object.


GET /api/audit

Retrieve audit log entries for the organisation.

Query parameters:

ParameterTypeDescription
fromISO 8601Start of time range
toISO 8601End of time range
connector_idstringFilter by connector
agent_idstringFilter by agent
limitintegerMax entries (default 100, max 1000)
cursorstringPagination cursor from previous response

Response:

{
  "entries": [
    {
      "id": "aud_01xyz",
      "timestamp": "2024-11-15T14:32:01.482Z",
      "tool_name": "query_postgres_orders",
      "connector_id": "conn_01j9x8k2m3n4p5q6r7s8t9u0v1",
      "agent_id": "agent_01abc",
      "duration_ms": 143,
      "success": true,
      "error_code": null
    }
  ],
  "next_cursor": "aud_01abc"
}

POST /mcp/:orgSlug

The main MCP JSON-RPC endpoint. See MCP Protocol for full documentation.

Supported methods:

  • tools/list — list all available tools
  • tools/call — execute a tool

Error Responses

All API errors follow a consistent format:

{
  "error": {
    "code": "connector_not_found",
    "message": "No connector found with id conn_xxxx",
    "status": 404
  }
}
HTTP StatusMeaning
400Bad request — validation error
401Unauthenticated
403Forbidden — insufficient permissions
404Resource not found
409Conflict — resource already exists
422Unprocessable — semantic validation failed
429Rate limited
500Internal server error