"Invalid token" API call

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

  1. How and where to get other ones???
    X-Api-Secret
    X-Requested-With

  2. 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!

Hi,

The correct header is X-API-Token

You can use the browser console to inspect the API calls the admin portal makes.

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???

Now I’ve figured out whats was the issue:

  1. incorrect base url used, had to use : https://invoicing.co/api
  2. headers parameters
    x-requested-with
    x-api-token
    x-api-secret

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:

  1. open admin portal: Invoice Ninja
  2. open chrome dev tools /network tab
  3. 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.