{"id":20940031,"url":"https://github.com/kirilcvetkov/tesla-api","last_synced_at":"2026-01-23T06:21:35.541Z","repository":{"id":160152039,"uuid":"635090486","full_name":"kirilcvetkov/tesla-api","owner":"kirilcvetkov","description":"🚘 This is a comprehensive composer package that allows you to access your Tesla products through Tesla's API. You'll be able to view products, send commands, get metrics, and more from your Tesla account.","archived":false,"fork":false,"pushed_at":"2024-11-07T22:43:58.000Z","size":161,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-11-27T15:20:06.018Z","etag":null,"topics":["api","composer","tesla","tesla-api","teslamotors"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kirilcvetkov.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-05-02T00:16:45.000Z","updated_at":"2024-11-07T22:43:50.000Z","dependencies_parsed_at":"2024-01-09T07:45:59.778Z","dependency_job_id":"fa6c27ae-127c-46b8-8a1b-40726267bda0","html_url":"https://github.com/kirilcvetkov/tesla-api","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/kirilcvetkov/tesla-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirilcvetkov%2Ftesla-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirilcvetkov%2Ftesla-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirilcvetkov%2Ftesla-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirilcvetkov%2Ftesla-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kirilcvetkov","download_url":"https://codeload.github.com/kirilcvetkov/tesla-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirilcvetkov%2Ftesla-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28682259,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T05:48:07.525Z","status":"ssl_error","status_checked_at":"2026-01-23T05:48:07.129Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","composer","tesla","tesla-api","teslamotors"],"created_at":"2024-11-18T23:08:39.253Z","updated_at":"2026-01-23T06:21:35.514Z","avatar_url":"https://github.com/kirilcvetkov.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚘 Tesla API Package\n\nThis is a composer package that allows you to access your Tesla products through Tesla's API. You're able to view products, send commands, get metrics, and more from your Tesla account.\n\n## Installation\n\nYou can install this package via composer:\n\n```bash\ncomposer require kirilcvetkov/tesla-api\n```\n\n## Usage\n\n#### Step 1 - Get a single-use Token\nGenerate a single-use token by authenticating yourself with the Tesla's auth page using your Tesla account credentials. \nThis will be a direct connection to Tesla. After logging in, you'll arrive at \"Page Not Found\", which is to be expected. \nLook at the URL of this page and copy the `code` parameter. This is your single-use token.\n\nHere's how to get a link to Tesla's auth page:\n```php\nuse KirilCvetkov\\TeslaApi\\Authenticate;\n\n$url = Authenticate::create()-\u003egetLoginUrl();\n\necho '\u003ca href=\"' . $url . '\" target=\"_blank\"\u003eLog into Tesla\u003c/a\u003e';\n```\nThe URL of the \"Page Not Found\" page should look someything like this: `https://auth.tesla.com/void/callback?locale=en-US\u0026code=NA_code_123\u0026state=zzz\u0026issuer=https%3A%2F%2Fauth.tesla.com%2Foauth2%2Fv3`\n\n#### Step 2 - swap the single-use Token for a long-term Token\nUse the value of the `code` parameter to retrieve a long-term token:\n\n```php\nuse KirilCvetkov\\TeslaApi\\Authenticate;\n\n$singleUseToken = 'NA_code_123';\n$accessToken = Authenticate::create()-\u003egetToken($singleUseToken);\n\necho '\u003cpre\u003e';\nvar_export($accessToken);\n```\n\nWith this token, you can access Tesla's API.\n\n#### Step 3 - Access the API\n\n```php\nuse KirilCvetkov\\TeslaApi\\Tesla;\n\n$tesla = Tesla::create($accessToken); // $accessToken comes from the previous example\n\n$products = $tesla-\u003eproducts()-\u003eindex();\necho '\u003cpre\u003eProduct count ' . $products-\u003etotalCount . '\u003cbr\u003eItems \u003cbr\u003e';\nvar_export($products-\u003eitems);\n\n$vehicles = $tesla-\u003evehicles()-\u003eindex();\necho '\u003chr\u003eVehicle count ' . $vehicles-\u003etotalCount . '\u003cbr\u003eItems \u003cbr\u003e';\nvar_export($vehicles-\u003eitems);\n```\n\n### Testing\n\n```bash\ncomposer test\n```\n\n### Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n### Security\n\nIf you discover any security related issues, please email kcvetkov@live.com instead of using the issue tracker.\n\n## Credits\n\n-   [Kiril Cvetkov](https://github.com/kirilcvetkov)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkirilcvetkov%2Ftesla-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkirilcvetkov%2Ftesla-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkirilcvetkov%2Ftesla-api/lists"}