MechaMental
Api reference

Router Policies

List Router Policies

GET
/v1/orgs/{org_id}/router-policies

Path Parameters

org_id*Org Id

Query Parameters

status?|null
enabled_only?Enabled Only
Defaultfalse
limit?Limit
Default50
Range1 <= value <= 100
cursor?string|null

Header Parameters

authorization?string|null

Response Body

application/json

application/json

curl -X GET "https://loading/v1/orgs/string/router-policies"
{
  "total": 0,
  "has_more": false,
  "next_cursor": "string",
  "policies": [
    {
      "policy_id": "string",
      "org_id": "string",
      "name": "string",
      "description": "string",
      "priority": 0,
      "match": {
        "endpoint_type": "string",
        "endpoint_id": "string",
        "step_type": "string",
        "purpose": "string",
        "workspace_id": "string",
        "workspace_tags": {
          "property1": "string",
          "property2": "string"
        },
        "expected_parallelism": "string",
        "requires_streaming": true,
        "requires_function_calling": true,
        "requires_vision": true,
        "tags": {
          "property1": "string",
          "property2": "string"
        }
      },
      "route_to": "string",
      "fallback": "string",
      "circuit_breaker": {
        "error_threshold_percent": 50,
        "latency_threshold_ms": 5000,
        "consecutive_failures": 5,
        "evaluation_window_seconds": 60,
        "min_requests_threshold": 10,
        "cooldown_seconds": 30,
        "half_open_requests": 3,
        "auto_disable": true,
        "notify_on_open": true
      },
      "status": "string",
      "enabled": true,
      "match_count": 0,
      "success_count": 0,
      "error_count": 0,
      "error_rate_percent": 0,
      "last_matched_at": "string",
      "tags": {
        "property1": "string",
        "property2": "string"
      },
      "created_by": "string",
      "created_at": "string",
      "updated_at": "string"
    }
  ]
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}

Create Router Policy

POST
/v1/orgs/{org_id}/router-policies

Path Parameters

org_id*Org Id

Header Parameters

authorization?string|null

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X POST "https://loading/v1/orgs/string/router-policies" \  -H "Content-Type: application/json" \  -d '{    "name": "string",    "match": {},    "route_to": "string"  }'
{
  "policy_id": "string",
  "org_id": "string",
  "name": "string",
  "description": "string",
  "priority": 0,
  "match": {
    "endpoint_type": "string",
    "endpoint_id": "string",
    "step_type": "string",
    "purpose": "string",
    "workspace_id": "string",
    "workspace_tags": {
      "property1": "string",
      "property2": "string"
    },
    "expected_parallelism": "string",
    "requires_streaming": true,
    "requires_function_calling": true,
    "requires_vision": true,
    "tags": {
      "property1": "string",
      "property2": "string"
    }
  },
  "route_to": "string",
  "fallback": "string",
  "circuit_breaker": {
    "error_threshold_percent": 50,
    "latency_threshold_ms": 5000,
    "consecutive_failures": 5,
    "evaluation_window_seconds": 60,
    "min_requests_threshold": 10,
    "cooldown_seconds": 30,
    "half_open_requests": 3,
    "auto_disable": true,
    "notify_on_open": true
  },
  "status": "string",
  "enabled": true,
  "match_count": 0,
  "success_count": 0,
  "error_count": 0,
  "error_rate_percent": 0,
  "last_matched_at": "string",
  "tags": {
    "property1": "string",
    "property2": "string"
  },
  "created_by": "string",
  "created_at": "string",
  "updated_at": "string"
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}

Get Router Policy

GET
/v1/orgs/{org_id}/router-policies/{policy_id}

Path Parameters

org_id*Org Id
policy_id*Policy Id

Header Parameters

authorization?string|null

Response Body

application/json

application/json

curl -X GET "https://loading/v1/orgs/string/router-policies/string"
{
  "policy_id": "string",
  "org_id": "string",
  "name": "string",
  "description": "string",
  "priority": 0,
  "match": {
    "endpoint_type": "string",
    "endpoint_id": "string",
    "step_type": "string",
    "purpose": "string",
    "workspace_id": "string",
    "workspace_tags": {
      "property1": "string",
      "property2": "string"
    },
    "expected_parallelism": "string",
    "requires_streaming": true,
    "requires_function_calling": true,
    "requires_vision": true,
    "tags": {
      "property1": "string",
      "property2": "string"
    }
  },
  "route_to": "string",
  "fallback": "string",
  "circuit_breaker": {
    "error_threshold_percent": 50,
    "latency_threshold_ms": 5000,
    "consecutive_failures": 5,
    "evaluation_window_seconds": 60,
    "min_requests_threshold": 10,
    "cooldown_seconds": 30,
    "half_open_requests": 3,
    "auto_disable": true,
    "notify_on_open": true
  },
  "status": "string",
  "enabled": true,
  "match_count": 0,
  "success_count": 0,
  "error_count": 0,
  "error_rate_percent": 0,
  "last_matched_at": "string",
  "tags": {
    "property1": "string",
    "property2": "string"
  },
  "created_by": "string",
  "created_at": "string",
  "updated_at": "string"
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}

