> ## Documentation Index
> Fetch the complete documentation index at: https://help.teable.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Post base workflow logic

> Create a automation workflow logic



## OpenAPI

````yaml /swagger.json post /base/{baseId}/workflow/{workflowId}/logic
openapi: 3.0.0
info:
  version: 1.0.0
  title: Teable App
  description: Manage Data as easy as drink a cup of tea
  x-logo:
    backgroundColor: '#F0F0F0'
    altText: Teable logo
servers:
  - url: https://app.teable.ai/api
security: []
paths:
  /base/{baseId}/workflow/{workflowId}/logic:
    post:
      tags:
        - automation
      description: Create a automation workflow logic
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: name of the node
                description:
                  type: string
                  description: description of the node
                config:
                  nullable: true
                  description: node configuration
                parentNodeId:
                  type: string
                  description: >-
                    witch node this the parent, if not provided, it is a root
                    node
                type:
                  type: string
                  enum:
                    - condition
                    - Repeat
                  description: type of logic
              required:
                - parentNodeId
                - type
      responses:
        '201':
          description: Successful created
          content:
            application/json:
              schema:
                type: object
                properties:
                  logic:
                    oneOf:
                      - type: object
                        properties:
                          name:
                            type: string
                            description: name of the node
                          description:
                            type: string
                            description: description of the node
                          config:
                            type: object
                            properties:
                              conditions:
                                type: object
                            required:
                              - conditions
                          id:
                            type: string
                            description: node id
                          category:
                            type: string
                            enum:
                              - logic
                          testResult:
                            type: object
                            properties:
                              spent:
                                type: number
                                description: spent time
                              inputRaw:
                                nullable: true
                              outputRaw:
                                nullable: true
                              inputVariables:
                                type: object
                                description: The variables snapshot when executed
                              outputVariables:
                                type: object
                                description: The variables snapshot when executed
                              errorMsg:
                                type: string
                              createdTime:
                                type: string
                            required:
                              - createdTime
                            description: action test result
                          outputVariables:
                            type: object
                            description: output variables
                          inputVariables:
                            type: object
                            description: input variables
                          createdTime:
                            type: string
                            nullable: true
                            description: created time
                          lastModifiedTime:
                            type: string
                            nullable: true
                            description: last modified time
                          type:
                            type: string
                            enum:
                              - condition
                            description: Condition logic
                        required:
                          - config
                          - id
                          - category
                          - type
                      - type: object
                        properties:
                          name:
                            type: string
                            description: name of the node
                          description:
                            type: string
                            description: description of the node
                          config:
                            type: object
                            properties:
                              fact:
                                oneOf:
                                  - type: object
                                    properties:
                                      resolvable:
                                        type: boolean
                                        enum:
                                          - true
                                        description: >-
                                          Need be resolved to static values before
                                          running
                                      type:
                                        type: string
                                        enum:
                                          - literal
                                      value:
                                        nullable: true
                                        description: Literal value
                                    required:
                                      - resolvable
                                      - type
                                  - type: object
                                    properties:
                                      resolvable:
                                        type: boolean
                                        enum:
                                          - true
                                        description: >-
                                          Need be resolved to static values before
                                          running
                                      type:
                                        type: string
                                        enum:
                                          - fact
                                      path:
                                        type: string
                                        description: json-path syntax
                                      keyStack:
                                        type: array
                                        items:
                                          type: string
                                        description: save select stack
                                      params:
                                        type: object
                                        properties:
                                          pipes:
                                            type: array
                                            items:
                                              type: string
                                              enum:
                                                - uppercase
                                                - lowercase
                                                - capitalize
                                                - trim
                                                - length
                                                - toString
                                                - jsonStringify
                                                - encodeUrlComponent
                                            description: >-
                                              Pipe functions to transform the fact
                                              value
                                      fact:
                                        type: string
                                        description: Fact name, actionId or triggerId
                                    required:
                                      - resolvable
                                      - type
                                      - fact
                                  - type: object
                                    properties:
                                      resolvable:
                                        type: boolean
                                        enum:
                                          - true
                                        description: >-
                                          Need be resolved to static values before
                                          running
                                      type:
                                        type: string
                                        enum:
                                          - array
                                      nodes:
                                        type: array
                                        items:
                                          anyOf:
                                            - type: object
                                              properties:
                                                resolvable:
                                                  type: boolean
                                                  enum:
                                                    - true
                                                  description: >-
                                                    Need be resolved to static values before
                                                    running
                                                type:
                                                  type: string
                                                  enum:
                                                    - literal
                                                value:
                                                  nullable: true
                                                  description: Literal value
                                              required:
                                                - resolvable
                                                - type
                                            - type: object
                                              properties:
                                                resolvable:
                                                  type: boolean
                                                  enum:
                                                    - true
                                                  description: >-
                                                    Need be resolved to static values before
                                                    running
                                                type:
                                                  type: string
                                                  enum:
                                                    - fact
                                                path:
                                                  type: string
                                                  description: json-path syntax
                                                keyStack:
                                                  type: array
                                                  items:
                                                    type: string
                                                  description: save select stack
                                                params:
                                                  type: object
                                                  properties:
                                                    pipes:
                                                      type: array
                                                      items:
                                                        type: string
                                                        enum:
                                                          - uppercase
                                                          - lowercase
                                                          - capitalize
                                                          - trim
                                                          - length
                                                          - toString
                                                          - jsonStringify
                                                          - encodeUrlComponent
                                                      description: >-
                                                        Pipe functions to transform the fact
                                                        value
                                                fact:
                                                  type: string
                                                  description: Fact name, actionId or triggerId
                                              required:
                                                - resolvable
                                                - type
                                                - fact
                                        description: >-
                                          Array of literal and fact nodes, all
                                          value will be stringify and join
                                          together
                                    required:
                                      - resolvable
                                      - type
                                      - nodes
                                  - nullable: true
                            required:
                              - fact
                          id:
                            type: string
                            description: node id
                          category:
                            type: string
                            enum:
                              - logic
                          testResult:
                            type: object
                            properties:
                              spent:
                                type: number
                                description: spent time
                              inputRaw:
                                nullable: true
                              outputRaw:
                                nullable: true
                              inputVariables:
                                type: object
                                description: The variables snapshot when executed
                              outputVariables:
                                type: object
                                description: The variables snapshot when executed
                              errorMsg:
                                type: string
                              createdTime:
                                type: string
                            required:
                              - createdTime
                            description: action test result
                          outputVariables:
                            type: object
                            description: output variables
                          inputVariables:
                            type: object
                            description: input variables
                          createdTime:
                            type: string
                            nullable: true
                            description: created time
                          lastModifiedTime:
                            type: string
                            nullable: true
                            description: last modified time
                          type:
                            type: string
                            enum:
                              - Repeat
                            description: >-
                              Actions in this group will repeat for each item in
                              the input list.
                        required:
                          - config
                          - id
                          - category
                          - type
                  controls:
                    type: array
                    items:
                      oneOf:
                        - type: object
                          properties:
                            name:
                              type: string
                              description: name of the node
                            config:
                              type: object
                              properties:
                                sourceNodeId:
                                  type: string
                              required:
                                - sourceNodeId
                            id:
                              type: string
                              description: node id
                            category:
                              type: string
                              enum:
                                - control
                            createdTime:
                              type: string
                              nullable: true
                              description: created time
                            lastModifiedTime:
                              type: string
                              nullable: true
                              description: last modified time
                            type:
                              type: string
                              enum:
                                - conditionEnd
                                - triggerEnd
                                - repeatEnd
                          required:
                            - config
                            - id
                            - category
                            - type
                        - type: object
                          properties:
                            name:
                              type: string
                              description: name of the node
                            config:
                              type: object
                              properties:
                                truthy:
                                  type: boolean
                                sourceNodeId:
                                  type: string
                              required:
                                - truthy
                                - sourceNodeId
                            id:
                              type: string
                              description: node id
                            category:
                              type: string
                              enum:
                                - control
                            outputVariables:
                              type: object
                              description: output variables
                            inputVariables:
                              type: object
                              description: input variables
                            createdTime:
                              type: string
                              nullable: true
                              description: created time
                            lastModifiedTime:
                              type: string
                              nullable: true
                              description: last modified time
                            type:
                              type: string
                              enum:
                                - conditionBranch
                              description: >-
                                all logic category is actually a group, so they
                                need a node for end mark
                          required:
                            - config
                            - id
                            - category
                            - type
                    description: >-
                      workflow control nodes, contains the logic branch and the
                      end node
                required:
                  - logic
                  - controls
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: Shell
          source: |-
            curl --request POST \
              --url https://app.teable.ai/api/base/%7BbaseId%7D/workflow/%7BworkflowId%7D/logic \
              --header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \
              --header 'content-type: application/json' \
              --data '{"name":"string","description":"string","config":null,"parentNodeId":"string","type":"condition"}'
        - lang: JavaScript
          source: >-
            const url =
            'https://app.teable.ai/api/base/%7BbaseId%7D/workflow/%7BworkflowId%7D/logic';

            const options = {
              method: 'POST',
              headers: {
                Authorization: 'Bearer REPLACE_BEARER_TOKEN',
                'content-type': 'application/json'
              },
              body: '{"name":"string","description":"string","config":null,"parentNodeId":"string","type":"condition"}'
            };


            try {
              const response = await fetch(url, options);
              const data = await response.json();
              console.log(data);
            } catch (error) {
              console.error(error);
            }
        - lang: Node.js
          source: |-
            const http = require('https');

            const options = {
              method: 'POST',
              hostname: 'app.teable.ai',
              port: null,
              path: '/api/base/%7BbaseId%7D/workflow/%7BworkflowId%7D/logic',
              headers: {
                Authorization: 'Bearer REPLACE_BEARER_TOKEN',
                'content-type': 'application/json'
              }
            };

            const req = http.request(options, function (res) {
              const chunks = [];

              res.on('data', function (chunk) {
                chunks.push(chunk);
              });

              res.on('end', function () {
                const body = Buffer.concat(chunks);
                console.log(body.toString());
              });
            });

            req.write(JSON.stringify({
              name: 'string',
              description: 'string',
              config: null,
              parentNodeId: 'string',
              type: 'condition'
            }));
            req.end();
        - lang: Python
          source: >-
            import http.client


            conn = http.client.HTTPSConnection("app.teable.ai")


            payload =
            "{\"name\":\"string\",\"description\":\"string\",\"config\":null,\"parentNodeId\":\"string\",\"type\":\"condition\"}"


            headers = {
                'Authorization': "Bearer REPLACE_BEARER_TOKEN",
                'content-type': "application/json"
            }


            conn.request("POST",
            "/api/base/%7BbaseId%7D/workflow/%7BworkflowId%7D/logic", payload,
            headers)


            res = conn.getresponse()

            data = res.read()


            print(data.decode("utf-8"))
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````