Scalable, ZATCA-compliant e-invoicing API

Issue e-invoices in Arabic and English at scale. Get ready for Phase 2 of e-invoicing.

curl
javascript
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 '<invoice_data>'

Getting started

Issue ZATCA-compliant e-invoices at scale. Send your first invoice for free in a couple of minutes.

Get your API Key

Sign up to Wafeq and get your API key.

Send your first invoice

Send an e-invoice by email.

API reference

All the details you need to know.

Read our FAQ

Some common questions and answers.


Quick start

  1. Get your API key from your Wafeq Developer Console.
  2. Send an invoice by pasting the below code in your terminal. Make sure to replace <api_key> with your API key and <to_email> with your email.

Request

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": "test",
		"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": "ahmed@example.com"
		},
		"channels": [
			{
				"medium": "email",
				"data": {
					"subject": "Invoice X from the Company of Abdullah S. Trading",
					"message": "<p>Please find attached your invoice.</p>",
					"recipients": {
						"to": [
							"<to_email>"
						],
						"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>"
			}
		]
	}
]'

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 ids from the Accounts endpoint:

Request

curl --location \
    --request GET 'https://api.wafeq.com/v1/accounts/?is_payment_enabled=true' \
    --header 'Authorization: Api-Key <api_key>' \
    --header 'Content-Type: application/json'

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 id from the Accounts endpoint:

Request

curl --location \
    --request GET 'https://api.wafeq.com/v1/accounts/?classification=REVENUE' \
    --header 'Authorization: Api-Key <api_key>' \
    --header 'Content-Type: application/json'

Response

A successful request will queue the invoice to be sent and will return the following response:

{
  "queued": 1
}

e-Invoices are not sent to ZATCA in Phase 1

ZATCA has currently implemented only Phase 1 of the e-invoicing law, which means invoices are not sent to ZATCA during this phase. Wafeq will be integrated with ZATCA in phase 2, which is expected to launch in waves in 2023. Reach out to our support if you're part of the early waves so we can assist.

Invoice PDF

A PDF of the invoice will be attached to the email. Click to see an invoice PDF sample.