{
 "openapi": "3.1.0",
 "info": {
  "title": "Extension Hooks (Platform)",
  "version": "20261030b",
  "description": "Rules attached to named points in a record's life: before or after it is saved, posted or approved, and when its status changes. A hook is a condition (the same expression language as custom rules) and one action: refuse with a message, warn, send on one of this company's webhooks, or write a log line. A hook cannot change a record or run code. New hooks start in dry run: evaluated and logged, never acting, until you switch them live. To fill in, work out, check, show or lock a field, use Custom Logic instead."
 },
 "servers": [
  {
   "url": "https://{tenant}.tranxact.ai",
   "variables": {
    "tenant": {
     "default": "demo"
    }
   }
  }
 ],
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  },
  "schemas": {
   "extension-hooks": {
    "type": "object",
    "required": [],
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid",
      "description": "Id",
      "readOnly": true
     },
     "org_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org id",
      "readOnly": true
     },
     "name": {
      "type": "string",
      "description": "Name",
      "readOnly": true
     },
     "description": {
      "type": "string",
      "description": "What it is for",
      "readOnly": true
     },
     "point": {
      "type": "string",
      "description": "Point",
      "enum": [
       "Before a record is saved",
       "After a record is saved",
       "Before a document is posted",
       "After a document is posted",
       "Before an approval is given",
       "After an approval is given",
       "Before the status changes",
       "After the status changed"
      ],
      "readOnly": true
     },
     "module_key": {
      "type": "string",
      "description": "Module key",
      "readOnly": true
     },
     "resource_key": {
      "type": "string",
      "description": "Resource key",
      "readOnly": true
     },
     "to_status": {
      "type": "array",
      "items": {
       "type": "string"
      },
      "description": "Only when moving to",
      "readOnly": true
     },
     "condition_expr": {
      "type": "string",
      "description": "Condition",
      "readOnly": true
     },
     "action_kind": {
      "type": "string",
      "description": "Does",
      "enum": [
       "Refuse with a message (before points only)",
       "Warn but allow (before points only)",
       "Send on a webhook (after points only)",
       "Only write it in the run log"
      ],
      "readOnly": true
     },
     "message": {
      "type": "string",
      "description": "Message",
      "readOnly": true
     },
     "message_expr": {
      "type": "string",
      "description": "Message (as an expression)",
      "readOnly": true
     },
     "webhook_id": {
      "type": "string",
      "format": "uuid",
      "description": "Webhook",
      "readOnly": true
     },
     "payload_map": {
      "type": "object",
      "description": "What is sent",
      "readOnly": true
     },
     "mode": {
      "type": "string",
      "description": "Mode",
      "readOnly": true
     },
     "is_active": {
      "type": "boolean",
      "description": "On",
      "readOnly": true
     },
     "sort_order": {
      "type": "integer",
      "description": "Order",
      "readOnly": true
     },
     "timeout_ms": {
      "type": "integer",
      "description": "Time budget (ms)",
      "readOnly": true
     },
     "max_per_minute": {
      "type": "integer",
      "description": "Runs per minute",
      "readOnly": true
     },
     "run_count": {
      "type": "string",
      "format": "decimal",
      "description": "Run count",
      "readOnly": true
     },
     "veto_count": {
      "type": "string",
      "format": "decimal",
      "description": "Veto count",
      "readOnly": true
     },
     "error_count": {
      "type": "string",
      "format": "decimal",
      "description": "Error count",
      "readOnly": true
     },
     "consecutive_errors": {
      "type": "integer",
      "description": "Consecutive errors",
      "readOnly": true
     },
     "last_run_at": {
      "type": "string",
      "format": "date-time",
      "description": "Last run at",
      "readOnly": true
     },
     "last_error": {
      "type": "string",
      "description": "Last error",
      "readOnly": true
     },
     "last_error_at": {
      "type": "string",
      "format": "date-time",
      "description": "Last error at",
      "readOnly": true
     },
     "created_by": {
      "type": "string",
      "format": "uuid",
      "description": "Created by",
      "readOnly": true
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "Created at",
      "readOnly": true
     },
     "updated_by": {
      "type": "string",
      "format": "uuid",
      "description": "Updated by",
      "readOnly": true
     },
     "updated_at": {
      "type": "string",
      "format": "date-time",
      "description": "Updated at",
      "readOnly": true
     },
     "xf_text_1": {
      "type": "string",
      "description": "Xf text 1",
      "readOnly": true
     },
     "xf_text_2": {
      "type": "string",
      "description": "Xf text 2",
      "readOnly": true
     },
     "xf_text_3": {
      "type": "string",
      "description": "Xf text 3",
      "readOnly": true
     },
     "xf_text_4": {
      "type": "string",
      "description": "Xf text 4",
      "readOnly": true
     },
     "xf_text_5": {
      "type": "string",
      "description": "Xf text 5",
      "readOnly": true
     },
     "xf_num_1": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 1",
      "readOnly": true
     },
     "xf_num_2": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 2",
      "readOnly": true
     },
     "xf_num_3": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 3",
      "readOnly": true
     },
     "xf_date_1": {
      "type": "string",
      "format": "date",
      "description": "Xf date 1",
      "readOnly": true
     },
     "xf_date_2": {
      "type": "string",
      "format": "date",
      "description": "Xf date 2",
      "readOnly": true
     }
    }
   }
  }
 },
 "security": [
  {
   "bearer": []
  }
 ],
 "paths": {
  "/api/platform/extension-hooks": {
   "get": {
    "summary": "list extension-hooks",
    "operationId": "list_extension_hooks_0_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "Post extension hooks",
    "operationId": "action_extension_hooks_1_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/platform/extension-hooks/{id}": {
   "get": {
    "summary": "get extension-hooks",
    "operationId": "get_extension_hooks_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "put": {
    "summary": "Put extension hooks",
    "operationId": "action_extension_hooks_1_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "Delete extension hooks",
    "operationId": "action_extension_hooks_2_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/platform/extension-hooks/vocabulary": {
   "get": {
    "summary": "Vocabulary",
    "operationId": "action_extension_hooks_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/platform/extension-hooks/{id}/go-live": {
   "post": {
    "summary": "Go live",
    "operationId": "action_extension_hooks_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/platform/extension-hooks/{id}/dry-run": {
   "post": {
    "summary": "Dry run",
    "operationId": "action_extension_hooks_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/platform/extension-hooks/{id}/test": {
   "post": {
    "summary": "Test",
    "operationId": "action_extension_hooks_0_6",
    "description": "Body keys: sample, recordId",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/platform/extension-hooks/choices/{kind}": {
   "get": {
    "summary": "Choices",
    "operationId": "action_extension_hooks_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/platform/extension-hooks/{id}/copy": {
   "post": {
    "summary": "Copy",
    "operationId": "action_extension_hooks_0_6",
    "description": "Body keys: overrides, preview, withLines",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  }
 }
}