For this example to work properly you must perform the following steps:
1. Complete the Registration to the Sandbox process and create an App there.
Note: you can use an existing app. Either change the Redirect URI to http://demo.open-api.co.il/OpenAPI or get an Authorization Code idependently and "Set" it in step 3.
2. Set the key, secret, etc. here:
3. Get an Authorization Code:
Url =
Authorization Code =
State (received from Tax Authority) =
Or if you have your own App in the Sandbox, then use it to get the Authorization Code and set it manually:
TokenResponse =
Refresh Token = Expires at =
Once you received the Token the Authorization Code is invalidated. If you want to test again then you need to get a new Authorization Code. Go back to step 3.
5. Get an Invoice Allocation Number (מספר הקצאה):
Invoice Allocation Number Response =
Invoice Allocation Number =
How to check your Invoice JSON?
Note: when you try to get an "Allocation Number" you may receive criptic validation errors such as:
Validate: temporary:///swagger/shaam_tsandbox_invoices_v1.json:396: [JSV0008] Invalid number: 0 must be greater than or equal to 1."
You can validate your JSON using https://www.jsonschemavalidator.net/.
Here is the schema file. Download it and copy the schema to the validator.
6. Refresh the Access Token
The Access Token is valid only for 10 minutues. Once it expires you can aquire a new Authorization Code and a new Acces Token.
But if your login into the Persnal Area (איזור אישי) expired you will need to login again. This may affect performance and usability.
Alternatively you can aquire a new Access Token via the Refresh Token.
Refresh Token Response =