n8n
Run Prompteryx workflows and the AI browser agent from n8n, get results back by webhook, or give an n8n AI Agent the Prompteryx tools over MCP
No community node needed
- Create a key in Cloud Platform → API → API Keys. It starts with
px_live_and is shown once. - In n8n open Credentials → Add credential (or Create → Credential) and choose Header Auth.
- Name:
Authorization. Value:Bearer px_live_YOUR_KEY(with the word Bearer and a space). Save it as Prompteryx.
In each HTTP Request node below set Authentication to Generic Credential Type, Generic Auth Type to Header Auth, and pick Prompteryx.
Find the workflow id in the Visual Studio URL, or list them with GET https://www.prompteryx.ai/api/v1/workflows. Values in variables become {{name}} inside the workflow.
HTTP Request node: start the run
- Method POST, URL
https://www.prompteryx.ai/api/v1/workflows/WORKFLOW_ID/execute - Authentication: the Prompteryx Header Auth credential
- Send Body: on, Body Content Type JSON, Specify Body Using JSON:
{
"variables": { "postcode": "{{ $json.postcode }}" },
"options": { "runMode": "headless" }
}It answers at once with { "data": { "execution": { "id": "api_…", "status": "pending" } } }. Runs usually start within a minute.
Wait for the result (polling)
- Wait node: 15 seconds.
- HTTP Request: GET
https://www.prompteryx.ai/api/v1/executions/{{ $('Start run').item.json.data.execution.id }}(same credential; rename the first node "Start run"). - IF (boolean condition):
{{ ['COMPLETED','FAILED','CANCELLED','ERROR'].includes(String($json.data.execution.status).toUpperCase()) }}is true → continue; false → loop back to Wait. (The status starts aspendingand endsCOMPLETEDorFAILED.) - Use
{{ $json.data.execution.outputs }}downstream: one entry per step name, for example{{ $json.data.execution.outputs['Extract Price'].extractedText }}.
Prefer no polling? Use a callback instead (section 4).
curl -X POST https://www.prompteryx.ai/api/v1/workflows/WORKFLOW_ID/execute \
-H "Authorization: Bearer px_live_YOUR_KEY" -H "Content-Type: application/json" \
-d '{"variables":{"postcode":"SW1A 1AA"},"options":{"runMode":"headless"}}'
curl https://www.prompteryx.ai/api/v1/executions/api_… -H "Authorization: Bearer px_live_YOUR_KEY"HTTP Request node "Start agent": POST https://www.prompteryx.ai/api/v1/ai-browser/execute
{
"instruction": "Go to https://news.ycombinator.com and return the titles of the top 5 stories",
"maxSteps": 20,
"mode": "start"
}HTTP Request node "Advance agent": the same URL, body
{ "jobId": "{{ $('Start agent').item.json.data.jobId }}", "mode": "run" }- Set the node's Options → Timeout to
300000(each call works for up to about 4 minutes). - Add an IF:
{{ $json.data.terminal }}is false → loop back to "Advance agent". - When it is true, read
{{ $json.data.finalAnswer }}.{{ $json.data.jobStatus }}isdoneon success,failedon error, andawaiting_inputif the agent stopped to ask before a risky step (payment, sending, deleting).
Each run spends AI credits and cloud minutes. Cap it with maxSteps and maxCredits. Add "saveAsWorkflow": true to save the successful path as a workflow you can then run without AI. More in Run the AI browser agent.
- Start a new n8n workflow with a Webhook node: HTTP Method POST, Respond Immediately. Copy its Production URL and activate the workflow.
- In the "Start run" body from section 2 add
"webhookUrl": "https://YOUR-N8N/webhook/…". - When the run ends the Webhook node receives
{ event, data: { executionId, workflowId, status, outputs, error, duration } };eventisworkflow.completedorworkflow.failed.
To check a callback really came from Prompteryx, create a signing secret (whsec_…) on the API Keys page and verify the X-Prompteryx-Signature-256 header: in the Webhook node turn on Options → Raw Body, then add a Code node:
const crypto = require('crypto')
const secret = 'whsec_YOUR_SECRET'
const item = $input.first()
const h = item.json.headers
const raw = Buffer.from(item.binary.data.data, 'base64').toString('utf8')
const expected = 'v1=' + crypto.createHmac('sha256', secret).update(h['x-prompteryx-timestamp'] + '.' + raw).digest('hex')
const fresh = Math.abs(Date.now() / 1000 - Number(h['x-prompteryx-timestamp'])) < 300
if (!fresh || !(h['x-prompteryx-signature-256'] || '').split(',').map(s => s.trim()).includes(expected)) {
throw new Error('Bad Prompteryx signature')
}
return [{ json: JSON.parse(raw) }]Self-hosted n8n may block require('crypto') in Code nodes; allow it with NODE_FUNCTION_ALLOW_BUILTIN=crypto. Full details: Webhooks.
Add a Webhook Trigger node to the Prompteryx workflow in Visual Studio, choose its authentication (for example a secret in X-Webhook-Secret) and save. Then in n8n:
HTTP Request: POST https://www.prompteryx.ai/api/v1/webhooks/WORKFLOW_ID
Header: X-Webhook-Secret = your_workflow_secret
Body (JSON): { "email": "{{ $json.email }}", "action": "process" }Inside Prompteryx the JSON arrives as the trigger's body. 30 calls a minute per caller IP; each call counts as a workflow run.
- Add an AI Agent node with a chat model.
- Under Tool, add MCP Client Tool.
- Endpoint:
https://www.prompteryx.ai/api/mcp. If the node asks for a transport, choose HTTP Streamable (not SSE). - Authentication: Bearer Auth with your
px_live_key (or Header Auth:Authorization=Bearer px_live_…). - Tools to Include: Selected is a good habit, for example
workflow_list,workflow_execute,browser_ai_action.
Tool list and what each does: MCP tools. The step-by-step browser_* tools are not enabled on the hosted server; use browser_ai_action.
60 requests a minute per API key (429 with Retry-After when exceeded). Workflow runs count against your plan's monthly executions; agent runs spend AI credits and cloud minutes (402 QUOTA_EXHAUSTED / 429 say which to top up).
Every endpoint and field: REST API reference.