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 →
{
"id": "a8f3c2e1-4b5d-4a6e-9c7f-1d2e3f4a5b6c",
"meta": {
"templateCredsSetupCompleted": false
},
"name": "PromptPerfect \u2014 Optimize Prompt",
"tags": [
{
"name": "promptperfect"
},
{
"name": "ai"
},
{
"name": "prompt-optimization"
}
],
"nodes": [
{
"parameters": {},
"id": "11111111-1111-4111-8111-111111111111",
"name": "Start",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
240,
300
]
},
{
"parameters": {
"mode": "manual",
"duplicateItem": false,
"assignments": {
"assignments": [
{
"id": "22222222-2222-4222-8222-222222222221",
"name": "promptText",
"value": "Explain quantum computing in simple terms",
"type": "string"
},
{
"id": "22222222-2222-4222-8222-222222222222",
"name": "targetModel",
"value": "chatgpt",
"type": "string"
},
{
"id": "22222222-2222-4222-8222-222222222223",
"name": "apiKey",
"value": "YOUR_API_KEY_HERE",
"type": "string"
}
]
},
"options": {}
},
"id": "22222222-2222-4222-8222-222222220002",
"name": "Set Prompt Input",
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
460,
300
]
},
{
"parameters": {
"method": "POST",
"url": "https://api.promptperfect.jina.ai/api/optimize-sync",
"authentication": "none",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
},
{
"name": "x-api-key",
"value": "={{ $json.apiKey }}"
}
]
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ JSON.stringify({ data: { prompt: { text: $json.promptText }, targetModel: $json.targetModel, promptType: 'text' } }) }}",
"options": {
"timeout": 30000,
"response": {
"response": {
"responseFormat": "json"
}
}
}
},
"id": "33333333-3333-4333-8333-333333333333",
"name": "Optimize Prompt",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
680,
300
]
},
{
"parameters": {
"mode": "runOnceForAllItems",
"jsCode": "const response = items[0].json;\n\nconst optimizedPrompt =\n response?.result?.promptOptimized ||\n response?.promptOptimized ||\n 'No result returned';\n\nconst input = $('Set Prompt Input').first().json;\n\nreturn [\n {\n json: {\n original_prompt: input.promptText || '',\n optimized_prompt: optimizedPrompt,\n target_model: input.targetModel || 'chatgpt',\n success:\n !!optimizedPrompt && optimizedPrompt !== 'No result returned',\n timestamp: new Date().toISOString(),\n },\n },\n];\n"
},
"id": "44444444-4444-4444-8444-444444444444",
"name": "Extract Result",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
900,
300
]
}
],
"connections": {
"Start": {
"main": [
[
{
"node": "Set Prompt Input",
"type": "main",
"index": 0
}
]
]
},
"Set Prompt Input": {
"main": [
[
{
"node": "Optimize Prompt",
"type": "main",
"index": 0
}
]
]
},
"Optimize Prompt": {
"main": [
[
{
"node": "Extract Result",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1"
},
"staticData": null,
"triggerCount": 0,
"versionId": "b9e4d3f2-5c6e-4b7f-ad8e-2f3a4b5c6d7e",
"active": false
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
PromptPerfect — Optimize Prompt. Uses httpRequest. Event-driven trigger; 4 nodes.
Source: https://github.com/Beagle-AI-automation/promptperfect/blob/ac3bf6c0a538049b09083d812474a241bd8be67e/examples/n8n-optimize-prompt.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.
This workflow allows you to import any workflow from a file or another n8n instance and map the credentials easily. A multi-form setup guides you through the entire process At the beginning you have t
[n8n] Advanced URL Parsing and Shortening Workflow - Switchy.io Integration. Uses splitInBatches, stickyNote, httpRequest, html. Event-driven trigger; 56 nodes.
[](https://youtu.be/c7yCZhmMjtI)
This automation organizes your n8n workflows files into categorizes (Active, Template, Done, Archived) and uploads them directly to a categorized Google Drive folders. It is designed to help users man
Create Animated Stories using GPT-4o-mini, Midjourney, Kling and Creatomate API. Uses httpRequest. Event-driven trigger; 51 nodes.