Register Device

Generates Device ID in ClearTax and generates the CSID and PCSID from ZATCA.

Request Method

POST

Request URL

{{BASE_URL}}/onboarding/register-device

Replace the {{BASE_URL}} with the one mentioned here based on whether you are using sandbox or production.

Request Headers

ParameterData TypeField ValidationsDescription

x-cleartax-auth-token

String

Cannot be empty.

Mandatory. User auth token.

vat

String

Cannot be empty

Mandatory. VAT or Group VAT of the entity.

Request Path Params

There are no path parameters for this API.

Request Query Params

There are no query parameters for this API.

Request Body

ParameterData TypeField ValidationsDescription

DeviceDetails

Object

NA

Mandatory. Device Details Object

OrganizationDetails

Object

NA

Mandatory. Organization Details Object.

Otp

String

Should be a valid OTP.

Mandatory. The one time password generated by the user on the ZATCA. OTP once generated is valid only for 1 hour.

Device Details Object

ParameterData TypeField ValidationsDescription

CommonName

String

Cannot be empty.

Mandatory. Name or Asset Tracking Number used by the taxpayer for the Solution Unit being onboarded.

EgsSerialNumber

String

RegEx: ^1-(?<manufacturer>[a-zA-Z0-9]+)[|]2-(?<model>[a-zA-Z0-9]+)[|]3-(?<serial>[a-zA-Z0-9]+)$

Mandatory. Manufacturer or Solution Provider Name, Model or Version and Serial Number.

Location

String

Cannot be empty.

Mandatory. The address of the Branch or location where the device or solution unit is primarily situated

Industry

String

Cannot be empty.

Mandatory. Industry or sector for which the device or solution will generate invoices.

InvoiceType

String

RegEx: ^(?!0{4})[01]{2}[00]{2}$

Optional. The document type that the Taxpayer’s solution unit will be issuing/generating in “TSXY” format where:

T = Standard Tax Invoice, S = Simplified Tax Invoice, X = Reserved placeholders, Y = Reserved placeholders.

The input for each place above should be using the digits 0 & 1 where: 0 = False/Not supported, 1= True/Supported

(X) and (Y) are for future use and should be set to 0 by default for the time being.

For example: 1000 would mean Solution will be generating Standard Invoices only. 0100 would mean Solution will be generating Simplified invoices only. and 1100 means Solution will be generating both Standard and Simplified invoices.

Default: 1100.

Organization Details Object

ParameterData TypeField ValidationsDescription

Vat

String

15 digits, starting and ending with 3

Mandatory. VAT or Group VAT Registration Number.

OrganizationName

String

Cannot be empty

Mandatory. Taxpayer/Organization Name.

OrganizationUnitName

String

If 11th digit of Vat is not = 1 then free text.

If 11th digit of Vat = 1 then needs to be a 10 digit number.

Mandatory. If Vat is NOT Group Vat, then the branch name of the taxpayer.

If Vat is a Group VAT ID, then the 10-digit TIN of the individual group member.

CountryCode

String

2 letter country code (ISO 3166 Alpha-2)

Mandatory. Country Code.

Sample Request

{
    "DeviceDetails": {
        "CommonName": "116.197.153.161",
        "EgsSerialNumber": "egs013",
        "Location": "loc",
        "Industry": "industry",
        "InvoiceType": "1100"
    },
    "OrganizationDetails": {
        "Vat": "454345233",
        "OrganizationName": "BMA",
        "OrganizationUnitName": "Jeddah Branch 1234",
        "CountryCode": "SA"
    },
    "Otp": "123345"
}

Response Status Codes

HTTP Status CodeDescription

200

For a successful CSR/DeviceId generation.

400

For any kind of validation issues.

401

If the user is not authenticated for the operation.

403

If the user is not authorized for the operation.

Response Schema

ParameterData TypeField ValidationsDescription

Status

String

Enum:

GENERATED,

FAILED

Mandatory. Status of CSID Generation.

GENERATED: CSID was generated successful. FAILED: CSID failed to generate (had validation errors).

DeviceId

String

NA

Mandatory. The Device ID that was generated in ClearTax.

PcsidGenerationActivityId

String

NA

Optional. The ID of the async activity that will be generating the PCSID in the background. Compliance checks will happen in the background.

Save this ID to poll status in the “Get PCSID Generation Status API”.

ErrorList

Array

NA

Optional. Array of Error Details objects.

Sample Response

Success - HTTP Status Code - 200

{
    "Status": "GENERATED",
    "DeviceId": "bcc98fdf-0867-4122-b530-e538a2f9e9c4",
    "PcsidGenerationActivityId": "628f37b61ed71a6638b848e4",
    "ErrorList": []
}

Success - Idempotent response - HTTP Status Code - 200

{
    "Status": "GENERATED",
    "DeviceId": "6491cefa-f39e-46ab-a609-efa37b723bde",
    "ErrorList": [
        {
            "ErrorCode": "6002",
            "ErrorMessage": "A Device ID already exist with same VAT and EGS serial number",
            "ErrorSource": "CLEARTAX"
        }
    ]
}

Error - HTTP Status Code - 400

{
    "Status": "FAILED",
    "DeviceId": null,
    "ErrorList": [
        {
            "ErrorCode": "6002",
            "ErrorMessage": "Invalid country code",
            "ErrorSource": "CLEARTAX",
            "Path": "OrganizationDetails.CountryCode"
        },
        {
            "ErrorCode": "6002",
            "ErrorMessage": "Invalid country code length, please provide a valid country code",
            "ErrorSource": "CLEARTAX",
            "Path": "OrganizationDetails.CountryCode"
        }
    ]
}

API Validations

  1. The VAT for which the device is being registered needs to be already present in ClearTax before making this API request.

  2. There can be only one CSR against the Vat and EgsSerialNumber combination. In case of a duplicate request for CSR generation for the same Vat and EgsSerialNumber, the API will return the existing DeviceId along with Error Details. Such an error message may be treated as a warning message.

API Constraints

  1. This API needs to be authenticated with a valid user authentication token. If the auth token is not present or is invalid, the API will return HTTP Status Code 401.

  2. If the auth token is valid, but the user does not have the authorization to generate device ID, then the API will return HTTP Status Code 403. The user, whose auth token is used, should have an Admin role for the particular VAT used in the request.

Last updated