Update Router Policy

PATCH
/v1/orgs/{org_id}/router-policies/{policy_id}

Path Parameters

org_id*Org Id
policy_id*Policy Id

Header Parameters

authorization?string|null

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X PATCH "https://loading/v1/orgs/string/router-policies/string" \  -H "Content-Type: application/json" \  -d '{}'
{
  "policy_id": "string",
  "org_id": "string",
  "name": "string",
  "description": "string",
  "priority": 0,
  "match": {
    "endpoint_type": "string",
    "endpoint_id": "string",
    "step_type": "string",
    "purpose": "string",
    "workspace_id": "string",
    "workspace_tags": {
      "property1": "string",
      "property2": "string"
    },
    "expected_parallelism": "string",
    "requires_streaming": true,
    "requires_function_calling": true,
    "requires_vision": true,
    "tags": {
      "property1": "string",
      "property2": "string"
    }
  },
  "route_to": "string",
  "fallback": "string",
  "circuit_breaker": {
    "error_threshold_percent": 50,
    "latency_threshold_ms": 5000,
    "consecutive_failures": 5,
    "evaluation_window_seconds": 60,
    "min_requests_threshold": 10,
    "cooldown_seconds": 30,
    "half_open_requests": 3,
    "auto_disable": true,
    "notify_on_open": true
  },
  "status": "string",
  "enabled": true,
  "match_count": 0,
  "success_count": 0,
  "error_count": 0,
  "error_rate_percent": 0,
  "last_matched_at": "string",
  "tags": {
    "property1": "string",
    "property2": "string"
  },
  "created_by": "string",
  "created_at": "string",
  "updated_at": "string"
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}

Delete Router Policy

DELETE
/v1/orgs/{org_id}/router-policies/{policy_id}

Path Parameters

org_id*Org Id
policy_id*Policy Id

Header Parameters

authorization?string|null

Response Body

application/json

curl -X DELETE "https://loading/v1/orgs/string/router-policies/string"
Empty
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}

Test Policy Matching

POST
/v1/orgs/{org_id}/router-policies/test-match

Path Parameters

org_id*Org Id

Header Parameters

authorization?string|null

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X POST "https://loading/v1/orgs/string/router-policies/test-match" \  -H "Content-Type: application/json" \  -d '{    "context": {}  }'
{
  "matched_policies": [
    {
      "policy_id": "string",
      "org_id": "string",
      "name": "string",
      "description": "string",
      "priority": 0,
      "match": {
        "endpoint_type": "string",
        "endpoint_id": "string",
        "step_type": "string",
        "purpose": "string",
        "workspace_id": "string",
        "workspace_tags": {
          "property1": "string",
          "property2": "string"
        },
        "expected_parallelism": "string",
        "requires_streaming": true,
        "requires_function_calling": true,
        "requires_vision": true,
        "tags": {
          "property1": "string",
          "property2": "string"
        }
      },
      "route_to": "string",
      "fallback": "string",
      "circuit_breaker": {
        "error_threshold_percent": 50,
        "latency_threshold_ms": 5000,
        "consecutive_failures": 5,
        "evaluation_window_seconds": 60,
        "min_requests_threshold": 10,
        "cooldown_seconds": 30,
        "half_open_requests": 3,
        "auto_disable": true,
        "notify_on_open": true
      },
      "status": "string",
      "enabled": true,
      "match_count": 0,
      "success_count": 0,
      "error_count": 0,
      "error_rate_percent": 0,
      "last_matched_at": "string",
      "tags": {
        "property1": "string",
        "property2": "string"
      },
      "created_by": "string",
      "created_at": "string",
      "updated_at": "string"
    }
  ],
  "selected_policy": {
    "policy_id": "string",
    "org_id": "string",
    "name": "string",
    "description": "string",
    "priority": 0,
    "match": {
      "endpoint_type": "string",
      "endpoint_id": "string",
      "step_type": "string",
      "purpose": "string",
      "workspace_id": "string",
      "workspace_tags": {
        "property1": "string",
        "property2": "string"
      },
      "expected_parallelism": "string",
      "requires_streaming": true,
      "requires_function_calling": true,
      "requires_vision": true,
      "tags": {
        "property1": "string",
        "property2": "string"
      }
    },
    "route_to": "string",
    "fallback": "string",
    "circuit_breaker": {
      "error_threshold_percent": 50,
      "latency_threshold_ms": 5000,
      "consecutive_failures": 5,
      "evaluation_window_seconds": 60,
      "min_requests_threshold": 10,
      "cooldown_seconds": 30,
      "half_open_requests": 3,
      "auto_disable": true,
      "notify_on_open": true
    },
    "status": "string",
    "enabled": true,
    "match_count": 0,
    "success_count": 0,
    "error_count": 0,
    "error_rate_percent": 0,
    "last_matched_at": "string",
    "tags": {
      "property1": "string",
      "property2": "string"
    },
    "created_by": "string",
    "created_at": "string",
    "updated_at": "string"
  },
  "logical_model_id": "string"
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}