Fini Rules API

The Rules API from Fini — 6 operation(s) for rules.

OpenAPI Specification

fini-rules-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Fini AI Agents Rules API
  version: v2
  description: Public REST API for Fini AI, the self-improving AI agent for enterprise customer support. Manage agents, conversations, knowledge (sources, articles, folders), rules, tags, and prompts, and drive the agent loop via Generate Answer. Structure captured by API Evangelist from the published Fini API reference; not an official Fini-published OpenAPI.
  contact:
    name: Fini AI
    url: https://docs.usefini.com/en/api-reference/authentication
  x-apis-json-generated: true
servers:
- url: https://api-prod.usefini.com/v2
  description: Production
security:
- bearerAuth: []
tags:
- name: Rules
paths:
  /hc-rules/public:
    post:
      operationId: createRule
      summary: Create a published rule.
      tags:
      - Rules
      description: Create a published rule. Requires the `write` scope.
      externalDocs:
        url: https://docs.usefini.com/en/api-reference/create-rule
      responses:
        '200':
          description: Successful response.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/ServerError'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
        description: See the Fini API reference for the request body schema.
    get:
      operationId: listRules
      summary: List rules in the workspace by type and draft state.
      tags:
      - Rules
      description: List rules in the workspace by type and draft state. Requires the `read` scope.
      externalDocs:
        url: https://docs.usefini.com/en/api-reference/list-rules
      responses:
        '200':
          description: Successful response.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/ServerError'
  /hc-rules/draft/public:
    post:
      operationId: createRuleDraft
      summary: Generate a draft rule from instructions.
      tags:
      - Rules
      description: Generate a draft rule from instructions. Requires the `write` scope.
      externalDocs:
        url: https://docs.usefini.com/en/api-reference/create-rule-draft
      responses:
        '200':
          description: Successful response.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/ServerError'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
        description: See the Fini API reference for the request body schema.
  /hc-rules/{id}/public:
    delete:
      operationId: deleteRule
      summary: Delete one rule.
      tags:
      - Rules
      description: Delete one rule. Requires the `write` scope.
      externalDocs:
        url: https://docs.usefini.com/en/api-reference/delete-rule
      responses:
        '200':
          description: Successful response.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/ServerError'
        '404':
          $ref: '#/components/responses/NotFound'
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
        description: The id path parameter.
    get:
      operationId: getRule
      summary: Fetch one rule by ID with its full tree.
      tags:
      - Rules
      description: Fetch one rule by ID with its full tree. Requires the `read` scope.
      externalDocs:
        url: https://docs.usefini.com/en/api-reference/get-rule
      responses:
        '200':
          description: Successful response.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/ServerError'
        '404':
          $ref: '#/components/responses/NotFound'
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
        description: The id path parameter.
    patch:
      operationId: updateRule
      summary: Update an existing rule.
      tags:
      - Rules
      description: Update an existing rule. Requires the `write` scope.
      externalDocs:
        url: https://docs.usefini.com/en/api-reference/update-rule
      responses:
        '200':
          description: Successful response.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/ServerError'
        '404':
          $ref: '#/components/responses/NotFound'
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
        description: The id path parameter.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
        description: See the Fini API reference for the request body schema.
  /hc-rules/{id}/duplicate/public:
    post:
      operationId: duplicateRule
      summary: Create a copy of an existing rule.
      tags:
      - Rules
      description: Create a copy of an existing rule. Requires the `write` scope.
      externalDocs:
        url: https://docs.usefini.com/en/api-reference/duplicate-rule
      responses:
        '200':
          description: Successful response.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/ServerError'
        '404':
          $ref: '#/components/responses/NotFound'
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
        description: The id path parameter.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
        description: See the Fini API reference for the request body schema.
  /hc-rules/{id}/publish/public:
    post:
      operationId: publishRuleDraft
      summary: Publish a draft rule and assign it to one or more agents.
      tags:
      - Rules
      description: Publish a draft rule and assign it to one or more agents. Requires the `write` scope.
      externalDocs:
        url: https://docs.usefini.com/en/api-reference/publish-rule-draft
      responses:
        '200':
          description: Successful response.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/ServerError'
        '404':
          $ref: '#/components/responses/NotFound'
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
        description: The id path parameter.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
        description: See the Fini API reference for the request body schema.
  /hc-rules/{id}/refine/public:
    post:
      operationId: refineRuleDraft
      summary: Regenerate a draft rule using refinement instructions.
      tags:
      - Rules
      description: Regenerate a draft rule using refinement instructions. Requires the `write` scope.
      externalDocs:
        url: https://docs.usefini.com/en/api-reference/refine-rule-draft
      responses:
        '200':
          description: Successful response.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/ServerError'
        '404':
          $ref: '#/components/responses/NotFound'
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
        description: The id path parameter.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
        description: See the Fini API reference for the request body schema.
components:
  responses:
    Forbidden:
      description: API key lacks the required scope.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            statusCode: 403
            message: API key does not have the required scope for this operation
            error: Forbidden
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            statusCode: 401
            message: Unauthorized
            error: Unauthorized
    ServerError:
      description: Internal server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            statusCode: 500
            message: Internal Server Error
            error: Internal Server Error
    NotFound:
      description: Resource not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            statusCode: 404
            message: Not Found
            error: Not Found
  schemas:
    Error:
      type: object
      description: Standard Fini error envelope.
      properties:
        statusCode:
          type: integer
          example: 403
        message:
          type: string
          example: API key does not have the required scope for this operation
        error:
          type: string
          example: Forbidden
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: fini_ API key
      description: 'Bearer token containing your Fini workspace API key. Format: `Bearer fini_...`. The key carries `read` and/or `write` scope; write routes require the `write` scope.'