AutomationFlowsData & Sheets › Manage Job Records via Webhook REST API with Postgresql

Manage Job Records via Webhook REST API with Postgresql

ByRaj @raj-cloud on n8n.io

This workflow exposes a header-authenticated webhook REST API that performs CRUD operations on a PostgreSQL jobs table, letting you create, list, update, and delete job records and returning either JSON results or an error message to the caller. Receives a POST request via a…

Webhook trigger★★★★☆ complexity19 nodesPostgres
Data & Sheets Trigger: Webhook Nodes: 19 Complexity: ★★★★☆ Added:

This workflow corresponds to n8n.io template #16081 — we link there as the canonical source.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "fyiK35U7pFIaeoch",
  "name": "Job Management REST API with PostgreSQL (Create, Read, Update, Delete)",
  "tags": [],
  "nodes": [
    {
      "id": "d0c1178e-ede1-481b-853b-ee2a66f9cd0b",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "width": 480,
        "height": 896,
        "content": "## Job Management REST API with PostgreSQL (Create, Read, Update, Delete)\n\n### How it works\n\n1. Receives incoming requests through a webhook.\n2. Determines the action type using a switch node.\n3. Executes PostgreSQL queries to manage jobs.\n4. Returns success or error responses based on query results.\n\n### Setup steps\n\n- [ ] Configure the webhook node to listen for incoming requests.\n- [ ] Set up connection details for the PostgreSQL nodes.\n- [ ] Configure return nodes to respond to the requests.\n\n### Customization\n\nYou can add additional error handling nodes for more specific error responses."
      },
      "typeVersion": 1
    },
    {
      "id": "860d78f3-a480-4b6f-ad12-13ccab1a9aaf",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        560,
        432
      ],
      "parameters": {
        "color": 7,
        "height": 304,
        "content": "## Receive requests\n\nHandles incoming requests through a webhook."
      },
      "typeVersion": 1
    },
    {
      "id": "30ef5a17-06a9-489b-8b1d-b8eb76a8c2da",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        832,
        368
      ],
      "parameters": {
        "color": 7,
        "height": 384,
        "content": "## Determine request type\n\nUses a switch node to branch actions based on request type."
      },
      "typeVersion": 1
    },
    {
      "id": "fe9e8ab2-c7c9-4b54-8aae-b2bd7caf0133",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1104,
        0
      ],
      "parameters": {
        "color": 7,
        "width": 416,
        "height": 496,
        "content": "## Fetch all jobs\n\nExecutes SQL query to get all jobs and handles responses."
      },
      "typeVersion": 1
    },
    {
      "id": "7dccc42e-1863-4ba0-8be2-002f82942298",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1104,
        528
      ],
      "parameters": {
        "color": 7,
        "width": 416,
        "height": 496,
        "content": "## Create job and respond\n\nExecutes job creation SQL query and returns success or error response."
      },
      "typeVersion": 1
    },
    {
      "id": "ac1545f7-b9f0-41d7-96d1-d16298229826",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1552,
        576
      ],
      "parameters": {
        "color": 7,
        "width": 416,
        "height": 496,
        "content": "## Update job and respond\n\nExecutes job update SQL query and returns success or error response."
      },
      "typeVersion": 1
    },
    {
      "id": "babfadf6-d235-4c5d-871d-882432185435",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2000,
        576
      ],
      "parameters": {
        "color": 7,
        "width": 416,
        "height": 688,
        "content": "## Delete job and respond\n\nExecutes job deletion SQL query and returns success or error response."
      },
      "typeVersion": 1
    },
    {
      "id": "3ebe4490-ec6f-46af-9cab-0090337add9f",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        608,
        560
      ],
      "parameters": {
        "path": "Your API path",
        "options": {
          "allowedOrigins": "*"
        },
        "httpMethod": "POST",
        "responseMode": "responseNode",
        "authentication": "headerAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "8b0aa560-b14f-4d67-ad95-fb5e7a337234",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        880,
        528
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Get Jobs",
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "1405fa6e-6f89-4895-8f58-a6717867c21a",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.body.action }}",
                    "rightValue": "list"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Add Job",
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "2523ac58-3c85-454e-b821-12ed404b9460",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.body.action }}",
                    "rightValue": "create"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Update Job",
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "739a39a3-f075-450f-bb7d-8db5e0c22720",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.body.action }}",
                    "rightValue": "update"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Delete Job",
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "a62f7d45-7a2d-47c4-8218-76f18f7f3fb5",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.body.action }}",
                    "rightValue": "delete"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.4
    },
    {
      "id": "7e73b191-28e2-4de0-a191-8f93c5af2302",
      "name": "Get All Jobs",
      "type": "n8n-nodes-base.postgres",
      "onError": "continueErrorOutput",
      "position": [
        1152,
        128
      ],
      "parameters": {
        "query": "SELECT * FROM jobs ORDER BY created_at DESC LIMIT 100;",
        "options": {},
        "operation": "executeQuery"
      },
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.6
    },
    {
      "id": "f9af3454-e487-474b-af66-ca555efe8ba0",
      "name": "Create Job",
      "type": "n8n-nodes-base.postgres",
      "onError": "continueErrorOutput",
      "position": [
        1152,
        656
      ],
      "parameters": {
        "query": "INSERT INTO jobs (title, description, requirements, status)\nVALUES ($1, $2, $3, 'open')\nRETURNING *;",
        "options": {
          "queryReplacement": "={{ $json.body.title }},{{ $json.body.description }},{{ $json.body.requirements }}"
        },
        "operation": "executeQuery"
      },
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.6
    },
    {
      "id": "19bd1727-780c-450e-9e02-e02efd8fafe5",
      "name": "Update Job",
      "type": "n8n-nodes-base.postgres",
      "onError": "continueErrorOutput",
      "position": [
        1600,
        752
      ],
      "parameters": {
        "query": "UPDATE jobs\nSET title=$1, description=$2, requirements=$3, status=$4\nWHERE id=$5\nRETURNING *;",
        "options": {
          "queryReplacement": "{{$json.body.title}}, {{ $json.body.description }}, {{ $json.body.requirements }}, {{ $json.body.status }}, {{ $json.body.id }}"
        },
        "operation": "executeQuery"
      },
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.6
    },
    {
      "id": "c24bee60-92cd-450c-8559-a3ffc04a8591",
      "name": "Delete Job",
      "type": "n8n-nodes-base.postgres",
      "onError": "continueErrorOutput",
      "position": [
        2048,
        1040
      ],
      "parameters": {
        "query": "DELETE FROM jobs WHERE id=$1 RETURNING id;",
        "options": {
          "queryReplacement": "={{ $json.body.id }}"
        },
        "operation": "executeQuery"
      },
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.6
    },
    {
      "id": "2e96836a-72bf-44a5-b2ec-ec846cab2629",
      "name": "Return Success Response",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        2912,
        848
      ],
      "parameters": {
        "options": {
          "responseCode": 200
        }
      },
      "typeVersion": 1.5
    },
    {
      "id": "c1bae481-4a5f-4c47-9ca6-3bd9c32d68fb",
      "name": "Return Job List",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1376,
        128
      ],
      "parameters": {
        "options": {
          "responseCode": 200
        },
        "respondWith": "allIncomingItems"
      },
      "typeVersion": 1.5
    },
    {
      "id": "d217fc96-7e86-4b99-9be9-68e99212e5b6",
      "name": "Error During Fetching Jobs",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1376,
        320
      ],
      "parameters": {
        "options": {
          "responseCode": 500
        },
        "respondWith": "text",
        "responseBody": "An error occurred during fetching the jobs"
      },
      "typeVersion": 1.5
    },
    {
      "id": "c0d972e1-a1db-4517-989f-aaa86f59b347",
      "name": "Error during job creation",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1376,
        656
      ],
      "parameters": {
        "options": {
          "responseCode": 500
        },
        "respondWith": "text",
        "responseBody": "An error occurred during job creation"
      },
      "typeVersion": 1.5
    },
    {
      "id": "47ffb6ab-7e00-4511-83f3-de86606df7f2",
      "name": "Error during job details update",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1824,
        896
      ],
      "parameters": {
        "options": {
          "responseCode": 500
        },
        "respondWith": "text",
        "responseBody": "An error occurred during edit the job details"
      },
      "typeVersion": 1.5
    },
    {
      "id": "f259a236-c733-4818-83d0-1e01909feb2c",
      "name": "Error during job deletion",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        2272,
        1088
      ],
      "parameters": {
        "options": {
          "responseCode": 500
        },
        "respondWith": "text",
        "responseBody": "An error occurred during deleting the job"
      },
      "typeVersion": 1.5
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "executionOrder": "v1"
  },
  "versionId": "fc9c439a-bf95-4051-92cf-953c59555fba",
  "connections": {
    "Switch": {
      "main": [
        [
          {
            "node": "Get All Jobs",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Create Job",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Update Job",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Delete Job",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Job": {
      "main": [
        [
          {
            "node": "Return Success Response",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Error during job creation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Delete Job": {
      "main": [
        [
          {
            "node": "Return Success Response",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Error during job deletion",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Job": {
      "main": [
        [
          {
            "node": "Return Success Response",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Error during job details update",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get All Jobs": {
      "main": [
        [
          {
            "node": "Return Job List",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Error During Fetching Jobs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This workflow exposes a header-authenticated webhook REST API that performs CRUD operations on a PostgreSQL jobs table, letting you create, list, update, and delete job records and returning either JSON results or an error message to the caller. Receives a POST request via a…

Source: https://n8n.io/workflows/16081/ — original creator credit. Request a take-down →

More Data & Sheets workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Data & Sheets

Scraping. Uses httpRequest, postgres, @apify/n8n-nodes-apify, respondToWebhook. Webhook trigger; 61 nodes.

HTTP Request, Postgres, @Apify/N8N Nodes Apify
Data & Sheets

Workflow B — AI Listing Engine. Uses httpRequest, postgres, errorTrigger. Webhook trigger; 47 nodes.

HTTP Request, Postgres, Error Trigger
Data & Sheets

How it works

Postgres, Email Send
Data & Sheets

LogSentinel Workflow. Uses postgres, emailSend, httpRequest. Webhook trigger; 44 nodes.

Postgres, Email Send, HTTP Request
Data & Sheets

This workflow automates data maturity evaluation to measure how well an organization uses data to create value by capturing assessment data through forms or APIs, processing and scoring responses usin

Email Send, Postgres