Self Hosted API URL issues connecting Zapier

Hi All, I am using Invoice Ninja v4.5.19 self-hosted on Ubuntu 16.04 and Nginx. I am trying to set up a ZAP so our cart system can automatically create an invoice. Some of our customers request a branded invoice and our cart system doesn’t do that well.

I am trying to do a Zapier integration and cannot get past the URL verification. The API key is created, but I have tried every permutation of the URL I can find and I always get the same response.

There is no /api/v1 directory, so I read elsewhere on this forum to use No luck. This is what I get every time:

We hit an error adding your new account

authentication failed: Got 404 calling GET, expected 2xx.

  1. Make sure you click “Allow” or “Accept” on the permission popup
  2. Double check your Account has the correct permissions
  3. Check out our [help]for more information

The suggested solutions do not make any sense at all. /public permissions are all 644 and the owner is www-data. I am at a total loss.

Does anyone have an idea of what to try? Thanks!


‘api/v1’ (like most routes in the app) is virtual, you won’t see matching files/folders.

You may not need to add ‘/public’ to the URL, you need to add api/v1 to your base app URL.

Thanks, I has seen the virtual routes in there and suspected this.

I forgot to add when I do it with /api/v1 - I get this:

authentication failed: Got 500 calling GET, expected 2xx.

Now if I enter in the address bar in the browser, I get “success”, presumably with a 200 response.

So, still no success and I have spent most of the day on it.

If you see a 500 error there will be more details in storage/logs/laravel-error.log

Ok, I see this, but I have no idea what email it is trying to get.:

[2021-01-05 22:55:02] production.ERROR: ErrorException [0] : /var/www/invoice-ninja/app/Http/Controllers/AccountApiController.php [Line 43] => Trying to get property ‘email’ of non-object {“context”:“PHP”,“user_id”:0,“account_id”:0,“user_name”:"",“method”:“GET”,“user_agent”:“Zapier”,“locale”:“en”,“ip”:“”,“count”:1,“is_console”:“no”,“is_api”:“no”,“db_server”:“mysql”,“url”:“api/v1/ping”} []

The line this refers to is…

public function ping(Request $request)
    $headers = Utils::getApiHeaders();

    // Legacy support for Zapier
    if (request()->v2) {
       return $this->response(auth()->user()->email);     <<----
    } else {
        return Response::make(RESULT_SUCCESS, 200, $headers);

I think you’d see that error if you call the route without including a valid token

Ok, got it. The way the wizard is worded, it sounded like it wanted the token name, not the token. I tried the token and it works fine now.

Thank you for your help!!