HydraCore
API by router

Rules

List Rules

List business rules for the current tenant.

Optionally filter by instance_id or active status.

Owen F4 (inherited-default reads): non-admins see rows where customer_id == user.customer_id OR customer_id IS NULL (tenant-default rules are inherited by every customer). Tenant admins see every rule in the tenant.

"Round up the usual suspects." — Captain Renault, Casablanca

GET
/v1/rules
AuthorizationBearer <token>

In: header

Query Parameters

instance_id?Instance Id
active_only?Active Only
Defaultfalse

Header Parameters

X-Api-Key?X-Api-Key

Response Body

curl -X GET "https://loading/v1/rules?instance_id=497f6eca-6276-4993-bfeb-53cbbbba6f08&active_only=false" \  -H "X-Api-Key: string"
[
  {
    "actions": [
      {}
    ],
    "conditions": [
      {}
    ],
    "cooldown_seconds": 0,
    "created_at": "2019-08-24T14:15:22Z",
    "customer_id": "160c0c4b-9966-4dc1-a916-8407eb10d74e",
    "description": "string",
    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
    "instance_id": "06587974-2dbe-4e10-8bf9-38cce0f5a366",
    "is_active": true,
    "last_triggered_at": "2019-08-24T14:15:22Z",
    "name": "string",
    "priority": 0,
    "rule_key": "string",
    "tenant_id": "34f5c98e-f430-457b-a812-92637d0c6fd0",
    "trigger_count": 0,
    "trigger_event": "string",
    "updated_at": "2019-08-24T14:15:22Z"
  }
]
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

Create Rule

Create a new business rule.

Requires admin role. Validates trigger event, conditions, and actions.

Owen-locked strict-write contract: non-admin + customer_id=None is rejected. Tenant-default rules are admin-only. The list/read side honors inherited-default semantics (own + NULL visible), but writes stay strict so a within-customer admin can't mint fan-out rules.

"There are two types of people in this world: those with rules, and those who dig. You dig." — The Good, the Bad and the Ugly (paraphrased)

POST
/v1/rules
AuthorizationBearer <token>

In: header

Header Parameters

X-Api-Key?X-Api-Key
actions?Actions
Items1 <= items
conditions?Conditions
cooldown_seconds?Cooldown Seconds
Default300
Range0 <= value
customer_id?Customer Id

NULL = tenant-wide, set = customer-specific

description?Description
instance_id?Instance Id
is_active?Is Active
Defaulttrue
nameName
Length1 <= length <= 200
priority?Priority
Default0
Range0 <= value
rule_key?Rule Key

Override key — same key suppresses tenant rule

trigger_eventTrigger Event

Response Body

