Transfer company ownership

Hi folks,

First of all, thanks for your great work.

I am wondering if it’s possible to transfer the ownership of a company.
My cousin wants to use it but I don’t feel comfortable being able to see his invoices. I tried to delete my account from his company using his account but it says I can’t delete the owner. Also, I am not able to create companies using his account even though I have set him as an Admin.

If it’s not possible I am probably going to ask him to create his own account on or deploy it on his server as I did.


One option would be to setup a separate selfhost install of the and then use the JSON import/export to transfer the company.

@hillel thank you! Gonna deploy a new instance to him then.

One thing I noticed, if I have a user assigned to a company and remove them from the company. The application will ask the removed user to login again but once I try to login I will get a 500 error.

Checked into the logs and found the error below:

[2022-05-02 03:47:02] production.ERROR: Attempt to read property "is_owner" on null {"userId":5,"exception":"[object] (ErrorException(code: 0): Attempt to read property \"is_owner\" on null at (...)/app/Models/User.php:319)

Also, one last question, what’s te difference between “remove” and “delete” a user?

Thanks =D

@david any thoughts on the error?

I believe deleting a user deletes them from all companies whereas removing only removes them from that specific company.

@hillel I think when the user tries to login again, it will try to load the data from the company they were using for the last time. Since they don’t have access to the company anymore, the company will be null which will then throw that error.


public function isOwner() : bool
    return $this->token()->cu->is_owner;


public function token() {
    $truth = app()->make(TruthSource::class);

        return $truth->getCompanyToken();

    if (request()->header('X-API-TOKEN')) {
        return CompanyToken::with(['cu'])->where('token', request()->header('X-API-TOKEN'))->first();

    return $this->tokens()->first();

hope it helps

Thanks for the details!

cc @david


How are you removing this data? Via the application or manually in the database?

@david I removed the user from the company using the application.
So, I had my main user logged in in on MS Edge and the other user on FF, after I removed the user from the company, I refreshed the page and it asked me to sign in again, when I try to do so, it’ll display the 500 error.

As a workaround, I added the user back to the company with my admin one, signed in again with that user, selected another company and finally removed them again from the first company. Doing so I didn’t get any error. That’s why I think the application is trying to load the data from the last company the user has selected.


I think what is happening is the user attempting to log in isn’t assigned to any companies at all. I have checked in a fix for this in 5.3.85