Leantime/leantime · error · Exception

Invalid API key id

Error message

Invalid API key id

What it means

Error "Invalid API key id" thrown in Leantime/leantime.

Source

Thrown at app/Domain/Api/Services/Api.php:158

        return $values['id'] ? $values : false;
    }

    /**
     * Loads the stored values of an existing API key (user row) and maps them
     * into the value array used by the API key edit form.
     *
     * @param  int  $id  API key (user) id
     * @return array Mapped value array
     *
     * @throws Exception When the id is not a positive integer
     *
     * @api
     */
    #[RequiresPermission(ApiPermissions::MANAGE, global: true)]
    public function getApiKeyFormValues(int $id): array
    {
        if ($id <= 0) {
            throw new Exception('Invalid API key id');
        }

        $row = $this->userRepo->getUser($id);

        return [
            'firstname' => $row['firstname'],
            'lastname' => $row['lastname'],
            'user' => $row['username'],
            'phone' => $row['phone'],
            'status' => $row['status'],
            'role' => $row['role'],
            'hours' => $row['hours'],
            'wage' => $row['wage'],
            'clientId' => $row['clientId'],
            'source' => $row['source'],
            'pwReset' => $row['pwReset'],
        ];
    }

View on GitHub (pinned to 9a9f49f100)

When it happens

Trigger: Thrown at app/Domain/Api/Services/Api.php:158 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of Leantime/leantime@9a9f49f100 (2026-08-21). Data as JSON: /api/errors/8dc060c461ca68bb. Report an issue: GitHub.