> ## Documentation Index
> Fetch the complete documentation index at: https://microstrate-1133-notifications-prefs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a new node

> Creates a new node template within a collection



## OpenAPI

````yaml /api-reference/endpoint/hub-flows/openapi.json post /hub/nodes
openapi: 3.0.0
info:
  title: quiva.ai Gateway
  description: API for managing collections, nodes, and workflows in quiva.ai Hub
  version: 0.1.0
  contact:
    name: quiva.ai Support
servers:
  - url: https://api.quiva.ai
    description: Production API server
security:
  - bearerAuth: []
  - apiKeyAuth: []
tags:
  - name: Collections
    description: Operations related to collections
  - name: Nodes
    description: Operations related to nodes
  - name: Workflows
    description: Operations related to workflows
  - name: Oauth
    description: Oauth configurations and connections
paths:
  /hub/nodes:
    post:
      tags:
        - Nodes
      summary: Create a new node
      description: Creates a new node template within a collection
      operationId: createNode
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateNodeRequest'
            examples:
              FunctionNode:
                summary: Create a function node
                value:
                  collection: ms.hub.config.collection.node.805092869
                  data:
                    name: ProcessPayment
                    description: Processes a payment transaction via Stripe
                    node_type: function
                    subject: quiva-function.stripe-charge
                    payload:
                      amount: '{{trigger.amount}}'
                      currency: '{{trigger.currency}}'
                      customer_id: '{{trigger.customer_id}}'
                    options:
                      timeout: 30000
                      attempts: 3
                      backoff_ms: 1000
              MapNode:
                summary: Create a map/transformation node
                value:
                  collection: ms.hub.config.collection.node.1025086208
                  data:
                    name: TransformOrderData
                    description: Transforms order data for downstream processing
                    node_type: map
                    payload:
                      order_id: '{{trigger.id}}'
                      total_amount: '{{trigger.items | sum(''price'')}}'
                      customer:
                        email: '{{trigger.customer.email}}'
                        name: '{{trigger.customer.full_name}}'
              ConditionNode:
                summary: Create a condition/branching node
                value:
                  collection: ms.hub.config.collection.node.805092869
                  data:
                    name: CheckOrderAmount
                    description: Routes high-value orders to priority processing
                    node_type: condition
                    payload:
                      condition: '{{trigger.total > 1000}}'
                      true_branch: priority_handler
                      false_branch: standard_handler
              EvalNode:
                summary: Create an eval node for calculations
                value:
                  collection: ms.hub.config.collection.node.1025086208
                  data:
                    name: CalculateDiscount
                    description: Calculates discount based on order value
                    node_type: eval
                    payload:
                      code: >-
                        const total = trigger.total; return total > 500 ? total
                        * 0.1 : total * 0.05;
              FlowNode:
                summary: Create a flow invocation node
                value:
                  collection: ms.hub.config.collection.node.805092869
                  data:
                    name: SendNotification
                    description: Invokes the notification workflow
                    node_type: flow
                    subject: ms.hub.config.workflow.1508781670.notification-flow
                    payload:
                      recipient: '{{trigger.customer.email}}'
                      template: order_confirmation
                      data: '{{trigger}}'
                    await: false
              IntegrationNode:
                summary: Create an integration node
                value:
                  collection: ms.hub.config.collection.node.805092869
                  data:
                    name: SlackNotify
                    description: Sends notification to Slack channel
                    node_type: integration
                    subject: integration.slack.post-message
                    payload:
                      channel: '#orders'
                      message: 'New order received: {{trigger.order_id}}'
      responses:
        '201':
          description: Node created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateNodeResponse'
              examples:
                FunctionNodeCreated:
                  summary: Function node created
                  value:
                    subject: ms.hub.config.node.805092869.98765432
                    collection: ms.hub.config.collection.node.805092869
                    data:
                      id: '98765432'
                      name: ProcessPayment
                      description: Processes a payment transaction via Stripe
                      node_type: function
                      subject: quiva-function.stripe-charge
                      payload:
                        amount: '{{trigger.amount}}'
                        currency: '{{trigger.currency}}'
                        customer_id: '{{trigger.customer_id}}'
                      options:
                        timeout: 30000
                        attempts: 3
                        backoff_ms: 1000
                    type: created
                    modified: 1748533179
                MapNodeCreated:
                  summary: Map node created
                  value:
                    subject: ms.hub.config.node.1025086208.12345678
                    collection: ms.hub.config.collection.node.1025086208
                    data:
                      id: '12345678'
                      name: TransformOrderData
                      description: Transforms order data for downstream processing
                      node_type: map
                      payload:
                        order_id: '{{trigger.id}}'
                        total_amount: '{{trigger.items | sum(''price'')}}'
                    type: created
                    modified: 1748533200
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                NameRequired:
                  value:
                    error: data.name is required
                CollectionRequired:
                  value:
                    error: a collection subject is required
                InvalidCollection:
                  value:
                    error: invalid collection subject
                PayloadRequired:
                  value:
                    error: payload is required
                FunctionSubjectRequired:
                  value:
                    error: a function subject is required
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                CollectionNotFound:
                  value:
                    error: collection not found
                FunctionNotFound:
                  value:
                    error: function not found
        '409':
          description: Node already exists
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: node exists:ms.hub.config.node.1234567890.98765432
components:
  schemas:
    CreateNodeRequest:
      type: object
      required:
        - collection
        - data
      properties:
        collection:
          type: string
          description: Subject of the collection this node belongs to
        data:
          $ref: '#/components/schemas/NodeData'
    CreateNodeResponse:
      type: object
      properties:
        subject:
          type: string
          description: Subject identifier for the node
        collection:
          type: string
          description: Subject of the collection this node belongs to
        data:
          type: object
          description: Node data
        type:
          type: string
          description: Action type (created)
        modified:
          $ref: '#/components/schemas/Modified'
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Error message
    NodeData:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the node
        name:
          type: string
          description: Name of the node
        description:
          type: string
          description: Description of the node
        node_type:
          type: string
          enum:
            - function
            - flow
            - condition
            - map
            - eval
            - integration
          description: >-
            ## Node Types


            ### 1. `function`

            **Definition**:  

            A **Hydra function node** used to provide a *subject* or perform a
            custom computation. It encapsulates reusable logic defined within
            the Hydra platform.


            ### 2. `flow`

            **Definition**:  

            A node that **invokes another flow**, either **synchronously** or
            **asynchronously**, enabling flow modularization and reuse.


            ### 3. `condition`

            **Definition**:  

            A **branching node** that evaluates a condition to determine the
            **flow of execution**, similar to `if`/`else` logic in programming.


            ### 4. `map`

            **Definition**:  

            A **data transformation node** used to **reshape or remap the
            payload**, allowing the flow to adapt the structure of data as it
            progresses.


            ### 5. `eval`

            **Definition**:  

            Executes **simple JavaScript code** to dynamically **evaluate
            expressions**, perform calculations, or manipulate data inline
            within the flow.


            ### 6. `integration`

            **Definition**:  

            Similar to a `function` node, but specifically tied to **predefined
            APIs**. It uses an HTTP-like interface and references **a known set
            of external services** managed by the platform.
        subject:
          type: string
          description: Subject identifier for function or flow node types
        payload:
          description: Payload data for the node
        response_map:
          description: Mapping for response transformation
        options:
          $ref: '#/components/schemas/NodeOptions'
        await:
          type: boolean
          description: Whether to wait for completion nad return the result
    Modified:
      type: integer
      description: Timestamp of last modification
    NodeOptions:
      type: object
      description: Node execution options
      properties:
        flat_map:
          type: boolean
          description: Whether to flatten the response
        backoff_ms:
          type: integer
          format: int64
          description: >-
            Backoff duration in milliseconds - how long to wait before next
            attempt. Applies to function and flow nodes only.
        timeout:
          type: integer
          format: int64
          description: >-
            Timeout duration in milliseconds. Applies to function and flow nodes
            only.
        attempts:
          type: integer
          format: int32
          description: Number of retry attempts. Applies to function and flow nodes only.
        ignore_response_codes:
          type: array
          items:
            type: integer
          description: >-
            List of HTTP response codes to ignore. Applies to function nodes
            only.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT Authorization header using the Bearer scheme
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key

````