akushyn
December 12, 2021, 4:34pm
1
Hi,
I would like to use API in the project I am working on.
But I’ve faced with the issue that any api call require 3 header parameters:
X-Api-Secret
X-Api-Token
X-Requested-With
token I get from the application /advanced settings API tokens / create token
How and where to get other ones???
X-Api-Secret
X-Requested-With
What is the base API url to make api call for web, I’ve used: https://app.invoiceninja.com/api
I’ve tried different values to use and any api call returns invalid token response:
{
"error": {
"message": "Invalid token"
}
}
Thank you in advance!
hillel
December 12, 2021, 5:05pm
2
Hi,
The correct header is X-API-Token
You can use the browser console to inspect the API calls the admin portal makes.
akushyn
December 13, 2021, 3:23pm
3
Thank you for the answer!
I’ve corrected the header name, but still get the same response Invalid token
For me not clear, where to get other required parameters and why token is invalid???
akushyn
December 13, 2021, 3:32pm
4
Now I’ve figured out whats was the issue:
incorrect base url used, had to use : https://invoicing.co/api
headers parameters
x-requested-with
x-api-token
x-api-secret
1 Like
zluri
January 3, 2022, 12:54pm
5
Hey i also am trying to use api, could you tell me where and how did you get X-Api-Secret and X-Requested-With
I get token value from the admin portal:
open admin portal: Invoice Ninja
open chrome dev tools /network tab
make any request and see what token is used in headers for key: x-api-token
Use empty string for the x-api-secret
Use XMLHttpRequest for the x-requested-with header
Hope it helps.
Maybe a screenshot ? I could figure out yet. Only login works.