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": "License - Get",
"nodes": [
{
"id": "node-webhook",
"name": "Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 2,
"position": [
100,
300
],
"parameters": {
"httpMethod": "GET",
"path": "license",
"responseMode": "responseNode",
"options": {}
}
},
{
"id": "node-extract-clinic",
"name": "Extraer Clinic ID",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
320,
300
],
"parameters": {
"jsCode": "// Decodifica el JWT del header Authorization para obtener el clinic_id\nconst headers = $input.first().json.headers || {};\nconst authHeader = (headers.authorization || headers.Authorization || '').toString();\nconst token = authHeader.replace(/^Bearer\\s+/i, '').trim();\n\nif (!token) {\n throw new Error('Authorization token requerido');\n}\n\nconst parts = token.split('.');\nif (parts.length !== 3) {\n throw new Error('Formato de token inv\u00e1lido');\n}\n\ntry {\n const base64 = parts[1].replace(/-/g, '+').replace(/_/g, '/');\n const padding = '='.repeat((4 - base64.length % 4) % 4);\n const payload = JSON.parse(Buffer.from(base64 + padding, 'base64').toString('utf8'));\n const clinicId = payload.clinic_id || payload.clinicId || payload.clinic;\n if (!clinicId) throw new Error('clinic_id no encontrado en el token');\n return [{ json: { clinic_id: String(clinicId) } }];\n} catch (e) {\n throw new Error('Error al decodificar token: ' + e.message);\n}"
}
},
{
"id": "node-pg-select",
"name": "Buscar Licencia",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.5,
"position": [
540,
300
],
"parameters": {
"operation": "executeQuery",
"query": "SELECT\n id,\n clinic_id,\n license_key,\n created_at,\n updated_at\nFROM licenses\nWHERE clinic_id = $1::uuid\nLIMIT 1",
"additionalFields": {
"queryParams": "={{ [ $json.clinic_id ] }}"
}
},
"credentials": {
"postgres": {
"name": "<your credential>"
}
},
"continueOnFail": true,
"alwaysOutputData": true
},
{
"id": "node-format",
"name": "Formatear Respuesta",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
760,
300
],
"parameters": {
"jsCode": "const items = $input.all();\n\nif (items.length === 1 && items[0].json.error) {\n throw new Error('Error en base de datos: ' + (items[0].json.error?.message || String(items[0].json.error)));\n}\n\nconst row = items[0]?.json;\nconst licenseKey = row?.id ? row.license_key : null;\n\nreturn [{ json: { license_key: licenseKey } }];"
}
},
{
"id": "node-respond",
"name": "Responder",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.1,
"position": [
980,
300
],
"parameters": {
"respondWith": "json",
"responseBody": "={{ $json }}",
"options": {
"responseCode": 200
}
}
}
],
"connections": {
"Webhook": {
"main": [
[
{
"node": "Extraer Clinic ID",
"type": "main",
"index": 0
}
]
]
},
"Extraer Clinic ID": {
"main": [
[
{
"node": "Buscar Licencia",
"type": "main",
"index": 0
}
]
]
},
"Buscar Licencia": {
"main": [
[
{
"node": "Formatear Respuesta",
"type": "main",
"index": 0
}
]
]
},
"Formatear Respuesta": {
"main": [
[
{
"node": "Responder",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"meta": {
"templateCredsSetupCompleted": false,
"notes": "CONFIGURACI\u00d3N REQUERIDA:\n1. Crear una credencial de tipo 'Postgres' en n8n con los datos de conexi\u00f3n.\n2. En el nodo 'Buscar Licencia', seleccionar esa credencial (reemplaza POSTGRES_CREDENTIAL_ID).\n3. Activar el workflow.\n\nRUTA DEL WEBHOOK:\nGET https://<tu-n8n>/webhook/license\n\nAUTENTICACI\u00d3N:\nRequiere header: Authorization: Bearer <JWT>\nEl token se decodifica para extraer el clinic_id (soporta claims: clinic_id, clinicId, clinic)\n\nRESPUESTA (licencia encontrada):\n{ \"license_key\": \"<base64url-blob>\" }\n\nRESPUESTA (sin licencia):\n{ \"license_key\": null }\n\nTABLA REQUERIDA: licenses (ver 030_20260529_licensing-tables-and-permissions.sql)"
}
}
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
License - Get. Uses postgres. Webhook trigger; 5 nodes.
Source: https://github.com/markinvokeia/studio/blob/cb9a61709191b52323715720f72c25d813b6e181/n8n-workflows/license-get.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.