Onboard Entity
Onboard a Device
POST
/
onboardings
Onboard a Device
curl --request POST \
--url https://api.einvoice.sa.com:9090/v1/e-invoicing/onboardings \
--header 'Content-Type: application/json' \
--data '
{
"otp": "<string>",
"vat_number": "<string>",
"device_id": "<string>",
"invoice_type": "<string>",
"org_name": "<string>",
"org_unit": "<string>",
"business_category": "<string>",
"registered_address": "<string>",
"country_code": "<string>",
"email_id": "<string>"
}
'import requests
url = "https://api.einvoice.sa.com:9090/v1/e-invoicing/onboardings"
payload = {
"otp": "<string>",
"vat_number": "<string>",
"device_id": "<string>",
"invoice_type": "<string>",
"org_name": "<string>",
"org_unit": "<string>",
"business_category": "<string>",
"registered_address": "<string>",
"country_code": "<string>",
"email_id": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
otp: '<string>',
vat_number: '<string>',
device_id: '<string>',
invoice_type: '<string>',
org_name: '<string>',
org_unit: '<string>',
business_category: '<string>',
registered_address: '<string>',
country_code: '<string>',
email_id: '<string>'
})
};
fetch('https://api.einvoice.sa.com:9090/v1/e-invoicing/onboardings', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "9090",
CURLOPT_URL => "https://api.einvoice.sa.com:9090/v1/e-invoicing/onboardings",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'otp' => '<string>',
'vat_number' => '<string>',
'device_id' => '<string>',
'invoice_type' => '<string>',
'org_name' => '<string>',
'org_unit' => '<string>',
'business_category' => '<string>',
'registered_address' => '<string>',
'country_code' => '<string>',
'email_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.einvoice.sa.com:9090/v1/e-invoicing/onboardings"
payload := strings.NewReader("{\n \"otp\": \"<string>\",\n \"vat_number\": \"<string>\",\n \"device_id\": \"<string>\",\n \"invoice_type\": \"<string>\",\n \"org_name\": \"<string>\",\n \"org_unit\": \"<string>\",\n \"business_category\": \"<string>\",\n \"registered_address\": \"<string>\",\n \"country_code\": \"<string>\",\n \"email_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.einvoice.sa.com:9090/v1/e-invoicing/onboardings")
.header("Content-Type", "application/json")
.body("{\n \"otp\": \"<string>\",\n \"vat_number\": \"<string>\",\n \"device_id\": \"<string>\",\n \"invoice_type\": \"<string>\",\n \"org_name\": \"<string>\",\n \"org_unit\": \"<string>\",\n \"business_category\": \"<string>\",\n \"registered_address\": \"<string>\",\n \"country_code\": \"<string>\",\n \"email_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.einvoice.sa.com:9090/v1/e-invoicing/onboardings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"otp\": \"<string>\",\n \"vat_number\": \"<string>\",\n \"device_id\": \"<string>\",\n \"invoice_type\": \"<string>\",\n \"org_name\": \"<string>\",\n \"org_unit\": \"<string>\",\n \"business_category\": \"<string>\",\n \"registered_address\": \"<string>\",\n \"country_code\": \"<string>\",\n \"email_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyWhat it does
Registers a new device/organization for e-invoicing before you can clear or report any documents. This is required once per device before you can call any invoice, credit note, or debit note endpoint.Authentication
Requires a valid token from Authenticate.Request Body
string
required
One-time password sent for verification
string
required
Your organization’s 15-digit VAT number
string
required
Unique identifier you choose for this device
string
required
standard, simplified, or both — see note belowstring
required
Legal business name
string
required
Branch or unit name (e.g. city/location)
string
required
Industry category, e.g.
IT, Retailstring
required
Registered business address
string
required
ISO country code, e.g.
SAstring
required
Contact email for this onboarding
Choosing
invoice_type:standard— for B2B invoices requiring real-time clearancesimplified— for B2C invoices, reported (not cleared) within 24 hoursboth— device can issue either type
Example Request
curl -X POST https://api.einvoice.sa.com:9090/v1/e-invoicing/onboardings \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"otp": "464316",
"vat_number": "311262046600003",
"device_id": "SIMAHUATONBOARDTESTING",
"invoice_type": "both",
"org_name": "Goagile Technologies",
"org_unit": "Riyadh",
"business_category": "IT",
"registered_address": "Al-Morabba",
"country_code": "SA",
"email_id": "support@goagile.com"
}'
Example Response
{
"onboard_id": "NjU5YTcyYTI2NGE4MmI5ZjNmMDY2NjY5OjMxMTI2MjA0NjYwMDAwMzpEZXZpY2VJZC0wMDE=",
"status": "success"
}
Save the
onboard_id returned here — every invoice, credit note, and debit note endpoint requires it in the URL path.Where to get the OTP
Errors
| Code | Meaning |
|---|---|
| 400 | Invalid or expired OTP |
| 409 | Device already onboarded |
| 401 | Missing or invalid auth token |
Was this page helpful?
⌘I
Onboard a Device
curl --request POST \
--url https://api.einvoice.sa.com:9090/v1/e-invoicing/onboardings \
--header 'Content-Type: application/json' \
--data '
{
"otp": "<string>",
"vat_number": "<string>",
"device_id": "<string>",
"invoice_type": "<string>",
"org_name": "<string>",
"org_unit": "<string>",
"business_category": "<string>",
"registered_address": "<string>",
"country_code": "<string>",
"email_id": "<string>"
}
'import requests
url = "https://api.einvoice.sa.com:9090/v1/e-invoicing/onboardings"
payload = {
"otp": "<string>",
"vat_number": "<string>",
"device_id": "<string>",
"invoice_type": "<string>",
"org_name": "<string>",
"org_unit": "<string>",
"business_category": "<string>",
"registered_address": "<string>",
"country_code": "<string>",
"email_id": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
otp: '<string>',
vat_number: '<string>',
device_id: '<string>',
invoice_type: '<string>',
org_name: '<string>',
org_unit: '<string>',
business_category: '<string>',
registered_address: '<string>',
country_code: '<string>',
email_id: '<string>'
})
};
fetch('https://api.einvoice.sa.com:9090/v1/e-invoicing/onboardings', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "9090",
CURLOPT_URL => "https://api.einvoice.sa.com:9090/v1/e-invoicing/onboardings",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'otp' => '<string>',
'vat_number' => '<string>',
'device_id' => '<string>',
'invoice_type' => '<string>',
'org_name' => '<string>',
'org_unit' => '<string>',
'business_category' => '<string>',
'registered_address' => '<string>',
'country_code' => '<string>',
'email_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.einvoice.sa.com:9090/v1/e-invoicing/onboardings"
payload := strings.NewReader("{\n \"otp\": \"<string>\",\n \"vat_number\": \"<string>\",\n \"device_id\": \"<string>\",\n \"invoice_type\": \"<string>\",\n \"org_name\": \"<string>\",\n \"org_unit\": \"<string>\",\n \"business_category\": \"<string>\",\n \"registered_address\": \"<string>\",\n \"country_code\": \"<string>\",\n \"email_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.einvoice.sa.com:9090/v1/e-invoicing/onboardings")
.header("Content-Type", "application/json")
.body("{\n \"otp\": \"<string>\",\n \"vat_number\": \"<string>\",\n \"device_id\": \"<string>\",\n \"invoice_type\": \"<string>\",\n \"org_name\": \"<string>\",\n \"org_unit\": \"<string>\",\n \"business_category\": \"<string>\",\n \"registered_address\": \"<string>\",\n \"country_code\": \"<string>\",\n \"email_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.einvoice.sa.com:9090/v1/e-invoicing/onboardings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"otp\": \"<string>\",\n \"vat_number\": \"<string>\",\n \"device_id\": \"<string>\",\n \"invoice_type\": \"<string>\",\n \"org_name\": \"<string>\",\n \"org_unit\": \"<string>\",\n \"business_category\": \"<string>\",\n \"registered_address\": \"<string>\",\n \"country_code\": \"<string>\",\n \"email_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body
