🤖 Analyze Transaction
Introduction​
This API allows users to send information via a POST request, and n8n will automatically generate an invoice based on that information. The API processes the content and returns an analysis based on the provided model.
Analyze Transaction​
Endpoint​
Use the following endpoint to submit the content for invoice generation:
POST https://n8n.lchatai.com/execute/analyze-transaction
Headers​
The API requires the following headers:
X-N8N-API-KEY- Your n8n API key for authenticationContent-Type: multipart/form-data
Request Parameters​
The API expects the following parameters as multipart/form-data fields:
-
model(string) - The AI model to use. Accepted values:Provider Models OpenAI gpt-4o,gpt-4o-mini,gpt-4-turbo,gpt-3.5-turbo,gpt-4.1,gpt-4.1-mini,gpt-4.1-nano,gpt-5.2,gpt-5.2-pro,gpt-5,gpt-5-mini,gpt-5-nanoGemini gemini-2.5-flash,gemini-2.5-pro,gemini-2.5-flash-lite,gemini-3-flash-preview,gemini-3.1-pro-previewClaude claude-sonnet-4-6,claude-opus-4-6,claude-opus-4-5-20251101,claude-haiku-4-5-20251001,claude-sonnet-4-5-20250929,claude-opus-4-1-20250805,claude-opus-4-20250514,claude-sonnet-4-20250514 -
prompt(string) - The specific prompt to provide for the invoice generation. -
llmKey(string) - Your API key for the selected model. -
content(string) - The information used to generate the invoice as plain text. Leave empty ("") when uploading a file via thefilefield. -
file(file) - A PDF or document file to use as the basis for invoice generation. Leave empty ("") when using thecontentfield.
Exactly one of content or file must be provided per request. If you are sending text, pass file="". If you are uploading a file, pass content="".
Example Request​
- Bash
- Javascript
- Python
- Php
Text Content
curl --location 'https://n8n.lchatai.com/execute/analyze-transaction' \
--header 'X-N8N-API-KEY: ey*********' \
--form 'model="gpt-4o-mini"' \
--form 'prompt="..."' \
--form 'content="Invoice information text here..."' \
--form 'llmKey="sk-proj-ERa23*******"' \
--form 'file=""'
File Upload
curl --location 'https://n8n.lchatai.com/execute/analyze-transaction' \
--header 'X-N8N-API-KEY: ey*********' \
--form 'model="gpt-4o-mini"' \
--form 'prompt="..."' \
--form 'content=""' \
--form 'llmKey="sk-proj-ERa23*******"' \
--form 'file=@"/path/to/invoice.pdf"'
Text Content
// Text Content mode
const formData = new FormData();
formData.append('model', 'gpt-4o-mini');
formData.append('prompt', '...');
formData.append('content', 'Invoice information text here...');
formData.append('llmKey', 'sk-proj-ERa23*******');
formData.append('file', '');
fetch('https://n8n.lchatai.com/execute/analyze-transaction', {
method: 'POST',
headers: { 'X-N8N-API-KEY': 'ey*********' },
body: formData
})
.then(response => response.json())
.then(data => console.log(data));
File Upload
// File Upload mode
const formData = new FormData();
formData.append('model', 'gpt-4o-mini');
formData.append('prompt', '...');
formData.append('content', '');
formData.append('llmKey', 'sk-proj-ERa23*******');
formData.append('file', fileInput.files[0]); // File object from <input type="file">
fetch('https://n8n.lchatai.com/execute/analyze-transaction', {
method: 'POST',
headers: { 'X-N8N-API-KEY': 'ey*********' },
body: formData
})
.then(response => response.json())
.then(data => console.log(data));
Text Content
import requests
url = "https://n8n.lchatai.com/execute/analyze-transaction"
headers = { "X-N8N-API-KEY": "ey*********" }
# Text Content mode
data = {
"model": "gpt-4o-mini",
"prompt": "...",
"content": "Invoice information text here...",
"llmKey": "sk-proj-ERa23*******",
"file": ""
}
response = requests.post(url, headers=headers, data=data)
print(response.json())
File Upload
import requests
url = "https://n8n.lchatai.com/execute/analyze-transaction"
headers = { "X-N8N-API-KEY": "ey*********" }
# File Upload mode
data = {
"model": "gpt-4o-mini",
"prompt": "...",
"content": "",
"llmKey": "sk-proj-ERa23*******"
}
files = { "file": open("/path/to/invoice.pdf", "rb") }
response = requests.post(url, headers=headers, data=data, files=files)
print(response.json())
Text Content
<?php
// Text Content mode
$url = "https://n8n.lchatai.com/execute/analyze-transaction";
$headers = ["X-N8N-API-KEY: ey*********"];
$data = [
"model" => "gpt-4o-mini",
"prompt" => "...",
"content" => "Invoice information text here...",
"llmKey" => "sk-proj-ERa23*******",
"file" => ""
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($ch);
curl_close($ch);
?>
File Upload
<?php
// File Upload mode
$url = "https://n8n.lchatai.com/execute/analyze-transaction";
$headers = ["X-N8N-API-KEY: ey*********"];
$data = [
"model" => "gpt-4o-mini",
"prompt" => "...",
"content" => "",
"llmKey" => "sk-proj-ERa23*******",
"file" => new CURLFile("/path/to/invoice.pdf")
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($ch);
curl_close($ch);
?>
Response​
The response body contains the following two keys:
response(string): The result of the invoice generation, which provides the generated invoice based on the provided information.execution_id(integer): A unique identifier for the specific execution of the invoice generation workflow.
{
"response": ".....",
"execution_id": 778
}