Double-check the endpoint and headers, to ensure they are correct and match the API specifications, review the error details in the response body for more guidance on what might be causing the “Bad Request” error.
If you are still facing issues, please don’t hesitate to reach out with our support team via email:
thanks for your clear instructions to @charbelsarkis123, I was looking for same, but I have one question about below point, that we need to add space or any character between BinarySecurityToken and Secret or its will be continues BinarySecurityToken + Secret
The response will include the BinarySecurityToken and Secret, you will use those as Authentication in the compliance checks. Moreover, the response will include request_ID which will be used in the body for generating PCSID API in a later step.
Please note that in the authorization, you will choose Basic Auth, the BinarySecurityToken will be the user name without any spaces, and the Secret will be the password without any spaces.
Dear @idaoud,
Thanks for prompt reply, in Simulation Environment, when I need to send request thru API (.net) so, I will use the JSON file, in JSON file Header i will send as follow :-
Authorization: Basic BinarySecurityToken + Secret (without any space or chracter) ?
Based on what you mentioned it seems that you have misunderstanding of what the value in the header should be right? If yes, please answer these questions
1- What is the endpoint that you want to use?
2-you mentioned Heder, and the value of it is the Authorization!
Please note that there are no APIs from ZATCA side that use the Authorization in the header.
However, please follow the steps below to ensure a successfully onboarding in simulation environment and generate your PCSID:
Our recommendation is:
Access Fatoora portal and log in using your tin number.
Use Simulation Enviromint before production, from simulation portal start using the APIs as their order.
Generate the OTP from simulation portal.
Use the CSR in the body of the request using the below endpoint to send the request for generating the CCSID (Use the OTP in the Headers of the request):
For the simulation environment use this API URL: https://gw-fatoora.zatca.gov.sa/e-invoicing/simulation/compliance
The response will include the BinarySecurityToken and Secret, you will use those as Authentication in the compliance checks. Moreover, the response will include request_ID which will be used in the body for generating PCSID API in a later step.
You need to start the compliance check, In order to complete the compliance check you need to prepare your invoices. Please note that this is based on the invoice type in your configuration file if it’s 0100 that’s mean you will only send a simplified invoice, if it’s 1000 only for standard invoices and if it is 1100 you will send both standard and simplified.
For standard invoices:
1.use fatooranet generatehash -invoice “invoicebath” command to generate the hash
2.generate the JSON file for the invoice using fatooranet invoiceRequest -invoice “invoicebath” command
For simplified invoices:
1.make sure to change the SDK\Data\Certificates\cert.pem with the decoded CCSID
2.sign the invoice using fatooranet sign -invoice “invoicebath” command
3.generate the JSON file for the signed invoice using fatooranet invoiceRequest -invoice “invoicebath” command
After you prepared your invoices, you need to send the encoded invoices (JSON file) to the the following API:
For compliance checks in the Simulation Environment, use this API URL https://gw-fatoora.zatca.gov.sa/e-invoicing/simulation/compliance/invoices
10.In order to generate the PCSID, take the “Request ID” you got from the CCSID response (on step 5 above) and replace it in the body of the request.
11.Make sure to send an invoice, credit note, and debit note to the compliance check, to avoid “Missing Compliance Steps”
If you have any concerns regarding the onboarding process after reviewing the Educational library (zatca.gov.sa), please don’t hesitate to reach out with our support team via email: