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 →
{
"name": "CrudApiGet",
"nodes": [
{
"parameters": {
"path": "api/messages-list",
"responseMode": "responseNode",
"options": {
"allowedOrigins": "*"
}
},
"type": "n8n-nodes-base.webhook",
"typeVersion": 2.1,
"position": [
-192,
-32
],
"id": "0cd71596-3531-4bc4-ab9a-a012edbcea65",
"name": "Webhook1"
},
{
"parameters": {
"jsCode": "const item = $input.item;\n\nif(item.json === undefined || item.json === null){\n item.json = {};\n}\n\n\nconst crypto = require('crypto');\n\nconst secretKey = 'seu-segredo-secreto';\n\n\nfunction base64UrlDecode(data) {\n let base64 = data.replace(/-/g, '+').replace(/_/g, '/');\n \n while (base64.length % 4) {\n base64 += '=';\n }\n return Buffer.from(base64, 'base64').toString('utf8');\n}\n\n\ntry {\n \n const authHeader = $json.headers['authorization'];\n\n if (!authHeader || !authHeader.startsWith('Bearer ')) {\n throw new Error('Authorization header missing or invalid');\n }\n\n \n const token = authHeader.split(' ')[1];\n\n \n const [encodedHeader, encodedPayload, signature] = token.split('.');\n\n if (!encodedHeader || !encodedPayload || !signature) {\n throw new Error('Invalid token format');\n }\n\n \n const dataToSign = `${encodedHeader}.${encodedPayload}`;\n const expectedSignature = crypto\n .createHmac('sha256', secretKey)\n .update(dataToSign)\n .digest('base64url');\n\n \n const sigBuffer = Buffer.from(signature, 'base64url');\n const expectedSigBuffer = Buffer.from(expectedSignature, 'base64url');\n\n if (sigBuffer.length !== expectedSigBuffer.length || !crypto.timingSafeEqual(sigBuffer, expectedSigBuffer)) {\n throw new Error('Invalid signature');\n }\n\n \n const payload = JSON.parse(base64UrlDecode(encodedPayload));\n const nowInSeconds = Math.floor(Date.now() / 1000);\n\n if (payload.exp < nowInSeconds) {\n throw new Error('Token has expired');\n }\n\n \n item.json.auth_user = payload;\n item.json.isValid = true;\n\n} catch (Error) {\n\n item.json.isValid = false;\n item.json.errorDetails = Error.message;\n}\n\nreturn item;"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-48,
-32
],
"id": "4c4a531b-d219-44c7-adea-05529ee4f8dd",
"name": "token_Validation",
"alwaysOutputData": false,
"notesInFlow": false,
"onError": "continueErrorOutput"
},
{
"parameters": {
"respondWith": "json",
"responseBody": "{\n \"type\": \"https://example.com/probs/internal-error\",\n \"title\": \"Internal Server Error\",\n \"status\": 500,\n \"detail\": \"Ocorreu um erro interno inesperado ao processar sua solicita\u00e7\u00e3o.\",\n \"instance\": \"/api/messages\",\n \"request_id\": \"req_xyz987\"\n}",
"options": {
"responseCode": 500
}
},
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.4,
"position": [
128,
112
],
"id": "ceb2c468-b214-49d7-b909-1724404fc94d",
"name": "error_500"
},
{
"parameters": {
"operation": "select",
"schema": {
"__rl": true,
"mode": "list",
"value": "public"
},
"table": {
"__rl": true,
"value": "messages",
"mode": "list",
"cachedResultName": "messages"
},
"returnAll": true,
"options": {}
},
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.6,
"position": [
336,
-112
],
"id": "f8518aab-0072-4a38-8af2-4a481f113bb1",
"name": "select_Rows_From_A_Table",
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"respondWith": "json",
"responseBody": "\n{\n \"title\": \"unauthorized\",\n \"status\": 401,\n \"detail\": \"invalid or expired token\"\n}\n",
"options": {
"responseCode": 200
}
},
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.4,
"position": [
336,
112
],
"id": "ad9e59ae-4155-4985-9dce-d51b95fcfc13",
"name": "error_401"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "d1b9bd02-a759-48fa-bbf7-c2028f37e203",
"leftValue": "={{ $json.isValid }}",
"rightValue": true,
"operator": {
"type": "boolean",
"operation": "equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
128,
-112
],
"id": "649ed2e0-c819-4e12-9146-3fa905e683ec",
"name": "Token_Is_Valid"
},
{
"parameters": {
"respondWith": "allIncomingItems",
"options": {
"responseCode": 200
}
},
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.4,
"position": [
496,
-112
],
"id": "bf44e624-1b6c-4877-9f2d-f6412c356ce6",
"name": "success_200"
}
],
"connections": {
"Webhook1": {
"main": [
[
{
"node": "token_Validation",
"type": "main",
"index": 0
}
]
]
},
"token_Validation": {
"main": [
[
{
"node": "Token_Is_Valid",
"type": "main",
"index": 0
}
],
[
{
"node": "error_500",
"type": "main",
"index": 0
}
]
]
},
"select_Rows_From_A_Table": {
"main": [
[
{
"node": "success_200",
"type": "main",
"index": 0
}
]
]
},
"Token_Is_Valid": {
"main": [
[
{
"node": "select_Rows_From_A_Table",
"type": "main",
"index": 0
}
],
[
{
"node": "error_401",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "fa20745d-ec3a-4ce0-ab12-3e26fb3257c8",
"meta": {
"templateCredsSetupCompleted": true
},
"id": "vBj9Ta34kWQTRurW",
"tags": []
}
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.
postgres
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
CrudApiGet. Uses postgres. Webhook trigger; 7 nodes.
Source: https://github.com/marleytw/Teste-Tecnico-crud-n8n-react/blob/cd676d13ca1c1fa22e1df92d2c04475eb294cb5d/N8n/ApiGet.json — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
CMM. Uses httpRequest, postgres, redis. Webhook trigger; 90 nodes.
Scraping. Uses httpRequest, postgres, @apify/n8n-nodes-apify, respondToWebhook. Webhook trigger; 61 nodes.
Workflow B — AI Listing Engine. Uses httpRequest, postgres, errorTrigger. Webhook trigger; 47 nodes.