Skip to main content

🤖 Execute invoice analytics workflow

Introduction​

This API allows users to send an invoice via a POST request, and n8n will automatically evaluate and rate the invoice. The API processes the content and returns an analysis based on the provided model.

Execute an invoice analytics​

Endpoint​

Use the following endpoint to submit the invoice for analytic:

POST https://n8n.japanyosan.com/execute/invoice-analytics

Headers​

The API requires the following headers:

  • X-N8N-API-KEY - Your n8n API key for authentication
  • Content-Type: application/json

Request Parameters​

  • The API expects the following parameters as a JSON payload:
  • model (string) - The AI model to use. Accepted values:
    • ollama
    • gpt-4o
    • gpt-4o-mini
    • gpt-4-turbo
    • gpt-3.5-turbo
    • gemini-1.5-pro
    • gemini-1.5-flash
    • claude-3-5-sonnet-latest
    • claude-3-5-haiku-latest
    • claude-3-opus-latest
  • prompt (string) - The specific prompt to provide for the invoice evaluation.
  • content (string) - The invoice text to be analyzed.
  • llmKey (string) - Your API key for the selected model. Not required when using the ollama model.

Example Request​

curl --location 'https://n8n.japanyosan.com/execute/invoice-analytics' \
--header 'X-N8N-API-KEY: ey*********' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-4o-mini",
"content": "...",
"llmKey": "sk-proj-ERa23*******",
"prompt": "..."
}'

For Ollama model requests, you can omit the llmKey:

curl --location 'https://n8n.japanyosan.com/execute/invoice-analytics' \
--header 'X-N8N-API-KEY: ey*********' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-4o-mini",
"content": "...",
"prompt": "..."
}'

Response​

The response body contains the following two keys:

  • response (string): The result of the invoice analysis, which provides the evaluation and rating of the submitted invoice.
  • execution_id (integer): A unique identifier for the specific execution of the invoice analytics workflow.
{
"response": ".....",
"execution_id": 778
}