Skip to main content
POST
Create Condition
Creates a new automation condition that defines which logs should trigger evaluations.

Authentication

All endpoints require API key authentication:
Note: Use your API Key (not JWT token) for all requests. You can find your API keys in the Keywords AI platform under Settings > API Keys.

Required Fields

Optional Fields

Condition Policy Structure

The condition_policy object contains:
  • rules (array): Array of rule objects, each with:
    • field (string): Field to evaluate (e.g., "status_code", "latency", "model")
    • operator (string): Comparison operator (see available operators below)
    • value (any): Value to compare against
  • connector (string): How to combine rules ("AND" or "OR")

Available Operators

  • equals, not_equals
  • greater_than, less_than, greater_than_or_equal, less_than_or_equal
  • contains, not_contains
  • in, not_in

Available Fields

  • status_code: HTTP status code
  • latency: Request latency in seconds
  • total_tokens: Total token count
  • input_tokens: Input token count
  • output_tokens: Output token count
  • cost: Request cost
  • model: Model name
  • Any custom metadata field

Examples

Single Rule Condition

Multiple Rules Condition

Condition with Custom Metadata Field

Response

Status: 201 Created

Response Fields

Error Responses

400 Bad Request

401 Unauthorized

422 Unprocessable Entity