Invoices API
Create, manage, and track invoices and customers programmatically.
Required scopes#
| Endpoint | Scope |
|---|---|
| List / Get customers | customers:read |
| Create / Update / Delete customers | customers:write |
| List / Get invoices | invoices:read |
| Create / Update / Delete invoices | invoices:write |
| Send / Mark as paid / Cancel invoices | invoices:send |
| Set or clear a payment link (generate_payment_link) | payment_links:write |
| Create credit note | invoices:write |
| Auto-approve created invoices (behavior, not an endpoint) | invoices:auto_approve |
Approval before send#
pending_approval status and does not expose an approve endpoint. The invoice number is given at approval, so the create response carries "number": null; read it back with GET /api/invoices/:id once the invoice is approved. Before POST /api/invoices/:id/send works, the invoice must be approved. Dashboard Approve & Send also sends it once approval requirements are met; do not call send again. For unattended issuance, use the auto-approval scope below.invoices:auto_approve scope skips the approval step entirely: POST /api/invoices (and POST /api/invoices/:id/credit_note) return the invoice approved, with its number. With a send_to_email the invoice email is queued too and the status is sent; with none the status is approved and sent_at is null. The approval happens in the same call, and its date rules are checked before anything is saved: an invoice dated after today is refused with a 422 and nothing is created (every key's create already refuses an issue date in a month before the newest number's month). Should the approval itself fail after the save, the invoice stays in review without a number; read it back before retrying. This bypasses any approval rules configured for the entity — including multi-approval requirements — so grant the scope only to integrations trusted to issue invoices on their own, such as recurring-invoicing automations.Recurring invoices and branding#
For fixed monthly subscriptions, create the customer once and schedule one POST /api/invoices per billing period from your application. Reuse the customer and agreed line items, updating the dates and billing-period reference. The API creates individual invoices; it does not manage subscription schedules. Stop future creation jobs when a subscription ends. Cancelling an existing invoice does not cancel a schedule in your application.
For example, Ruby can build the period reference as "club-#{club_id}-#{billing_month}".
Grant the integration invoices:write and invoices:auto_approve to create invoices without monthly manual approval. No approved=true parameter is needed. This permission bypasses all approval rules and is not limited to an agreed amount. Include send_to_email so the invoice is emailed: without it the invoice stops at approved and is never sent. sent alone is not proof of email delivery or payment. For a card-payment link in that email, see the Recurring billing guide.
Keep a unique billing record per subscription and period in your application. Invoice creation does not provide an Idempotency-Key guarantee, and reference is not a uniqueness constraint. A 422 for the request body, the issue date rules or the payment link check is answered before anything is saved. A failure after the save (the approval step of an invoices:auto_approve key, or a lost response) can leave the invoice saved in pending_approval without a number, so store returned invoice IDs and reconcile an ambiguous failure before retrying creation. Use invoices:read to retrieve invoices during reconciliation.
Upload your issuing company's logo once in the dashboard's business profile settings. Invoice previews and PDFs use the issuing entity's logo, including for API-created invoices. The customer object represents the recipient, not the invoice issuer. The public API does not currently expose logo upload or invoice-branding settings; there is no per-invoice logo parameter. Complete this dashboard setup before enabling automatic sending.
Customer object#
Customers must exist before they can be referenced in invoices.
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier (UUIDv7) |
customer_type | string | individual or business (auto-detected from company_name, and from registration_number where the market collects one) |
person_name | string | Individual's name |
company_name | string | Company name (typically for business customers) |
name | string | Computed: company_name if present, else person_name |
email | string | Email address (unique per entity) |
phone | string | Phone number |
tax_id | string | Tax identification number (identifiant fiscal; optional; any country's format, must include at least one digit, at most 50 characters) |
ice_number | string | ICE number (optional; must be exactly 15 digits when set) |
billing_address | object | Billing address |
invoices_count | integer | Number of invoices (list only) |
created_at | string | ISO 8601 timestamp |
updated_at | string | ISO 8601 timestamp |
The billing_address object carries street, street2, city, postal_code, and country_code (ISO 3166-1 alpha-2). When an address is provided, all fields except street2 are required. The country field is refused with a 400, whatever it holds; send country_code instead.
List customers#
GET /api/customers
Supports q (search by name, company, email) plus cursor pagination (cursor, limit 1–100, default 25).
curl "https://ma.manza.dev/api/customers?q=acme" \
-H "Authorization: Bearer sk_live_..."manza customers listimport { Manza } from "@getmanza/sdk";
const manza = new Manza({ apiKey: process.env.MANZA_API_KEY });
await manza.customers.list({ q: "acme" });require "manza"
manza = Manza.new(api_key: ENV["MANZA_API_KEY"])
manza.customers.list(q: "acme")from manza import Manza
client = Manza() # reads MANZA_API_KEY
client.customers.list(q="acme")import manza "github.com/getmanza/manza-go/v2"
client, _ := manza.New(manza.WithAPIKey(os.Getenv("MANZA_API_KEY")))
page, err := client.Customers.List(ctx, manza.CustomerListParams{Query: "acme"})let client = manza::Client::builder()
.api_key(std::env::var("MANZA_API_KEY")?)
.build()?;
let params = manza::CustomerListParams { q: Some("acme".into()), ..Default::default() };
let page = client.customers().list(params)?;{:ok, client} = Manza.new(api_key: System.fetch_env!("MANZA_API_KEY"))
{:ok, page} = Manza.Customers.list(client, q: "acme")require "manza"
client = Manza::Client.new # reads MANZA_API_KEY
page = client.customers.list(q: "acme")use Manza\Client;
$client = new Client(apiKey: getenv('MANZA_API_KEY'));
$page = $client->customers->list(q: 'acme');Create customer#
POST /api/customers
Requires at least one of person_name or company_name. When customer_type is omitted it is auto-detected: business when a company name is present, individual otherwise.
curl -X POST "https://ma.manza.dev/api/customers" \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"customer_type": "business",
"person_name": "Ahmed Benjelloun",
"company_name": "Acme Corp",
"email": "billing@acme.com",
"phone": "+212600000000",
"tax_id": "TAX123456",
"ice_number": "000000000000001",
"billing_address": {
"street": "123 Main St",
"city": "Casablanca",
"postal_code": "20000",
"country_code": "MA"
}
}'manza customers create --file customer.jsonimport { Manza } from "@getmanza/sdk";
const manza = new Manza({ apiKey: process.env.MANZA_API_KEY });
await manza.customers.create({
customer_type: "business",
company_name: "Acme Corp",
email: "billing@acme.com",
});require "manza"
manza = Manza.new(api_key: ENV["MANZA_API_KEY"])
manza.customers.create(
customer_type: "business",
company_name: "Acme Corp",
email: "billing@acme.com",
)from manza import Manza
client = Manza() # reads MANZA_API_KEY
client.customers.create(
customer_type="business",
company_name="Acme Corp",
email="billing@acme.com",
)import manza "github.com/getmanza/manza-go/v2"
client, _ := manza.New(manza.WithAPIKey(os.Getenv("MANZA_API_KEY")))
customer, err := client.Customers.Create(ctx, manza.Attributes{
"customer_type": "business",
"company_name": "Acme Corp",
"email": "billing@acme.com",
})let client = manza::Client::builder()
.api_key(std::env::var("MANZA_API_KEY")?)
.build()?;
let customer = client.customers().create(&serde_json::json!({
"customer_type": "business",
"company_name": "Acme Corp",
"email": "billing@acme.com",
}))?;{:ok, client} = Manza.new(api_key: System.fetch_env!("MANZA_API_KEY"))
{:ok, customer} =
Manza.Customers.create(client, %{
"customer_type" => "business",
"company_name" => "Acme Corp",
"email" => "billing@acme.com"
})require "manza"
client = Manza::Client.new # reads MANZA_API_KEY
customer = client.customers.create(
customer_type: "business",
company_name: "Acme Corp",
email: "billing@acme.com"
)use Manza\Client;
$client = new Client(apiKey: getenv('MANZA_API_KEY'));
$customer = $client->customers->create([
'customer_type' => 'business',
'company_name' => 'Acme Corp',
'email' => 'billing@acme.com',
]);Responds 201 Created with the full customer object.
Get customer#
GET /api/customers/:id
curl "https://ma.manza.dev/api/customers/01964a3b-0000-7000-8000-customer0001" \
-H "Authorization: Bearer sk_live_..."manza customers get 01964a3b-0000-7000-8000-customer0001import { Manza } from "@getmanza/sdk";
const manza = new Manza({ apiKey: process.env.MANZA_API_KEY });
await manza.customers.get("01964a3b-0000-7000-8000-customer0001");require "manza"
manza = Manza.new(api_key: ENV["MANZA_API_KEY"])
manza.customers.get("01964a3b-0000-7000-8000-customer0001")from manza import Manza
client = Manza() # reads MANZA_API_KEY
client.customers.get("01964a3b-0000-7000-8000-customer0001")import manza "github.com/getmanza/manza-go/v2"
client, _ := manza.New(manza.WithAPIKey(os.Getenv("MANZA_API_KEY")))
customer, err := client.Customers.Get(ctx, "01964a3b-0000-7000-8000-customer0001")let client = manza::Client::builder()
.api_key(std::env::var("MANZA_API_KEY")?)
.build()?;
let customer = client.customers().get("01964a3b-0000-7000-8000-customer0001")?;{:ok, client} = Manza.new(api_key: System.fetch_env!("MANZA_API_KEY"))
{:ok, customer} = Manza.Customers.get(client, "01964a3b-0000-7000-8000-customer0001")require "manza"
client = Manza::Client.new # reads MANZA_API_KEY
customer = client.customers.get("01964a3b-0000-7000-8000-customer0001")use Manza\Client;
$client = new Client(apiKey: getenv('MANZA_API_KEY'));
$customer = $client->customers->get('01964a3b-0000-7000-8000-customer0001');Update customer#
PATCH /api/customers/:id
Partial update — only provided fields change. A supplied billing_address replaces the existing one entirely; setting it to null deletes the address.
curl -X PATCH "https://ma.manza.dev/api/customers/01964a3b-0000-7000-8000-customer0001" \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"email": "newemail@acme.com",
"billing_address": {
"street": "456 New St",
"city": "Rabat",
"postal_code": "10000",
"country_code": "MA"
}
}'manza customers update 01964a3b-0000-7000-8000-customer0001 --file customer.jsonimport { Manza } from "@getmanza/sdk";
const manza = new Manza({ apiKey: process.env.MANZA_API_KEY });
await manza.customers.update("01964a3b-0000-7000-8000-customer0001", { email: "newemail@acme.com" });require "manza"
manza = Manza.new(api_key: ENV["MANZA_API_KEY"])
manza.customers.update("01964a3b-0000-7000-8000-customer0001", email: "newemail@acme.com")from manza import Manza
client = Manza() # reads MANZA_API_KEY
client.customers.update("01964a3b-0000-7000-8000-customer0001", email="newemail@acme.com")import manza "github.com/getmanza/manza-go/v2"
client, _ := manza.New(manza.WithAPIKey(os.Getenv("MANZA_API_KEY")))
customer, err := client.Customers.Update(ctx, "01964a3b-0000-7000-8000-customer0001",
manza.Attributes{"email": "newemail@acme.com"})let client = manza::Client::builder()
.api_key(std::env::var("MANZA_API_KEY")?)
.build()?;
let customer = client.customers()
.update("01964a3b-0000-7000-8000-customer0001", &serde_json::json!({ "email": "newemail@acme.com" }))?;{:ok, client} = Manza.new(api_key: System.fetch_env!("MANZA_API_KEY"))
{:ok, customer} =
Manza.Customers.update(client, "01964a3b-0000-7000-8000-customer0001", %{"email" => "newemail@acme.com"})require "manza"
client = Manza::Client.new # reads MANZA_API_KEY
customer = client.customers.update("01964a3b-0000-7000-8000-customer0001", email: "newemail@acme.com")use Manza\Client;
$client = new Client(apiKey: getenv('MANZA_API_KEY'));
$customer = $client->customers->update('01964a3b-0000-7000-8000-customer0001', ['email' => 'newemail@acme.com']);Delete customer#
DELETE /api/customers/:id
Responds 204 No Content. A customer that still has invoices cannot be deleted — that returns 422 unprocessable_entity.
curl -X DELETE "https://ma.manza.dev/api/customers/01964a3b-0000-7000-8000-customer0001" \
-H "Authorization: Bearer sk_live_..."manza customers delete 01964a3b-0000-7000-8000-customer0001import { Manza } from "@getmanza/sdk";
const manza = new Manza({ apiKey: process.env.MANZA_API_KEY });
await manza.customers.delete("01964a3b-0000-7000-8000-customer0001");require "manza"
manza = Manza.new(api_key: ENV["MANZA_API_KEY"])
manza.customers.delete("01964a3b-0000-7000-8000-customer0001")from manza import Manza
client = Manza() # reads MANZA_API_KEY
client.customers.delete("01964a3b-0000-7000-8000-customer0001")import manza "github.com/getmanza/manza-go/v2"
client, _ := manza.New(manza.WithAPIKey(os.Getenv("MANZA_API_KEY")))
_, err := client.Customers.Delete(ctx, "01964a3b-0000-7000-8000-customer0001")let client = manza::Client::builder()
.api_key(std::env::var("MANZA_API_KEY")?)
.build()?;
client.customers().delete("01964a3b-0000-7000-8000-customer0001")?;{:ok, client} = Manza.new(api_key: System.fetch_env!("MANZA_API_KEY"))
{:ok, _} = Manza.Customers.delete(client, "01964a3b-0000-7000-8000-customer0001")require "manza"
client = Manza::Client.new # reads MANZA_API_KEY
client.customers.delete("01964a3b-0000-7000-8000-customer0001")use Manza\Client;
$client = new Client(apiKey: getenv('MANZA_API_KEY'));
$client->customers->delete('01964a3b-0000-7000-8000-customer0001');Invoice object#
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier (UUIDv7) |
number | string/null | Given at approval (default <prefix><date>-<sequence>, configurable per entity); null while the invoice is in pending_approval or declined (a few invoices created before this change may already carry a number in either status) |
status | string | draft, pending_approval, declined, approved, sent, paid, overdue, cancelled. A credit note holds only draft, pending_approval, declined, approved, sent or cancelled |
currency_code | string | ISO 4217 currency code |
subtotal | string | Sum of item amounts |
discount_total | string | Total discount amount |
tax_total | string | Total tax amount |
total | string | Final amount due |
issue_date | string | Date (YYYY-MM-DD) |
due_date | string/null | Date (YYYY-MM-DD). Null on a credit note, which asks nobody to pay |
delivery_date | string | Delivery date (YYYY-MM-DD, optional) |
reference | string | PO number or external reference. A new or changed one is kept on one line, at most 64 characters |
notes | string | Free-text notes |
payment_terms | string | Payment terms text |
send_to_email | string/null | Where the invoice is emailed. It cannot change once the invoice is approved. With none the invoice cannot be sent |
generate_payment_link | boolean | Whether approval makes a card payment link for the invoice |
credited_invoice_id | string/null | ID of the credited invoice |
credit_note | boolean | Whether this invoice is a credit note |
sent_at | string/null | ISO 8601 timestamp of the invoice email. Null on an invoice that was never sent, which can still be paid or overdue |
paid_at | string | ISO 8601 timestamp |
account | object/null | Bank account the invoice is paid into: id, name, currency_code and the market's number (see Accounts). Null on a credit note of an invoice that predates the account rule |
customer | object | Snapshotted customer data |
billing_address | object | Snapshotted billing address |
items | array | Line items (show only) |
discounts | array | Discounts (show only) |
payment_link | object | Attached payment link (show only) |
created_at | string | ISO 8601 timestamp |
updated_at | string | ISO 8601 timestamp |
Items and discounts#
Each item carries description, quantity, unit_price, tax_rate (a fraction, e.g. "0.2000" = 20%; one of the entity's allowed VAT rates: its standard rate, in Morocco also the reduced "0.1000" (10%), or "0" for an export or other zero-rated supply — a business that is not VAT-registered can only issue at 0%), a calculated amount (quantity × unit_price), and a position sort order.
Each discount carries description, discount_type (percentage or fixed), value (percentage 0–100 or fixed amount), a calculated amount, and a position sort order.
List invoices#
GET /api/invoices
Filter by status and customer_id, plus cursor pagination. The list response returns items_count and discounts_count instead of the full arrays, and payment_link_url instead of the full payment-link object.
curl "https://ma.manza.dev/api/invoices?status=sent" \
-H "Authorization: Bearer sk_live_..."manza invoices listimport { Manza } from "@getmanza/sdk";
const manza = new Manza({ apiKey: process.env.MANZA_API_KEY });
await manza.invoices.list({ status: "sent" });require "manza"
manza = Manza.new(api_key: ENV["MANZA_API_KEY"])
manza.invoices.list(status: "sent")from manza import Manza
client = Manza() # reads MANZA_API_KEY
client.invoices.list(status="sent")import manza "github.com/getmanza/manza-go/v2"
client, _ := manza.New(manza.WithAPIKey(os.Getenv("MANZA_API_KEY")))
page, err := client.Invoices.List(ctx, manza.InvoiceListParams{Status: "sent"})let client = manza::Client::builder()
.api_key(std::env::var("MANZA_API_KEY")?)
.build()?;
let params = manza::InvoiceListParams { status: Some("sent".into()), ..Default::default() };
let page = client.invoices().list(params)?;{:ok, client} = Manza.new(api_key: System.fetch_env!("MANZA_API_KEY"))
{:ok, page} = Manza.Invoices.list(client, status: "sent")require "manza"
client = Manza::Client.new # reads MANZA_API_KEY
page = client.invoices.list(status: "sent")use Manza\Client;
$client = new Client(apiKey: getenv('MANZA_API_KEY'));
$page = $client->invoices->list(status: 'sent');Create invoice#
POST /api/invoices
By default, creates an invoice directly in pending_approval status (no draft workflow) with no number yet. With invoices:auto_approve, it is approved and numbered automatically, and emailed when it has a send_to_email. Required: customer_id, account_id (the bank account the invoice is paid into; discover valid account IDs via GET /api/accounts), issue_date, due_date, and at least one item. Totals are calculated automatically, currency_code defaults to entity currency, and per-item tax_rate defaults to the entity's standard VAT rate if omitted (0% for a business that is not VAT-registered). Any other value is rejected with a 422 whose param is invoice_items.tax_rate.
Optionally pass delivery_date (YYYY-MM-DD) to record when the goods or services were delivered.
Set generate_payment_link to true (needs the payment_links:write scope, and payment links enabled for your account) to give the invoice a card payment link. Approval makes the link, for the invoice's total and into the invoice's bank account, so the invoice email includes it. An invoice without a bank account cannot have one: the create answers 422 state_error.
Upload the company stamp in the app's invoice settings before you create invoices. The API cannot upload it, and until it is there this endpoint responds 422 state_error.
curl -X POST "https://ma.manza.dev/api/invoices" \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"customer_id": "01964a3b-0000-7000-8000-customer0001",
"account_id": "01964a3b-0000-7000-8000-ac6000000a01",
"currency_code": "MAD",
"issue_date": "2026-03-15",
"due_date": "2026-04-15",
"delivery_date": "2026-04-10",
"reference": "PO-2026-001",
"notes": "Net 30 payment terms",
"payment_terms": "Net 30",
"send_to_email": "billing@acme.com",
"items": [
{
"description": "Consulting services - March 2026",
"quantity": 10,
"unit_price": "150.00"
},
{
"description": "Travel expenses",
"quantity": 1,
"unit_price": "500.00",
"tax_rate": "0.00"
}
],
"discounts": [
{
"description": "Loyalty discount",
"discount_type": "percentage",
"value": "10.00"
}
]
}'manza invoices create --file invoice.jsonimport { Manza } from "@getmanza/sdk";
const manza = new Manza({ apiKey: process.env.MANZA_API_KEY });
await manza.invoices.create({
customer_id: "01964a3b-0000-7000-8000-customer0001",
account_id: "01964a3b-0000-7000-8000-ac6000000a01",
currency_code: "MAD",
issue_date: "2026-03-15",
due_date: "2026-04-15",
items: [
{ description: "Consulting services", quantity: 10, unit_price: "150.00" },
],
});require "manza"
manza = Manza.new(api_key: ENV["MANZA_API_KEY"])
manza.invoices.create(
customer_id: "01964a3b-0000-7000-8000-customer0001",
account_id: "01964a3b-0000-7000-8000-ac6000000a01",
currency_code: "MAD",
issue_date: "2026-03-15",
due_date: "2026-04-15",
items: [
{ description: "Consulting services", quantity: 10, unit_price: "150.00" },
],
)from manza import Manza
client = Manza() # reads MANZA_API_KEY
client.invoices.create(
customer_id="01964a3b-0000-7000-8000-customer0001",
account_id="01964a3b-0000-7000-8000-ac6000000a01",
currency_code="MAD",
issue_date="2026-03-15",
due_date="2026-04-15",
items=[
{"description": "Consulting services", "quantity": 10, "unit_price": "150.00"},
],
)import manza "github.com/getmanza/manza-go/v2"
client, _ := manza.New(manza.WithAPIKey(os.Getenv("MANZA_API_KEY")))
invoice, err := client.Invoices.Create(ctx, manza.Attributes{
"customer_id": "01964a3b-0000-7000-8000-customer0001",
"account_id": "01964a3b-0000-7000-8000-ac6000000a01",
"currency_code": "MAD",
"issue_date": "2026-03-15",
"due_date": "2026-04-15",
"items": []manza.Attributes{
{"description": "Consulting services", "quantity": 10, "unit_price": "150.00"},
},
})let client = manza::Client::builder()
.api_key(std::env::var("MANZA_API_KEY")?)
.build()?;
let invoice = client.invoices().create(&serde_json::json!({
"customer_id": "01964a3b-0000-7000-8000-customer0001",
"account_id": "01964a3b-0000-7000-8000-ac6000000a01",
"currency_code": "MAD",
"issue_date": "2026-03-15",
"due_date": "2026-04-15",
"items": [
{ "description": "Consulting services", "quantity": 10, "unit_price": "150.00" },
],
}))?;{:ok, client} = Manza.new(api_key: System.fetch_env!("MANZA_API_KEY"))
{:ok, invoice} =
Manza.Invoices.create(client, %{
"customer_id" => "01964a3b-0000-7000-8000-customer0001",
"account_id" => "01964a3b-0000-7000-8000-ac6000000a01",
"currency_code" => "MAD",
"issue_date" => "2026-03-15",
"due_date" => "2026-04-15",
"items" => [
%{"description" => "Consulting services", "quantity" => 10, "unit_price" => "150.00"}
]
})require "manza"
client = Manza::Client.new # reads MANZA_API_KEY
invoice = client.invoices.create(
customer_id: "01964a3b-0000-7000-8000-customer0001",
account_id: "01964a3b-0000-7000-8000-ac6000000a01",
currency_code: "MAD",
issue_date: "2026-03-15",
due_date: "2026-04-15",
items: [
{description: "Consulting services", quantity: 10, unit_price: "150.00"},
]
)use Manza\Client;
$client = new Client(apiKey: getenv('MANZA_API_KEY'));
$invoice = $client->invoices->create([
'customer_id' => '01964a3b-0000-7000-8000-customer0001',
'account_id' => '01964a3b-0000-7000-8000-ac6000000a01',
'currency_code' => 'MAD',
'issue_date' => '2026-03-15',
'due_date' => '2026-04-15',
'items' => [
['description' => 'Consulting services', 'quantity' => 10, 'unit_price' => '150.00'],
],
]);Responds 201 Created with the full invoice object. The issue_date may be in this month or next month, and may be backdated unless a newer number has closed that month; any other date is refused with a 422 on issue_date. Without invoices:auto_approve the object has "number": null and "status": "pending_approval":
{
"id": "01964a3b-7c8d-7000-8000-deadbeef1234",
"number": null,
"status": "pending_approval",
"issue_date": "2026-03-15",
"due_date": "2026-04-15"
}Each create takes one of the invoices a month your plan allows. Past that cap the API answers 422 plan_limit_reached with kind, current and max, and creates nothing.
Get invoice#
GET /api/invoices/:id
Returns the full invoice with items, discounts, customer snapshot, billing address, payment link, and any credit_notes issued against it.
curl "https://ma.manza.dev/api/invoices/01964a3b-7c8d-7000-8000-deadbeef1234" \
-H "Authorization: Bearer sk_live_..."manza invoices get 01964a3b-7c8d-7000-8000-deadbeef1234import { Manza } from "@getmanza/sdk";
const manza = new Manza({ apiKey: process.env.MANZA_API_KEY });
await manza.invoices.get("01964a3b-7c8d-7000-8000-deadbeef1234");require "manza"
manza = Manza.new(api_key: ENV["MANZA_API_KEY"])
manza.invoices.get("01964a3b-7c8d-7000-8000-deadbeef1234")from manza import Manza
client = Manza() # reads MANZA_API_KEY
client.invoices.get("01964a3b-7c8d-7000-8000-deadbeef1234")import manza "github.com/getmanza/manza-go/v2"
client, _ := manza.New(manza.WithAPIKey(os.Getenv("MANZA_API_KEY")))
invoice, err := client.Invoices.Get(ctx, "01964a3b-7c8d-7000-8000-deadbeef1234")let client = manza::Client::builder()
.api_key(std::env::var("MANZA_API_KEY")?)
.build()?;
let invoice = client.invoices().get("01964a3b-7c8d-7000-8000-deadbeef1234")?;{:ok, client} = Manza.new(api_key: System.fetch_env!("MANZA_API_KEY"))
{:ok, invoice} = Manza.Invoices.get(client, "01964a3b-7c8d-7000-8000-deadbeef1234")require "manza"
client = Manza::Client.new # reads MANZA_API_KEY
invoice = client.invoices.get("01964a3b-7c8d-7000-8000-deadbeef1234")use Manza\Client;
$client = new Client(apiKey: getenv('MANZA_API_KEY'));
$invoice = $client->invoices->get('01964a3b-7c8d-7000-8000-deadbeef1234');{
"id": "01964a3b-7c8d-7000-8000-deadbeef1234",
"number": "INV-202603-001",
"status": "sent",
"currency_code": "MAD",
"subtotal": "1500.00",
"discount_total": "150.00",
"tax_total": "270.00",
"total": "1620.00",
"issue_date": "2026-03-15",
"due_date": "2026-04-15",
"delivery_date": "2026-04-10",
"generate_payment_link": true,
"customer": {
"id": "01964a3b-0000-7000-8000-customer0001",
"name": "Acme Corp",
"email": "billing@acme.com"
},
"account": {
"id": "01964a3b-0000-7000-8000-ac6000000a01",
"name": "Operations",
"currency_code": "MAD",
"rib": "007780000123456789012345"
},
"items": [
{
"id": "01964a3b-1111-7000-8000-item00000001",
"description": "Consulting services - March 2026",
"quantity": "10.00",
"unit_price": "150.00",
"tax_rate": "0.2000",
"amount": "1500.00",
"position": 0
}
],
"discounts": [
{
"id": "01964a3b-2222-7000-8000-disc00000001",
"description": "Loyalty discount",
"discount_type": "percentage",
"value": "10.00",
"amount": "150.00",
"position": 0
}
],
"payment_link": {
"id": "01964a3b-3333-7000-8000-link00000001",
"url": "https://pay.zazu.example/payment-link/abc123def456",
"status": "active"
},
"created_at": "2026-03-15T09:00:00Z",
"updated_at": "2026-03-16T10:00:00Z"
}Update invoice#
PATCH /api/invoices/:id
Only invoices in pending_approval or draft status can be updated — an approved invoice is frozen, so from approved on the API returns 422 state_error. currency_code, number, and status are not updatable; account_id can change to another of your accounts but cannot be cleared. Setting generate_payment_link to false also removes a payment link the invoice already has. Items and discounts use full replacement: entries with a matching id are updated, entries without an id are created, and existing entries absent from the array are deleted. Totals are recalculated automatically.
curl -X PATCH "https://ma.manza.dev/api/invoices/01964a3b-7c8d-7000-8000-deadbeef1234" \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{"notes": "Updated terms"}'manza invoices update 01964a3b-7c8d-7000-8000-deadbeef1234 --file invoice.jsonimport { Manza } from "@getmanza/sdk";
const manza = new Manza({ apiKey: process.env.MANZA_API_KEY });
await manza.invoices.update("01964a3b-7c8d-7000-8000-deadbeef1234", { notes: "Updated terms" });require "manza"
manza = Manza.new(api_key: ENV["MANZA_API_KEY"])
manza.invoices.update("01964a3b-7c8d-7000-8000-deadbeef1234", notes: "Updated terms")from manza import Manza
client = Manza() # reads MANZA_API_KEY
client.invoices.update("01964a3b-7c8d-7000-8000-deadbeef1234", notes="Updated terms")import manza "github.com/getmanza/manza-go/v2"
client, _ := manza.New(manza.WithAPIKey(os.Getenv("MANZA_API_KEY")))
invoice, err := client.Invoices.Update(ctx, "01964a3b-7c8d-7000-8000-deadbeef1234", manza.Attributes{"notes": "Updated terms"})let client = manza::Client::builder()
.api_key(std::env::var("MANZA_API_KEY")?)
.build()?;
let invoice = client.invoices()
.update("01964a3b-7c8d-7000-8000-deadbeef1234", &serde_json::json!({ "notes": "Updated terms" }))?;{:ok, client} = Manza.new(api_key: System.fetch_env!("MANZA_API_KEY"))
{:ok, invoice} = Manza.Invoices.update(client, "01964a3b-7c8d-7000-8000-deadbeef1234", %{"notes" => "Updated terms"})require "manza"
client = Manza::Client.new # reads MANZA_API_KEY
invoice = client.invoices.update("01964a3b-7c8d-7000-8000-deadbeef1234", notes: "Updated terms")use Manza\Client;
$client = new Client(apiKey: getenv('MANZA_API_KEY'));
$invoice = $client->invoices->update('01964a3b-7c8d-7000-8000-deadbeef1234', ['notes' => 'Updated terms']);Send invoice#
POST /api/invoices/:id/send
Emails the invoice to its send_to_email, transitions it to sent and sets sent_at. Available from approved, and from overdue while sent_at is null (the status then stays overdue). Without auto-approval, API-created invoices start in pending_approval. Dashboard Approve & Send also sends the invoice. Invoices created with invoices:auto_approve and a send_to_email are already sent; do not call this endpoint again for them.
Sending is optional, and it is an email: an invoice with no usable send_to_email is refused with a 422 whose param is send_to_email, and stays as it was. The address cannot change after approval, so mark such an invoice as paid when the customer pays, or cancel it.
curl -X POST "https://ma.manza.dev/api/invoices/01964a3b-7c8d-7000-8000-deadbeef1234/send" \
-H "Authorization: Bearer sk_live_..."manza invoices send 01964a3b-7c8d-7000-8000-deadbeef1234import { Manza } from "@getmanza/sdk";
const manza = new Manza({ apiKey: process.env.MANZA_API_KEY });
await manza.invoices.send("01964a3b-7c8d-7000-8000-deadbeef1234");require "manza"
manza = Manza.new(api_key: ENV["MANZA_API_KEY"])
manza.invoices.send_invoice("01964a3b-7c8d-7000-8000-deadbeef1234")from manza import Manza
client = Manza() # reads MANZA_API_KEY
client.invoices.send_invoice("01964a3b-7c8d-7000-8000-deadbeef1234")import manza "github.com/getmanza/manza-go/v2"
client, _ := manza.New(manza.WithAPIKey(os.Getenv("MANZA_API_KEY")))
invoice, err := client.Invoices.Send(ctx, "01964a3b-7c8d-7000-8000-deadbeef1234")let client = manza::Client::builder()
.api_key(std::env::var("MANZA_API_KEY")?)
.build()?;
let invoice = client.invoices().send("01964a3b-7c8d-7000-8000-deadbeef1234")?;{:ok, client} = Manza.new(api_key: System.fetch_env!("MANZA_API_KEY"))
{:ok, invoice} = Manza.Invoices.send(client, "01964a3b-7c8d-7000-8000-deadbeef1234")require "manza"
client = Manza::Client.new # reads MANZA_API_KEY
invoice = client.invoices.send("01964a3b-7c8d-7000-8000-deadbeef1234")use Manza\Client;
$client = new Client(apiKey: getenv('MANZA_API_KEY'));
$invoice = $client->invoices->send('01964a3b-7c8d-7000-8000-deadbeef1234');Mark as paid#
POST /api/invoices/:id/mark_as_paid
Transitions the invoice to paid and sets paid_at. Available from approved, sent or overdue: an invoice does not have to be sent before it is paid, so sent_at can be null on a paid invoice. A credit note is never paid: the call answers 422 with a state_error.
curl -X POST "https://ma.manza.dev/api/invoices/01964a3b-7c8d-7000-8000-deadbeef1234/mark_as_paid" \
-H "Authorization: Bearer sk_live_..."manza invoices mark-as-paid 01964a3b-7c8d-7000-8000-deadbeef1234import { Manza } from "@getmanza/sdk";
const manza = new Manza({ apiKey: process.env.MANZA_API_KEY });
await manza.invoices.markAsPaid("01964a3b-7c8d-7000-8000-deadbeef1234");require "manza"
manza = Manza.new(api_key: ENV["MANZA_API_KEY"])
manza.invoices.mark_as_paid("01964a3b-7c8d-7000-8000-deadbeef1234")from manza import Manza
client = Manza() # reads MANZA_API_KEY
client.invoices.mark_as_paid("01964a3b-7c8d-7000-8000-deadbeef1234")import manza "github.com/getmanza/manza-go/v2"
client, _ := manza.New(manza.WithAPIKey(os.Getenv("MANZA_API_KEY")))
invoice, err := client.Invoices.MarkAsPaid(ctx, "01964a3b-7c8d-7000-8000-deadbeef1234")let client = manza::Client::builder()
.api_key(std::env::var("MANZA_API_KEY")?)
.build()?;
let invoice = client.invoices().mark_as_paid("01964a3b-7c8d-7000-8000-deadbeef1234")?;{:ok, client} = Manza.new(api_key: System.fetch_env!("MANZA_API_KEY"))
{:ok, invoice} = Manza.Invoices.mark_as_paid(client, "01964a3b-7c8d-7000-8000-deadbeef1234")require "manza"
client = Manza::Client.new # reads MANZA_API_KEY
invoice = client.invoices.mark_as_paid("01964a3b-7c8d-7000-8000-deadbeef1234")use Manza\Client;
$client = new Client(apiKey: getenv('MANZA_API_KEY'));
$invoice = $client->invoices->markAsPaid('01964a3b-7c8d-7000-8000-deadbeef1234');Cancel invoice#
POST /api/invoices/:id/cancel
Cancels the invoice and its associated payment link (if any). Only available from approved, sent or overdue; the invoice keeps its number. A credit note is cancelled the same way, from approved or sent. Its invoice cannot take a second credit note afterwards.
curl -X POST "https://ma.manza.dev/api/invoices/01964a3b-7c8d-7000-8000-deadbeef1234/cancel" \
-H "Authorization: Bearer sk_live_..."manza invoices cancel 01964a3b-7c8d-7000-8000-deadbeef1234import { Manza } from "@getmanza/sdk";
const manza = new Manza({ apiKey: process.env.MANZA_API_KEY });
await manza.invoices.cancel("01964a3b-7c8d-7000-8000-deadbeef1234");require "manza"
manza = Manza.new(api_key: ENV["MANZA_API_KEY"])
manza.invoices.cancel("01964a3b-7c8d-7000-8000-deadbeef1234")from manza import Manza
client = Manza() # reads MANZA_API_KEY
client.invoices.cancel("01964a3b-7c8d-7000-8000-deadbeef1234")import manza "github.com/getmanza/manza-go/v2"
client, _ := manza.New(manza.WithAPIKey(os.Getenv("MANZA_API_KEY")))
invoice, err := client.Invoices.Cancel(ctx, "01964a3b-7c8d-7000-8000-deadbeef1234")let client = manza::Client::builder()
.api_key(std::env::var("MANZA_API_KEY")?)
.build()?;
let invoice = client.invoices().cancel("01964a3b-7c8d-7000-8000-deadbeef1234")?;{:ok, client} = Manza.new(api_key: System.fetch_env!("MANZA_API_KEY"))
{:ok, invoice} = Manza.Invoices.cancel(client, "01964a3b-7c8d-7000-8000-deadbeef1234")require "manza"
client = Manza::Client.new # reads MANZA_API_KEY
invoice = client.invoices.cancel("01964a3b-7c8d-7000-8000-deadbeef1234")use Manza\Client;
$client = new Client(apiKey: getenv('MANZA_API_KEY'));
$invoice = $client->invoices->cancel('01964a3b-7c8d-7000-8000-deadbeef1234');Create credit note#
POST /api/invoices/:id/credit_note
Creates a full credit note against a paid invoice: a new invoice with negated line items, starting in pending_approval. Requires the invoices:write scope and responds 201 Created with the credit note.
A credit note asks nobody to pay. Its due_date is null, and its status is one of draft, pending_approval, declined, approved, sent and cancelled: it never becomes overdue or paid.
curl -X POST "https://ma.manza.dev/api/invoices/01964a3b-7c8d-7000-8000-deadbeef1234/credit_note" \
-H "Authorization: Bearer sk_live_..."manza invoices credit-note 01964a3b-7c8d-7000-8000-deadbeef1234import { Manza } from "@getmanza/sdk";
const manza = new Manza({ apiKey: process.env.MANZA_API_KEY });
await manza.invoices.creditNote("01964a3b-7c8d-7000-8000-deadbeef1234");require "manza"
manza = Manza.new(api_key: ENV["MANZA_API_KEY"])
manza.invoices.credit_note("01964a3b-7c8d-7000-8000-deadbeef1234")from manza import Manza
client = Manza() # reads MANZA_API_KEY
client.invoices.credit_note("01964a3b-7c8d-7000-8000-deadbeef1234")import manza "github.com/getmanza/manza-go/v2"
client, _ := manza.New(manza.WithAPIKey(os.Getenv("MANZA_API_KEY")))
creditNote, err := client.Invoices.CreditNote(ctx, "01964a3b-7c8d-7000-8000-deadbeef1234")let client = manza::Client::builder()
.api_key(std::env::var("MANZA_API_KEY")?)
.build()?;
let credit_note = client.invoices().credit_note("01964a3b-7c8d-7000-8000-deadbeef1234")?;{:ok, client} = Manza.new(api_key: System.fetch_env!("MANZA_API_KEY"))
{:ok, credit_note} = Manza.Invoices.credit_note(client, "01964a3b-7c8d-7000-8000-deadbeef1234")require "manza"
client = Manza::Client.new # reads MANZA_API_KEY
credit_note = client.invoices.credit_note("01964a3b-7c8d-7000-8000-deadbeef1234")use Manza\Client;
$client = new Client(apiKey: getenv('MANZA_API_KEY'));
$creditNote = $client->invoices->creditNote('01964a3b-7c8d-7000-8000-deadbeef1234');| Scenario | Status | Type |
|---|---|---|
| Invoice is not in paid status | 422 | state_error |
| A credit note already exists for this invoice | 409 | conflict |
Delete invoice#
DELETE /api/invoices/:id
Only invoices in draft, pending_approval or declined status, before they have a number, can be deleted. Responds 204 No Content.
curl -X DELETE "https://ma.manza.dev/api/invoices/01964a3b-7c8d-7000-8000-deadbeef1234" \
-H "Authorization: Bearer sk_live_..."manza invoices delete 01964a3b-7c8d-7000-8000-deadbeef1234import { Manza } from "@getmanza/sdk";
const manza = new Manza({ apiKey: process.env.MANZA_API_KEY });
await manza.invoices.delete("01964a3b-7c8d-7000-8000-deadbeef1234");require "manza"
manza = Manza.new(api_key: ENV["MANZA_API_KEY"])
manza.invoices.delete("01964a3b-7c8d-7000-8000-deadbeef1234")from manza import Manza
client = Manza() # reads MANZA_API_KEY
client.invoices.delete("01964a3b-7c8d-7000-8000-deadbeef1234")import manza "github.com/getmanza/manza-go/v2"
client, _ := manza.New(manza.WithAPIKey(os.Getenv("MANZA_API_KEY")))
_, err := client.Invoices.Delete(ctx, "01964a3b-7c8d-7000-8000-deadbeef1234")let client = manza::Client::builder()
.api_key(std::env::var("MANZA_API_KEY")?)
.build()?;
client.invoices().delete("01964a3b-7c8d-7000-8000-deadbeef1234")?;{:ok, client} = Manza.new(api_key: System.fetch_env!("MANZA_API_KEY"))
{:ok, _} = Manza.Invoices.delete(client, "01964a3b-7c8d-7000-8000-deadbeef1234")require "manza"
client = Manza::Client.new # reads MANZA_API_KEY
client.invoices.delete("01964a3b-7c8d-7000-8000-deadbeef1234")use Manza\Client;
$client = new Client(apiKey: getenv('MANZA_API_KEY'));
$client->invoices->delete('01964a3b-7c8d-7000-8000-deadbeef1234');Status transitions#
API-created invoices land in pending_approval and require a member to approve via the dashboard before they can be sent; the approval gives the invoice its number. The request_approval and approve transitions are not exposed in the API by design. An approver who declines an invoice moves it to declined; a member then edits it and requests approval again in the dashboard, or it is deleted. With the invoices:auto_approve scope, creates skip both and land directly on sent, or on approved when the invoice has no send_to_email.
Web UI only (no API endpoint):
draft → request_approval → pending_approval
pending_approval → approve → approved (number given here)
pending_approval → decline → declined
declined → request_approval → pending_approval
API + Web UI:
approved → cancel → cancelled
approved → send → sent (needs a send_to_email)
approved → mark_as_paid → paid
approved → (automatic, past due_date) → overdue
sent → mark_as_paid → paid
sent → cancel → cancelled
sent → (automatic, past due_date) → overdue
overdue → send → overdue (only while sent_at is null)
overdue → mark_as_paid → paid
overdue → cancel → cancelled
draft, pending_approval, declined → (delete)
paid → credit_note → (new invoice: starts in pending_approval)
A credit note is never marked as paid and never becomes overdue.
With invoices:auto_approve on the key:
create / credit_note → (automatic) → sent, or approved with no send_to_emailInvalid transitions return a state_error:
{
"error": {
"type": "state_error",
"message": "Invoice cannot be sent from 'paid' status"
}
}