Quickstart: Send you first e-invoice
Invoicing / E-invoicing API
This API is suitable for all countries that don't implement e-invoicing, and for phase 1 of Saudi Arabia's e-invoicing regulation.
For Saudi Arabia phase 2 API, head over to our Saudi Arabia e-invoicing Phase 2 API docs.
Sending an Invoice by Email
This guide provides a sample curl request for sending your first invoice via email. Before running this request, you need to retrieve some field values.
curl --location \
--request POST 'https://api.wafeq.com/v1/api-invoices/bulk_send/' \
--header 'Authorization: Api-Key <api_key>' \
--header 'Content-Type: application/json' \
--data-raw '[
{
"reference": "REF",
"invoice_number": "TEST-INV-1234",
"invoice_date": "2021-01-01",
"currency": "SAR",
"paid_through_account": "<paid_through_account_id>",
"language": "en",
"tax_amount_type": "TAX_INCLUSIVE",
"contact": {
"name": "Ahmed A.",
"address": "Ahmed A. Building, first floor, Riyadh, Saudi Arabia",
"email": "[email protected]"
},
"channels": [
{
"medium": "email",
"data": {
"subject": "Invoice X from the Company of Abdullah S. Trading",
"message": "<p>Please find attached your invoice.</p>",
"recipients": {
"to": ["[email protected]"],
"cc": [],
"bcc": []
}
}
}
],
"line_items": [
{
"name": "Item 1",
"description": "Item description 1",
"account": "<account_id>",
"quantity": 2,
"price": 40,
"tax_rate": "<tax_rate_id>"
},
{
"name": "Item 2",
"description": "Item description 2",
"account": "<account_id>",
"quantity": 3,
"price": 20,
"tax_rate": "<tax_rate_id>"
}
]
}
]'
API Key
The API Key can be found on the Wafeq app. You can follow the steps provided at Get your API Key.
Paid through account
The paid_through_account
field is the account where you received the money. It's usually a bank account or a payment gateway account. You can add bank accounts in your Wafeq organization under the Bank Transactions section.
You can retrieve the list of available accounts using the List accounts API and setting the is_payment_enabled
filter to true
.
Line item account
The line item account
field is where you'd like your revenue to be categorized in your Profit and Loss statement. For example, you'd typically categorize it to your Sales
account.
You can retrieve the list of available accounts using the List accounts API.
Line item tax rate
The line item tax_rate
field is the tax rate that needs to be applied.
You can retrieve the list of available tax rates using the List tax rates API.
Response
A successful request will queue the invoice to be sent and will return the following response:
{
"queued": 1
}
Invoice PDF
A PDF of the invoice will be attached to the email. Below is a sample Invoice PDF.
Updated 5 days ago