Alegra ACTION
Create Invoice
Creates a new invoice in Alegra. See the documentation
- Action
- Writes data
- API key
- SDK
- MCP
IMPLEMENTATION
Call this tool
Connect a user's Alegra account once, then configure and run Create Invoice from your backend or agent.
import { PipedreamClient } from "@pipedream/sdk"
const pd = new PipedreamClient({
projectId: process.env.PIPEDREAM_PROJECT_ID!,
clientId: process.env.PIPEDREAM_CLIENT_ID!,
clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
projectEnvironment: "production",
})
const result = await pd.actions.run({
id: "alegra-create-invoice",
externalUserId: "{external_user_id}", // any stable ID for this user in your system
configuredProps: {
alegra: { authProvisionId: "apn_xxxxxxx" },
status: "Status",
numberTemplateId: "Number Template ID",
},
})
console.log(result)curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
-H "Content-Type: application/json" \
-H "X-PD-Environment: production" \
-H "Authorization: Bearer {access_token}" \
-d '{
"external_user_id": "{external_user_id}",
"id": "alegra-create-invoice",
"configured_props": {
"alegra": { "authProvisionId": "apn_xxxxxxx" },
"status": "Status",
"numberTemplateId": "Number Template ID"
}
}'// accessToken: mint a short-lived token with the Connect SDK — see the MCP guide
const transport = new StreamableHTTPClientTransport(
new URL("https://remote.mcp.pipedream.net/v3"),
{
requestInit: {
headers: {
Authorization: `Bearer ${accessToken}`,
"x-pd-project-id": "{project_id}",
"x-pd-environment": "production",
"x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
"x-pd-app-slug": "alegra",
},
},
},
)
const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)
const { tools } = await mcp.listTools()
// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
name: "alegra-create-invoice",
arguments: {
status: "Status",
numberTemplateId: "Number Template ID",
},
})SCHEMA
Inputs
Pipedream supplies the connected account. Your application provides the operation-specific values below. Dynamic inputs are resolved against that user's account.
| Property | Type | Description |
|---|---|---|
status Status | string | Status of the invoice. If this attribute is not sent and no associated payments are sent, the invoice is created in "draft". If payments are sent to the invoice, the invoice is created in "open". Optional |
numberTemplateId Number Template ID | string | Number template ID for the invoice. You can use this to automatically numbering. Optional |
numberTemplatePrefix Number Template Prefix | string | Number template prefix for the invoice. Send in case the numbering is manual. (Optional) Optional |
numberTemplateNumber Number Template Number | string | Number template number for the invoice. Send in case the numbering is manual. (Required) Optional |
items Items | string[] | Array of item objects (products/services) associated with the invoice. Example: [{"id": "123", "name": "Name", "price": "12.00", "quantity": "2"}]. See the documentation for further information. Required |
payments Payments | string[] | Array of objects indicating the payments made to the invoice. Example: [{"date": "YYYY-MM-DD", "account": "123123", "amount": "10,00"}]. See the documentation for further information. Optional |
estimate Estimate | string | Specifies the identifier of the quote you want to associate with the sales invoice, in this way, the quote is invoiced and the items specified in the items parameter are associated, not those in the quote. Optional |
termsConditions Terms and Conditions | string | Terms and conditions of the invoice. Maximum allowed length: 500. Optional |
annotation Annotation | string | Invoice notes, visible in the PDF or printed document. Maximum allowed length: 500. Optional |
dueDate Due Date | string | Invoice due date. Format yyyy-MM-dd. Required |
date Date | string | Invoice date. Format yyyy-MM-dd. Required |
observations Observations | string | Invoice observations (not visible in the PDF or printed document). Maximum allowed length: 500. Optional |
client Client | integer | Client associated with the invoice Required Dynamic |
seller Seller | string | Seller associated with the invoice. Optional Dynamic |
pricelist Price List | string | Price list associated with the invoice Optional Dynamic |
currency Currency | object | Object that includes the information of the currency and exchange rate associated with the invoice. It should only be included if the company has the multi-currency functionality active and has configured the selected currency. It must include the currency code (three letters according to ISO) and the exchange rate. Optional |
retentions Retentions | string[] | Array of retention objects indicating the retentions of the sales invoice. Example: [{"id": "123123", "amount": 10}]. See the documentation for further information. Optional |
warehouse Warehouse | string | Warehouse associated with the invoice Optional Dynamic |
remissions Remissions | string[] | Array of identifiers of the remissions to be invoiced, you can associate one or more remissions by simply indicating the id of each one in an array. The client of the remissions and the sales invoice must be the same. Only open remissions can be invoiced. In this way, the items of each remission will be invoiced, and you can also specify other items with the items parameter. Example: [{"id": 123, "items": [{"id": 123}], }]. See the documentation for further information. Optional |
costCenter Cost Center | string | Cost center associated with the invoice Optional Dynamic |
comments Comments | string[] | Array of strings with each of the comments to be associated. Comments can be updated even if the sales invoice cannot be edited. Optional |
periodicity Periodicity | string | Indicates the periodicity of the payments of the invoice installments. If you want to issue the invoice, the payment method is on credit this attribute becomes mandatory. Optional |
REFERENCE
Tool details
Behavior hints are published with the component in the Pipedream registry and surface as MCP tool annotations, so an agent can reason about a tool before it calls it.
- Registry key
- alegra-create-invoice
- Version
- 0.0.3
- App
- Alegra
- Authentication
- API key
- Read-only
- No
- Destructive
- No
- Open world
- Yes
- Source
- View on GitHub ↗