curl -X POST "https://loading/v1/rules" \  -H "X-Api-Key: string" \  -H "Content-Type: application/json" \  -d '{    "name": "string",    "trigger_event": "string"  }'
{
  "actions": [
    {}
  ],
  "conditions": [
    {}
  ],
  "cooldown_seconds": 0,
  "created_at": "2019-08-24T14:15:22Z",
  "customer_id": "160c0c4b-9966-4dc1-a916-8407eb10d74e",
  "description": "string",
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "instance_id": "06587974-2dbe-4e10-8bf9-38cce0f5a366",
  "is_active": true,
  "last_triggered_at": "2019-08-24T14:15:22Z",
  "name": "string",
  "priority": 0,
  "rule_key": "string",
  "tenant_id": "34f5c98e-f430-457b-a812-92637d0c6fd0",
  "trigger_count": 0,
  "trigger_event": "string",
  "updated_at": "2019-08-24T14:15:22Z"
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

List Replayable Services

List services registered for approval replay.

The frontend uses this to populate the require_approval service picker.

GET
/v1/rules/replayable-services

Response Body

curl -X GET "https://loading/v1/rules/replayable-services"
[
  {}
]

List Trigger Types

List all available trigger event types and their payload schemas.

The frontend uses this to populate the trigger selector and build dynamic condition forms.

"Choose wisely." — Grail Knight, Indiana Jones and the Last Crusade

GET
/v1/rules/trigger-types

Response Body

curl -X GET "https://loading/v1/rules/trigger-types"
[
  {
    "description": "string",
    "event": "string",
    "label": "string",
    "payload_fields": [
      {}
    ]
  }
]

Get Rule

Get a specific business rule by ID.

Owen F6 (inherited-default read): non-admins can read tenant- default rules (customer_id IS NULL) since those rules apply to them anyway. Other-customer rows still 403. Tenant admins read everything in the tenant.

"Elementary, my dear Watson." — Sherlock Holmes (never actually said it)

GET
/v1/rules/{rule_id}
AuthorizationBearer <token>

In: header

Path Parameters

rule_idRule Id
Formatuuid

Header Parameters

X-Api-Key?X-Api-Key

Response Body

curl -X GET "https://loading/v1/rules/497f6eca-6276-4993-bfeb-53cbbbba6f08" \  -H "X-Api-Key: string"
{
  "actions": [
    {}
  ],
  "conditions": [
    {}
  ],
  "cooldown_seconds": 0,
  "created_at": "2019-08-24T14:15:22Z",
  "customer_id": "160c0c4b-9966-4dc1-a916-8407eb10d74e",
  "description": "string",
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "instance_id": "06587974-2dbe-4e10-8bf9-38cce0f5a366",
  "is_active": true,
  "last_triggered_at": "2019-08-24T14:15:22Z",
  "name": "string",
  "priority": 0,
  "rule_key": "string",
  "tenant_id": "34f5c98e-f430-457b-a812-92637d0c6fd0",
  "trigger_count": 0,
  "trigger_event": "string",
  "updated_at": "2019-08-24T14:15:22Z"
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

Update Rule

Update an existing business rule.

Requires admin role. Only provided fields are updated.

Owen-locked strict-write: non-admin cannot mutate tenant-default rules even though they can READ them (inherited-default). "Improvise, adapt, overcome." — Bear Grylls (about updating rules on the fly)

PATCH
/v1/rules/{rule_id}
AuthorizationBearer <token>

In: header

Path Parameters

rule_idRule Id
Formatuuid

Header Parameters

X-Api-Key?X-Api-Key
actions?Actions
conditions?Conditions
cooldown_seconds?Cooldown Seconds
customer_id?Customer Id
description?Description
instance_id?Instance Id
is_active?Is Active
name?Name
priority?Priority
rule_key?Rule Key
trigger_event?Trigger Event

Response Body

curl -X PATCH "https://loading/v1/rules/497f6eca-6276-4993-bfeb-53cbbbba6f08" \  -H "X-Api-Key: string" \  -H "Content-Type: application/json" \  -d '{}'
{
  "actions": [
    {}
  ],
  "conditions": [
    {}
  ],
  "cooldown_seconds": 0,
  "created_at": "2019-08-24T14:15:22Z",
  "customer_id": "160c0c4b-9966-4dc1-a916-8407eb10d74e",
  "description": "string",
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "instance_id": "06587974-2dbe-4e10-8bf9-38cce0f5a366",
  "is_active": true,
  "last_triggered_at": "2019-08-24T14:15:22Z",
  "name": "string",
  "priority": 0,
  "rule_key": "string",
  "tenant_id": "34f5c98e-f430-457b-a812-92637d0c6fd0",
  "trigger_count": 0,
  "trigger_event": "string",
  "updated_at": "2019-08-24T14:15:22Z"
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

Delete Rule

Delete a business rule.

Requires admin role. Gone forever — no soft delete. Strict-write: non-admin cannot delete tenant-default rules. "Hasta la vista, baby." — T-800, Terminator 2

DELETE
/v1/rules/{rule_id}
AuthorizationBearer <token>

In: header

Path Parameters

rule_idRule Id
Formatuuid

Header Parameters

X-Api-Key?X-Api-Key

Response Body

curl -X DELETE "https://loading/v1/rules/497f6eca-6276-4993-bfeb-53cbbbba6f08" \  -H "X-Api-Key: string"
Empty
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

Test Rule

Dry-run test a rule against a sample payload.

Evaluates conditions but does NOT execute actions. Strict-write boundary — non-admin cannot dry-run a tenant-default rule.

"This is a test. This is only a test." — Emergency Broadcast System

POST
/v1/rules/{rule_id}/test
AuthorizationBearer <token>

In: header

Path Parameters

rule_idRule Id
Formatuuid

Header Parameters

X-Api-Key?X-Api-Key
payloadPayload

Sample event payload to test against

Empty Object

Response Body

curl -X POST "https://loading/v1/rules/497f6eca-6276-4993-bfeb-53cbbbba6f08/test" \  -H "X-Api-Key: string" \  -H "Content-Type: application/json" \  -d '{    "payload": {}  }'
{
  "actions_that_would_fire": [
    {}
  ],
  "all_conditions_met": true,
  "condition_results": [
    {}
  ],
  "rule_id": "728c1541-d6d1-4290-9a53-cdf01dd32d60",
  "rule_name": "string"
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}