From 503effc7ef3953f03b4ed3a3caf8d28bfaa12e1a Mon Sep 17 00:00:00 2001 From: gak Date: Sun, 22 Oct 2023 14:47:06 +1100 Subject: [PATCH] wip: A tool to scrape the fleet api website --- scrape_fleet_api/.gitignore | 2 + scrape_fleet_api/Cargo.lock | 1755 +++++++ scrape_fleet_api/Cargo.toml | 12 + scrape_fleet_api/fleet.html | 9566 ++++++++++++++++++++++++++++++++++ scrape_fleet_api/src/main.rs | 425 ++ 5 files changed, 11760 insertions(+) create mode 100644 scrape_fleet_api/.gitignore create mode 100644 scrape_fleet_api/Cargo.lock create mode 100644 scrape_fleet_api/Cargo.toml create mode 100644 scrape_fleet_api/fleet.html create mode 100644 scrape_fleet_api/src/main.rs diff --git a/scrape_fleet_api/.gitignore b/scrape_fleet_api/.gitignore new file mode 100644 index 0000000..4fffb2f --- /dev/null +++ b/scrape_fleet_api/.gitignore @@ -0,0 +1,2 @@ +/target +/Cargo.lock diff --git a/scrape_fleet_api/Cargo.lock b/scrape_fleet_api/Cargo.lock new file mode 100644 index 0000000..dc8baaa --- /dev/null +++ b/scrape_fleet_api/Cargo.lock @@ -0,0 +1,1755 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "addr2line" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "ahash" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +dependencies = [ + "cfg-if", + "getrandom", + "once_cell", + "version_check", +] + +[[package]] +name = "anstream" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" + +[[package]] +name = "anstyle-parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" +dependencies = [ + "anstyle", + "windows-sys", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "backtrace" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "base64" +version = "0.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" + +[[package]] +name = "bumpalo" +version = "3.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" + +[[package]] +name = "cc" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "clap" +version = "4.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d04704f56c2cde07f43e8e2c154b43f216dc5c92fc98ada720177362f953b956" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e231faeaca65ebd1ea3c737966bf858971cd38c3849107aa3ea7de90a804e45" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "clap_lex" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" + +[[package]] +name = "colorchoice" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" + +[[package]] +name = "core-foundation" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" + +[[package]] +name = "cssparser" +version = "0.31.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b3df4f93e5fbbe73ec01ec8d3f68bba73107993a5b1e7519273c32db9b0d5be" +dependencies = [ + "cssparser-macros", + "dtoa-short", + "itoa", + "phf 0.11.2", + "smallvec", +] + +[[package]] +name = "cssparser-macros" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" +dependencies = [ + "quote", + "syn 2.0.38", +] + +[[package]] +name = "derive_more" +version = "0.99.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "dtoa" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcbb2bf8e87535c23f7a8a321e364ce21462d0ff10cb6407820e8e96dfff6653" + +[[package]] +name = "dtoa-short" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbaceec3c6e4211c79e7b1800fb9680527106beb2f9c51904a3210c03a448c74" +dependencies = [ + "dtoa", +] + +[[package]] +name = "ego-tree" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a68a4904193147e0a8dec3314640e6db742afd5f6e634f428a6af230d9b3591" + +[[package]] +name = "encoding_rs" +version = "0.8.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "errno" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "fastrand" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futf" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df420e2e84819663797d1ec6544b13c5be84629e7bb00dc960d6917db2987843" +dependencies = [ + "mac", + "new_debug_unreachable", +] + +[[package]] +name = "futures-channel" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" + +[[package]] +name = "futures-sink" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" + +[[package]] +name = "futures-task" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" + +[[package]] +name = "futures-util" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", + "pin-utils", +] + +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + +[[package]] +name = "getopts" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "getrandom" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "gimli" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" + +[[package]] +name = "h2" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "hermit-abi" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" + +[[package]] +name = "html5ever" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bea68cab48b8459f17cf1c944c67ddc572d272d9f2b274140f223ecb1da4a3b7" +dependencies = [ + "log", + "mac", + "markup5ever", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "http" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "0.14.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2 0.4.10", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper", + "native-tls", + "tokio", + "tokio-native-tls", +] + +[[package]] +name = "idna" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown", +] + +[[package]] +name = "ipnet" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" + +[[package]] +name = "itoa" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" + +[[package]] +name = "js-sys" +version = "0.3.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.149" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" + +[[package]] +name = "linux-raw-sys" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" + +[[package]] +name = "lock_api" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" + +[[package]] +name = "mac" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" + +[[package]] +name = "markup5ever" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a2629bb1404f3d34c2e921f21fd34ba00b206124c81f65c50b43b6aaefeb016" +dependencies = [ + "log", + "phf 0.10.1", + "phf_codegen", + "string_cache", + "string_cache_codegen", + "tendril", +] + +[[package]] +name = "memchr" +version = "2.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +dependencies = [ + "libc", + "wasi", + "windows-sys", +] + +[[package]] +name = "native-tls" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "new_debug_unreachable" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" + +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "object" +version = "0.32.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" + +[[package]] +name = "openssl" +version = "0.10.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c" +dependencies = [ + "bitflags 2.4.1", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db4d56a4c0478783083cfafcc42493dd4a981d41669da64b4572a2a089b51b1d" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.4.1", + "smallvec", + "windows-targets", +] + +[[package]] +name = "percent-encoding" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" + +[[package]] +name = "phf" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259" +dependencies = [ + "phf_shared 0.10.0", +] + +[[package]] +name = "phf" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" +dependencies = [ + "phf_macros", + "phf_shared 0.11.2", +] + +[[package]] +name = "phf_codegen" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb1c3a8bc4dd4e5cfce29b44ffc14bedd2ee294559a294e2a4d4c9e9a6a13cd" +dependencies = [ + "phf_generator 0.10.0", + "phf_shared 0.10.0", +] + +[[package]] +name = "phf_generator" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" +dependencies = [ + "phf_shared 0.10.0", + "rand", +] + +[[package]] +name = "phf_generator" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" +dependencies = [ + "phf_shared 0.11.2", + "rand", +] + +[[package]] +name = "phf_macros" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" +dependencies = [ + "phf_generator 0.11.2", + "phf_shared 0.11.2", + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "phf_shared" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" +dependencies = [ + "siphasher", +] + +[[package]] +name = "phf_shared" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkg-config" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + +[[package]] +name = "proc-macro2" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "redox_syscall" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "reqwest" +version = "0.11.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" +dependencies = [ + "base64", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-tls", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "serde", + "serde_json", + "serde_urlencoded", + "system-configuration", + "tokio", + "tokio-native-tls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + +[[package]] +name = "rustix" +version = "0.38.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67ce50cb2e16c2903e30d1cbccfd8387a74b9d4c938b6a4c5ec6cc7556f7a8a0" +dependencies = [ + "bitflags 2.4.1", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] + +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + +[[package]] +name = "ryu" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" + +[[package]] +name = "schannel" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "scrape_fleet_api" +version = "0.1.0" +dependencies = [ + "clap", + "reqwest", + "scraper", + "strum", + "tokio", + "tracing-subscriber", +] + +[[package]] +name = "scraper" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c95a930e03325234c18c7071fd2b60118307e025d6fff3e12745ffbf63a3d29c" +dependencies = [ + "ahash", + "cssparser", + "ego-tree", + "getopts", + "html5ever", + "once_cell", + "selectors", + "smallvec", + "tendril", +] + +[[package]] +name = "security-framework" +version = "2.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "selectors" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4eb30575f3638fc8f6815f448d50cb1a2e255b0897985c8c59f4d37b72a07b06" +dependencies = [ + "bitflags 2.4.1", + "cssparser", + "derive_more", + "fxhash", + "log", + "new_debug_unreachable", + "phf 0.10.1", + "phf_codegen", + "precomputed-hash", + "servo_arc", + "smallvec", +] + +[[package]] +name = "serde" +version = "1.0.189" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.189" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "serde_json" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "servo_arc" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d036d71a959e00c77a63538b90a6c2390969f9772b096ea837205c6bd0491a44" +dependencies = [ + "stable_deref_trait", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +dependencies = [ + "libc", +] + +[[package]] +name = "siphasher" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" + +[[package]] +name = "socket2" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "socket2" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "string_cache" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" +dependencies = [ + "new_debug_unreachable", + "once_cell", + "parking_lot", + "phf_shared 0.10.0", + "precomputed-hash", + "serde", +] + +[[package]] +name = "string_cache_codegen" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bb30289b722be4ff74a408c3cc27edeaad656e06cb1fe8fa9231fa59c728988" +dependencies = [ + "phf_generator 0.10.0", + "phf_shared 0.10.0", + "proc-macro2", + "quote", +] + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "strum" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.25.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.38", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "tempfile" +version = "3.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" +dependencies = [ + "cfg-if", + "fastrand", + "redox_syscall 0.3.5", + "rustix", + "windows-sys", +] + +[[package]] +name = "tendril" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d24a120c5fc464a3458240ee02c299ebcb9d67b5249c8848b09d639dca8d7bb0" +dependencies = [ + "futf", + "mac", + "utf-8", +] + +[[package]] +name = "thread_local" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +dependencies = [ + "cfg-if", + "once_cell", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "num_cpus", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2 0.5.5", + "tokio-macros", + "windows-sys", +] + +[[package]] +name = "tokio-macros" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d68074620f57a0b21594d9735eb2e98ab38b17f80d3fcb189fca266771ca60d" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" +dependencies = [ + "lazy_static", + "log", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" +dependencies = [ + "nu-ansi-term", + "sharded-slab", + "smallvec", + "thread_local", + "tracing-core", + "tracing-log", +] + +[[package]] +name = "try-lock" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" + +[[package]] +name = "unicode-bidi" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-width" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" + +[[package]] +name = "url" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.38", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" + +[[package]] +name = "web-sys" +version = "0.3.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "winreg" +version = "0.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +dependencies = [ + "cfg-if", + "windows-sys", +] diff --git a/scrape_fleet_api/Cargo.toml b/scrape_fleet_api/Cargo.toml new file mode 100644 index 0000000..3ade292 --- /dev/null +++ b/scrape_fleet_api/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "scrape_fleet_api" +version = "0.1.0" +edition = "2021" + +[dependencies] +reqwest = "0.11.22" +tokio = { version = "1.33.0", features = ["full"] } +clap = { version = "4.4.6", features = ["derive"] } +tracing-subscriber = "0.3.17" +scraper = "0.17.1" +strum = { version = "0.25.0", features = ["derive"] } \ No newline at end of file diff --git a/scrape_fleet_api/fleet.html b/scrape_fleet_api/fleet.html new file mode 100644 index 0000000..36fc986 --- /dev/null +++ b/scrape_fleet_api/fleet.html @@ -0,0 +1,9566 @@ + + + + + + + + Tesla Fleet API + + + + + + + + + + + + + + +
+
+
+
+
+

+ + Tesla homepageDeveloperSkip to main + content

+
    +
  1. + +
  2. +
  3. +
+
    +
+
    +
  1. +
  2. +
+
+ +
+ +
+
+
    +
  1. +
  2. +
  3. +
  4. +
+
+
+
+
+
+ + + + NAV + + + +
+ + + +
    + + +
    +
    +
    +
    + +

    Overview

    +

    FleetAPI is a RESTful data and command service providing access to Tesla vehicles and energy devices. +Partners can interact with their own devices, or devices for which they have been granted access by a customer. +
    +

    +

    Setup

    +
      +
    1. Set up a third-party account at https://developer.tesla.com.
    2. +
    3. Complete registration of your account: +
        +
      1. Generate a public/private key pair for signing commands and host your public key in the /.well-known section of your website. See details here.
      2. +
      3. Generate a partner authentication token.
      4. +
      5. Make a POST call to /api/1/partner_accounts with your partner token.
      6. +
      +
    4. +
    5. Request authorization permissions from a customer and generate a third-party token on their behalf. See the authentication section for examples.
    6. +
    + +


    +

    Regional requirements

    +

    FleetAPI is available regionally. Use the appropriate region for each user.

    + + +

    Authentication

    +

    API endpoints require an authentication token. There are two types of tokens: +

      +
    1. Partner authentication token - The subject of this token will be an application or business client_id, and will be generated using the client_credentials grant type. This can be used for calls related to modifying an application like register, or for accessing business-owned devices.
    2. +
    3. Third-party token - The subject of this token will be the ID of a customer's account, and will be generated using the authorization_code grant type. This token is generated by a third-party application on behalf of a customer, and can be used for most endpoints.
    4. +

    +

    Generating a partner authentication token

    +

    +POST https://auth.tesla.com/oauth2/v3/token +

    + +

    Generates a token to be used for managing a partner's account or devices they own.

    +
    CLIENT_ID=<command to obtain your client_id>
    +CLIENT_SECRET=<secure command to obtain your client_secret>
    +AUDIENCE="https://fleet-api.prd.na.vn.cloud.tesla.com"
    +# Partner authentication token request
    +curl --request POST \
    +  --header 'Content-Type: application/x-www-form-urlencoded' \
    +  --data-urlencode 'grant_type=client_credentials' \
    +  --data-urlencode "client_id=$CLIENT_ID" \
    +  --data-urlencode "client_secret=$CLIENT_SECRET" \
    +  --data-urlencode 'scope=openid vehicle_device_data vehicle_cmds vehicle_charging_cmds' \
    +  --data-urlencode "audience=$AUDIENCE" \
    +  'https://auth.tesla.com/oauth2/v3/token'
    +
    +

    Generating a third-party token on behalf of a customer

    + +

    Use this Authorization Code Grant flow to generate a token on behalf of a customer. This allows you to make API calls using the scopes granted by the customer.

    + +


    +1. To initiate the authorization code flow, direct the customer to an /authorize request.

    +
    https://auth.tesla.com/oauth2/v3/authorize?&client_id=$CLIENT_ID&locale=en-US&prompt=login&redirect_uri=$REDIRECT_URI&response_type=code&scope=openid%20vehicle_device_data%20offline_access&state=$STATE`
    +
    +

    +https://auth.tesla.com/oauth2/v3/authorize +

    + +

    +Parameters +

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameRequiredExampleDescription
    response_typeYescodeA string, always use the value "code"
    client_idYesabc-123Partner app client_id
    redirect_uriYeshttps://example.com/auth/callbackPartner app callback url, spec: rfc6749
    scopeYesopenid offline_access vehicle_device_data vehicle_cmds vehicle_charging_cmdsSpace delimited list of scopes, include openid and office_access to obtain a refresh token
    stateYesdb4af3f87...Random value used for validation
    nonceNo7baf90cda...Random value used for replay prevention
    + +

    2. Extract the code URL parameter from the callback.

    + +

    3. Execute a code exchange call to generate a token. Save the refresh_token to generate tokens in the future. The access_token can be used as the Bearer token in the Authorization header when making API requests.

    + +

    +POST https://auth.tesla.com/oauth2/v3/token +

    +
    # Authorization code token request
    +CODE=<extract from callback>
    +curl --request POST \
    +  --header 'Content-Type: application/x-www-form-urlencoded' \
    +  --data-urlencode 'grant_type=authorization_code' \
    +  --data-urlencode "client_id=$CLIENT_ID" \
    +  --data-urlencode "client_secret=$CLIENT_SECRET" \
    +  --data-urlencode "code=$CODE" \
    +  --data-urlencode "audience=$AUDIENCE" \
    +  --data-urlencode "redirect_uri=$CALLBACK" \
    +  'https://auth.tesla.com/oauth2/v3/token'
    +# Extract access_token and refresh_token from this response
    +
    +

    +Parameters +

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameRequiredExampleDescription
    grant_typeYesauthorization_codeGrant type, authorization_code, refresh_token, client_credentials
    client_idYesabc-123Partner app client_id
    client_secretYessecret-passwordPartner app client_secret
    codeYesa90869e9d...Code from authorize request callback
    redirect_uriYeshttps://example.com/auth/callbackPartner app callback url, spec: rfc6749
    scopeNoopenid vehicle_device_data vehicle_cmds vehicle_charging_cmdsSpace-delimited list of scopes
    audienceYeshttps://fleet-api.prd.na.vn.cloud.tesla.comAudience for generated token
    + +

    4. Use the refresh_token to generate new tokens and obtain refresh tokens.

    +
    # Refresh token request
    +REFRESH_TOKEN=<extract from authorization code token request>
    +curl --request POST \
    +  --header 'Content-Type: application/x-www-form-urlencoded' \
    +  --data-urlencode 'grant_type=refresh_token' \
    +  --data-urlencode "client_id=$CLIENT_ID" \
    +  --data-urlencode "refresh_token=$REFRESH_TOKEN" \
    +  'https://auth.tesla.com/oauth2/v3/token'
    +

    Authorization Scopes

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameScopeDescription
    Profile Informationuser_dataContact information, home address, profile picture, and referral information
    Vehicle Informationvehicle_device_dataVehicle live data, location, eligible upgrades, nearby superchargers, ownership, and service scheduling data
    Vehicle Commandsvehicle_cmdsCommands like add/remove driver, access Live Camera, unlock, wake up, remote start, and schedule software updates
    Vehicle Charging Managementvehicle_charging_cmdsVehicle charging history, billed amount, charging location, commands to schedule, and start/stop charging
    Energy Product Informationenergy_device_dataEnergy flow history, saving forecast, tariff rates, grid import, calendar, site status, time of use, and ownership
    Energy Product Commandsenergy_cmdsCommands like update storm mode
    + +


    +

    +

    Membership Tiers

    +

    These are the currently active membership tiers to access Tesla's Fleet API.

    +

    Discovery Tier

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Subscription planDiscovery Tier
    Device data limits1 API request / car / 5 min
    And
    1M API requests / day
    Commands limits50 API requests / car / day
    And
    500k API requests / day
    Wake limits5 API requests / car / hour
    CapabilitiesAPI access
    Login with Tesla
    Tesla for Business access
    Enterprise charging API
    Invoices
    Limited Fleet Telemetry streaming
    Price$0/week
    Subscription durationWeekly, auto-renewing until canceled
    AvailabilityThis subscription plan is a temporary plan that will be replaced with different options in 2024
    + +


    +

    +

    Conventions

    Request Format

    +

    Requests require the HTTP header 'Content-Type' with the value 'application/json'. In addition, all authenticated endpoints require the standard Bearer Authorization header and a valid token.

    +
      Content-Type: application/json
    +  Authorization: Bearer 8s2wfclhyp5iiikowm3ocnfalt7qfl7es8xhuda3ttusslssx6c14hq7yocp62c5
    +
    +

    POST request parameters are expected to be a JSON object in the body.

    +

    Response Format

    +

    Responses are returned as a JSON object with the following common fields:

    + + + + + + + + + + + + + + + + + + + + + + + +
    FieldDescription
    response: <json>JSON representing the response. May be a scalar, an array or a object depending on the specific request
    error: short-stringShort error "enum" like "not_found", "invalid_resource", "invalid_password"
    error_description: long-stringAdditional error information
    messages: {"field1":["problem1","problem2"],...}Data validation issues, especially on a 422 responses
    +

    Request Parameters

    +

    The {id} path parameter for device/entity/vehicle endpoints is expected to be the integer id of the record returned from the list endpoint. Example: vehicles list. +For vehicle endpoints and vehicle commands, a valid VIN can be used instead of an integer id. +
    +

    +

    Response Codes

    +

    Not all possible response codes are covered in Endpoint examples. The following are common meanings of status codes. +The response body is typically JSON-encoded with details in the "error" field. +

    +

    Successes

    + + + + + + + + + + + + + + + + + +
    Status CodeDescriptionDetail
    200OkThe request was handled successfully
    201CreatedThe record was created successfully
    +

    Client errors

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Status CodeDescriptionDetail
    400Bad Request
    • error:invalid_command if the data_request or command is unknown
    • error:invalid_field if the new_field data isn't valid
    401Unauthorized
    • no response body - OAuth token has expired
    • error:mobile_access_disabled if the vehicle has turned off remote access
    • error:login_failed if the current_password is incorrect on change_password
    • error:password_changed if the password has changed since the last token was acquired
    402Payment RequiredYou need to make a payment in order to use the API (non-free account only)
    403ForbiddenYou do not have access to this resource, do you have the required scopes?
    404Not FoundThe requested resource does not exist
    405Not AllowedThe operation is not allowed
    406Not Acceptableerror:not_a_JSON_request if the HTTP request does not have Content-Type set to application/json
    408Device Not AvailableIf the vehicle is not "online" when a request is made.
    412Precondition FailedA condition has not been met to process the request
    • Unregistered account - you must first call the partner account register endpoint
    418Client Too Old (Not supported)
    422Invalid Resourceerror:invalid_resource if there is a semantic problem with the data, e.g. missing or invalid data
    • Vehicle does not yet support signed commands
    423LockedAccount is locked, and must be unlocked by Tesla. No response body
    429Rate limitedAccount or server is rate limited, this happens when too many requests are made by an account
    • Check the 'Retry-After' request header (in seconds) to determine when to make the next request
    451Resource Unavailable For Legal ReasonsQuerying for a user/vehicle without proper privacy settings (e.g. wrong region)
    499Client Closed RequestClient has closed the request before the server could send a response
    +

    Server errors

    + + + + + + + + + + + + + + + + + + + + + + +
    Status CodeDescriptionDetail
    500Internal server errorAn error occurred while processing the request
    503Service UnavailableEither an internal service or a vehicle did not respond (timeout)
    504Gateway TimeoutServer did not receive a response
    +

    Device errors

    + + + + + + + + + + + + +
    Status CodeDescriptionDetail
    540Device Unexpected responseVehicle responded with an error - might need a reboot, OTA update, or service
    + +


    +

    API Status

    +

    +GET /status +

    +
    curl 'https://fleet-api.prd.na.vn.cloud.tesla.com/status' 
    +
    +

    This endpoint returns the string "ok" if the API is operating normally. No HTTP headers are required. +
    +

    +

    Charging Endpoints

    charging_history

    +

    GET /api/1/dx/charging/history

    + +

    scopes: vehicle_charging_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/dx/charging/history' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const requestOptions = {
    +   method: 'GET',
    +   headers: myHeaders,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/dx/charging/history", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/dx/charging/history")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Get.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = ''
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("GET", "/api/1/dx/charging/history", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Returns the paginated charging history.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    vinquerystringNoVIN
    startTimequerystringNoStartTime
    endTimequerystringNoEndTime
    pageNoqueryintegerNopageNo
    pageSizequeryintegerNopageSize
    sortByquerystringNosortBy
    sortOrderquerystringNosortOrder
    +
    Click to view successful response{ + "data": [ + { + "sessionId": 1234567, + "vin": "TEST00000000VIN01", + "siteLocationName": "Truckee, CA - Soaring Way", + "chargeStartDateTime": "2023-07-27T11:43:45-07:00", + "chargeStopDateTime": "2023-07-27T12:08:35-07:00", + "unlatchDateTime": "2023-07-27T12:25:31-07:00", + "countryCode": "US", + "fees": [ + { + "sessionFeeId": 7654321, + "feeType": "CHARGING", + "currencyCode": "USD", + "pricingType": "PAYMENT", + "rateBase": 0.46, + "rateTier1": 0, + "rateTier2": 0, + "rateTier3": null, + "rateTier4": null, + "usageBase": 40, + "usageTier1": 0, + "usageTier2": 24, + "usageTier3": null, + "usageTier4": null, + "totalBase": 18.4, + "totalTier1": 0, + "totalTier2": 0, + "totalTier3": 0, + "totalTier4": 0, + "totalDue": 18.4, + "netDue": 18.4, + "uom": "kwh", + "isPaid": true, + "status": "PAID" + }, + { + "sessionFeeId": 87654321, + "feeType": "PARKING", + "currencyCode": "USD", + "pricingType": "NO_CHARGE", + "rateBase": 0, + "rateTier1": 0, + "rateTier2": 0, + "rateTier3": null, + "rateTier4": null, + "usageBase": 0, + "usageTier1": 0, + "usageTier2": 0, + "usageTier3": null, + "usageTier4": null, + "totalBase": 0, + "totalTier1": 0, + "totalTier2": 0, + "totalTier3": 0, + "totalTier4": 0, + "totalDue": 0, + "netDue": 0, + "uom": "min", + "isPaid": true, + "status": "PAID" + } + ], + "billingType": "IMMEDIATE", + "invoices": [ + { + "fileName": "ABC-123NN-US.pdf", + "contentId": "abc-123-efg", + "invoiceType": "IMMEDIATE" + } + ], + "vehicleMakeType": "TSLA" + } + ] +} +

    charging_sessions (only for business fleet owners)

    +

    GET /api/1/dx/charging/sessions

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/dx/charging/sessions' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const requestOptions = {
    +   method: 'GET',
    +   headers: myHeaders,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/dx/charging/sessions", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/dx/charging/sessions")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Get.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = ''
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("GET", "/api/1/dx/charging/sessions", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Returns the charging session information including pricing and energy data. This endpoint is only available for business accounts that own a fleet of vehicles.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    vinquerystringNoVIN
    date_fromquerystringNodate from
    date_toquerystringNodate to
    limitqueryintegerNolimit
    offsetqueryintegerNooffset
    +
    Click to view successful response{ + "data": [ + { + "charging_periods": [ + { + "dimensions": [ + { + "type": "ENERGY", + "volume": 0 + } + ], + "start_date_time": "string" + } + ], + "id": "string", + "location": { + "country": "string", + "name": "string" + }, + "model": "string", + "start_date_time": "string", + "stop_date_time": "string", + "tariffs": { + "currency": "string", + "elements": [ + { + "price_components": [ + { + "price": 0, + "step_size": 0, + "type": "ENERGY" + } + ], + "restrictions": { + "additionalProp1": {} + } + } + ] + }, + "total_cost": { + "excl_vat": 0, + "incl_vat": 0, + "vat": 0 + }, + "total_energy": 0, + "total_time": 0, + "vin": "string" + } + ], + "status_code": 0, + "status_message": "string", + "timestamp": { + "time.Time": "string" + } +} +

    Partner Endpoints

    public_key

    +

    GET /api/1/partner_accounts/public_key

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/partner_accounts/public_key' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const requestOptions = {
    +   method: 'GET',
    +   headers: myHeaders,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/partner_accounts/public_key", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/partner_accounts/public_key")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Get.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = ''
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("GET", "/api/1/partner_accounts/public_key", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Returns the public key associated with a domain. It can be used to ensure the registration was successful.

    +

    Parameters

    + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    domainquerystringNoPartner domain
    +
    Click to view successful response{ + "public_key": "04b3ba29bfed422f4a641630333458428cbd681ae1456f1d50521852577c3a84b22c7290087af38d8c4cd7b310dbfd79f164405d72a6cfac875ca37a7f09317891" +} +

    register

    +

    POST /api/1/partner_accounts

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{"domain":"string"}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/partner_accounts' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({
    +   "domain": "string"
    +});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/partner_accounts", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/partner_accounts")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({
    +   "domain": "string"
    +})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({
    +   "domain": "string"
    +})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/partner_accounts", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Registers an existing account before it can be used for general API access. Each application from developer.tesla.com must complete this step.

    • The domain for this endpoint must match the root domain from the allowed_origins on developer.tesla.com. Ex.: 123.abc.com can be used for an allowed_origin of www.abc.com.
    • The Bearer token for this request must be a partner authentication token.
    • A PEM-encoded EC public key using the secp256r1 curve (prime256v1) must be hosted at https://<your domain>/.well-known/appspecific/com.tesla.3p.public-key.pem. This public key will be registered on devices and used to validate commands that are generated by the vehicle-command proxy.
    • The domain will be displayed to users as part of the mobile-app-based vehicle key-pairing process.

    +

    Parameters

    + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    domainbodystringYesYour domain. You must host a PEM-encoded EC public key at https:///.well-known/appspecific/com.tesla.3p.public-key.pem. Domains must be lowercase and have the same root as a domain from your application's allowed_origins on developer.tesla.com.
    +
    Click to view successful response{ + "client_id": "client-id", + "name": "The Best Tesla Partner", + "description": "The very best Tesla partner", + "domain": "the-best-partner.com", + "ca": null, + "created_at": "2023-06-28T00:42:00.000Z", + "updated_at": "2023-06-28T00:42:00.000Z", + "enterprise_tier": "free", + "public_key": "04b3ba29bfed422f4a641630333458428cbd681ae1456f1d50521852577c3a84b22c7290087af38d8c4cd7b310dbfd79f164405d72a6cfac875ca37a7f09317891" +} +

    User Endpoints

    backup_key

    +

    GET /api/1/users/backup_key

    + +

    scopes: user_data

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/users/backup_key' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const requestOptions = {
    +   method: 'GET',
    +   headers: myHeaders,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/users/backup_key", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/users/backup_key")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Get.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = ''
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("GET", "/api/1/users/backup_key", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Returns the public key associated with the user.

    +

    Parameters

    Click to view successful response{ + "backup_key": null +} +

    feature_config

    +

    GET /api/1/users/feature_config

    + +

    scopes: user_data

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/users/feature_config' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const requestOptions = {
    +   method: 'GET',
    +   headers: myHeaders,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/users/feature_config", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/users/feature_config")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Get.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = ''
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("GET", "/api/1/users/feature_config", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Returns any custom feature flag applied to a user.

    +

    Parameters

    Click to view successful response{ + "signaling": { + "enabled": true, + "subscribe_connectivity": false + } +} +

    me

    +

    GET /api/1/users/me

    + +

    scopes: user_data

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/users/me' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const requestOptions = {
    +   method: 'GET',
    +   headers: myHeaders,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/users/me", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/users/me")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Get.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = ''
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("GET", "/api/1/users/me", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Returns a summary of a user's account.

    +

    Parameters

    Click to view successful response{ + "email": "test-user@tesla.com", + "full_name": "Testy McTesterson", + "profile_image_url": "https://vehicle-files.prd.usw2.vn.cloud.tesla.com/profile_images/f98c87cd7bebc06069b89b33f9ec634c195520f75b6e63ea89f0b7c61449c689.jpg" +} +

    orders

    +

    GET /api/1/users/orders

    + +

    scopes: user_data

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/users/orders' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const requestOptions = {
    +   method: 'GET',
    +   headers: myHeaders,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/users/orders", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/users/orders")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Get.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = ''
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("GET", "/api/1/users/orders", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Returns the active orders for a user.

    +

    Parameters

    Click to view successful response[ + { + "vehicleMapId": 1234466, + "referenceNumber": "RN00000001", + "vin": "5YJ30000000000001", + "orderStatus": "BOOKED", + "orderSubstatus": "_Z", + "modelCode": "m3", + "countryCode": "US", + "locale": "en_US", + "mktOptions": "APBS,DV2W,IBB1,PMNG,PRM30,SC04,MDL3,W41B,MT322,CPF0,RSF1,CW03", + "isB2b": false + } +] +

    region

    +

    GET /api/1/users/region

    + +

    scopes: user_data

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/users/region' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const requestOptions = {
    +   method: 'GET',
    +   headers: myHeaders,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/users/region", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/users/region")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Get.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = ''
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("GET", "/api/1/users/region", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Returns a user's region and appropriate fleet-api base URL. Accepts no parameters, response is based on the authentication token subject.

    +

    Parameters

    Click to view successful response{ + "region": "eu", + "fleet_api_base_url": "https://fleet-api.prd.eu.vn.cloud.tesla.com" +} +

    Vehicle Commands

    actuate_trunk

    +

    POST /api/1/vehicles/{id}/command/actuate_trunk

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{"which_trunk":"string"}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/actuate_trunk' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({
    +   "which_trunk": "string"
    +});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/actuate_trunk", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/actuate_trunk")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({
    +   "which_trunk": "string"
    +})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({
    +   "which_trunk": "string"
    +})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/actuate_trunk", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Controls the front (which_trunk: "front") or rear (which_trunk: "rear") trunk.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    which_trunkbodystringYes
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    adjust_volume

    +

    POST /api/1/vehicles/{id}/command/adjust_volume

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{"volume":"integer"}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/adjust_volume' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({
    +   "volume": "integer"
    +});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/adjust_volume", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/adjust_volume")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({
    +   "volume": "integer"
    +})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({
    +   "volume": "integer"
    +})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/adjust_volume", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Adjusts vehicle media playback volume.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    volumebodyintegerYes
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    auto_conditioning_start

    +

    POST /api/1/vehicles/{id}/command/auto_conditioning_start

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/auto_conditioning_start' 
    +
    + +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/auto_conditioning_start", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    + +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/auto_conditioning_start")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/auto_conditioning_start", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    + +

    Starts climate preconditioning.

    +

    Parameters

    + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    auto_conditioning_stop

    +

    POST /api/1/vehicles/{id}/command/auto_conditioning_stop

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/auto_conditioning_stop' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/auto_conditioning_stop", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/auto_conditioning_stop")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/auto_conditioning_stop", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Stops climate preconditioning.

    +

    Parameters

    + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    cancel_software_update

    +

    POST /api/1/vehicles/{id}/command/cancel_software_update

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/cancel_software_update' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/cancel_software_update", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/cancel_software_update")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/cancel_software_update", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Cancels the countdown to install the vehicle software update. This operation will no longer work after the vehicle begins the software installation.

    +

    Parameters

    + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    charge_max_range

    +

    POST /api/1/vehicles/{id}/command/charge_max_range

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/charge_max_range' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/charge_max_range", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/charge_max_range")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/charge_max_range", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Charges in max range mode -- we recommend limiting the use of this mode to long trips.

    +

    Parameters

    + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    charge_port_door_close

    +

    POST /api/1/vehicles/{id}/command/charge_port_door_close

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/charge_port_door_close' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/charge_port_door_close", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/charge_port_door_close")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/charge_port_door_close", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Closes the charge port door.

    +

    Parameters

    + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    charge_port_door_open

    +

    POST /api/1/vehicles/{id}/command/charge_port_door_open

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/charge_port_door_open' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/charge_port_door_open", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/charge_port_door_open")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/charge_port_door_open", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Opens the charge port door.

    +

    Parameters

    + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    charge_standard

    +

    POST /api/1/vehicles/{id}/command/charge_standard

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/charge_standard' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/charge_standard", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/charge_standard")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/charge_standard", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Charges in Standard mode.

    +

    Parameters

    + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    charge_start

    +

    POST /api/1/vehicles/{id}/command/charge_start

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/charge_start' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/charge_start", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/charge_start")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/charge_start", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Starts charging the vehicle.

    +

    Parameters

    + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    charge_stop

    +

    POST /api/1/vehicles/{id}/command/charge_stop

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/charge_stop' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/charge_stop", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/charge_stop")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/charge_stop", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Stops charging the vehicle.

    +

    Parameters

    + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    door_lock

    +

    POST /api/1/vehicles/{id}/command/door_lock

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/door_lock' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/door_lock", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/door_lock")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/door_lock", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Locks the vehicle.

    +

    Parameters

    + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    door_unlock

    +

    POST /api/1/vehicles/{id}/command/door_unlock

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/door_unlock' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/door_unlock", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/door_unlock")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/door_unlock", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Unlocks the vehicle.

    +

    Parameters

    + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    erase_user_data

    +

    POST /api/1/vehicles/{id}/command/erase_user_data

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/erase_user_data' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/erase_user_data", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/erase_user_data")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/erase_user_data", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Erases user's data from the user interface. Requires the vehicle to be in park.

    +

    Parameters

    + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    flash_lights

    +

    POST /api/1/vehicles/{id}/command/flash_lights

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/flash_lights' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/flash_lights", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/flash_lights")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/flash_lights", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Briefly flashes the vehicle headlights. Requires the vehicle to be in park.

    +

    Parameters

    + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    guest_mode

    +

    POST /api/1/vehicles/{id}/command/guest_mode

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{"enable":"boolean"}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/guest_mode' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({
    +   "enable": "boolean"
    +});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/guest_mode", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/guest_mode")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({
    +   "enable": "boolean"
    +})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({
    +   "enable": "boolean"
    +})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/guest_mode", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +
      +
    • Restricts certain vehicle UI functionality from guest users:
        +
      • PIN to Drive
      • +
      • Speed Limit Mode
      • +
      • Glovebox PIN
      • +
      • Add/Remove keys
      • +
      • Change vehicle name
      • +
      +
    • +
    • Enables erase_user_data API on the vehicle to clear user data.
    • +
    • Allows a user to set up Tesla mobile app access with the vehicle key card:
        +
      • If a user unlocks a vehicle or authenticates it for driving while in Guest Mode, they will receive a prompt to set up a phone key by scanning a QR code on the vehicle touchscreen.
          +
        • Requires vehicle to be online.
        • +
        • Does not show a QR code if a phone key is already connected.
        • +
        • Revokes any existing guest access if a QR code is shown.
        • +
        +
      • +
      • Any account that scans the QR code will gain Tesla app access to the vehicle. This allows that account to view live vehicle location and issue remote commands, and download that account's Tesla profile to the vehicle.        
          +
        • The QR code is single-use and expires after 10 minutes.
        • +
        • Use the revoke API to remove access.
        • +
      • +
      • The vehicle needs to be online to use this API (wake if vehicle unavailable).
      • +
      • The app access is GUEST access, it does not have access to all the features an owner or driver does.
      • +
      • Only one guest is allowed access at a time.
      • +
      • If a user does not have the app installed, they will see this webpage (https://www.tesla.com/_gs/test) to guide them through the process.
      • +
      • A user can set up their phone as key with the Tesla app when in proximity of the vehicle.
      • +
      +
    • +
    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    enablebodybooleanYes
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    honk_horn

    +

    POST /api/1/vehicles/{id}/command/honk_horn

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/honk_horn' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/honk_horn", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/honk_horn")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/honk_horn", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Honks the vehicle horn. Requires the vehicle to be in park.

    +

    Parameters

    + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    media_next_fav

    +

    POST /api/1/vehicles/{id}/command/media_next_fav

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/media_next_fav' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/media_next_fav", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/media_next_fav")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/media_next_fav", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Advances media player to next favorite track.

    +

    Parameters

    + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    media_next_track

    +

    POST /api/1/vehicles/{id}/command/media_next_track

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/media_next_track' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/media_next_track", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/media_next_track")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/media_next_track", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Advances media player to next track.

    +

    Parameters

    + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    media_prev_fav

    +

    POST /api/1/vehicles/{id}/command/media_prev_fav

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/media_prev_fav' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/media_prev_fav", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/media_prev_fav")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/media_prev_fav", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Advances media player to previous favorite track.

    +

    Parameters

    + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    media_prev_track

    +

    POST /api/1/vehicles/{id}/command/media_prev_track

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/media_prev_track' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/media_prev_track", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/media_prev_track")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/media_prev_track", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Advances media player to previous track.

    +

    Parameters

    + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    media_toggle_playback

    +

    POST /api/1/vehicles/{id}/command/media_toggle_playback

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/media_toggle_playback' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/media_toggle_playback", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/media_toggle_playback")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/media_toggle_playback", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Toggles current play/pause state.

    +

    Parameters

    + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    media_volume_down

    +

    POST /api/1/vehicles/{id}/command/media_volume_down

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/media_volume_down' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/media_volume_down", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/media_volume_down")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/media_volume_down", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Turns the volume down by one.

    +

    Parameters

    + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +
    +

    POST /api/1/vehicles/{id}/command/navigation_gps_request

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{"lat":null,"lon":null,"order":"integer"}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/navigation_gps_request' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({
    +   "lat": null,
    +   "lon": null,
    +   "order": "integer"
    +});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/navigation_gps_request", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/navigation_gps_request")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({
    +   "lat": nil,
    +   "lon": nil,
    +   "order": "integer"
    +})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({
    +   "lat": None,
    +   "lon": None,
    +   "order": "integer"
    +})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/navigation_gps_request", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Start navigation to given coordinates. Order can be used to specify order of multiple stops.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    latbodyUnknownYes
    lonbodyUnknownYes
    orderbodyintegerYes
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +
    +

    POST /api/1/vehicles/{id}/command/navigation_request

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{"type":"string","value":null,"locale":"string","timestamp_ms":"string"}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/navigation_request' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({
    +   "type": "string",
    +   "value": null,
    +   "locale": "string",
    +   "timestamp_ms": "string"
    +});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/navigation_request", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/navigation_request")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({
    +   "type": "string",
    +   "value": nil,
    +   "locale": "string",
    +   "timestamp_ms": "string"
    +})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({
    +   "type": "string",
    +   "value": None,
    +   "locale": "string",
    +   "timestamp_ms": "string"
    +})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/navigation_request", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Sends a location to the in-vehicle navigation system.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    typebodystringYes
    valuebodyUnknownYes
    localebodystringYes
    timestamp_msbodystringYes
    +
    Click to view successful response{ + "result": true, + "queued": true +} +
    +

    POST /api/1/vehicles/{id}/command/navigation_sc_request

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{"id":"integer","order":"integer"}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/navigation_sc_request' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({
    +   "id": "integer",
    +   "order": "integer"
    +});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/navigation_sc_request", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/navigation_sc_request")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({
    +   "id": "integer",
    +   "order": "integer"
    +})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({
    +   "id": "integer",
    +   "order": "integer"
    +})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/navigation_sc_request", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Start navigation to a supercharger.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    idbodyintegerYes
    orderbodyintegerYes
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    remote_auto_seat_climate_request

    +

    POST /api/1/vehicles/{id}/command/remote_auto_seat_climate_request

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{"auto_seat_position":"integer","auto_climate_on":"boolean"}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/remote_auto_seat_climate_request' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({
    +   "auto_seat_position": "integer",
    +   "auto_climate_on": "boolean"
    +});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/remote_auto_seat_climate_request", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/remote_auto_seat_climate_request")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({
    +   "auto_seat_position": "integer",
    +   "auto_climate_on": "boolean"
    +})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({
    +   "auto_seat_position": "integer",
    +   "auto_climate_on": "boolean"
    +})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/remote_auto_seat_climate_request", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Sets automatic seat heating and cooling.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    auto_seat_positionbodyintegerYes
    auto_climate_onbodybooleanYes
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    remote_auto_steering_wheel_heat_climate_request

    +

    POST /api/1/vehicles/{id}/command/remote_auto_steering_wheel_heat_climate_request

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{"on":"boolean"}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/remote_auto_steering_wheel_heat_climate_request' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({
    +   "on": "boolean"
    +});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/remote_auto_steering_wheel_heat_climate_request", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/remote_auto_steering_wheel_heat_climate_request")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({
    +   "on": "boolean"
    +})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({
    +   "on": "boolean"
    +})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/remote_auto_steering_wheel_heat_climate_request", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Sets automatic steering wheel heating on/off.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    onbodybooleanYes
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    remote_boombox

    +

    POST /api/1/vehicles/{id}/command/remote_boombox

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{"sound":"integer"}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/remote_boombox' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({
    +   "sound": "integer"
    +});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/remote_boombox", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/remote_boombox")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({
    +   "sound": "integer"
    +})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({
    +   "sound": "integer"
    +})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/remote_boombox", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Plays a sound through the vehicle external speaker.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    soundbodyintegerYes
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    remote_seat_cooler_request

    +

    POST /api/1/vehicles/{id}/command/remote_seat_cooler_request

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{"seat_position":"integer","seat_cooler_level":"integer"}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/remote_seat_cooler_request' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({
    +   "seat_position": "integer",
    +   "seat_cooler_level": "integer"
    +});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/remote_seat_cooler_request", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/remote_seat_cooler_request")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({
    +   "seat_position": "integer",
    +   "seat_cooler_level": "integer"
    +})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({
    +   "seat_position": "integer",
    +   "seat_cooler_level": "integer"
    +})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/remote_seat_cooler_request", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Sets seat cooling.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    seat_positionbodyintegerYes
    seat_cooler_levelbodyintegerYes
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    remote_seat_heater_request

    +

    POST /api/1/vehicles/{id}/command/remote_seat_heater_request

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/remote_seat_heater_request' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/remote_seat_heater_request", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/remote_seat_heater_request")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/remote_seat_heater_request", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Sets seat heating.

    +

    Parameters

    + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    remote_start_drive

    +

    POST /api/1/vehicles/{id}/command/remote_start_drive

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/remote_start_drive' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/remote_start_drive", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/remote_start_drive")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/remote_start_drive", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Starts the vehicle remotely. Requires keyless driving to be enabled.

    +

    Parameters

    + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    remote_steering_wheel_heat_level_request

    +

    POST /api/1/vehicles/{id}/command/remote_steering_wheel_heat_level_request

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{"level":"integer"}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/remote_steering_wheel_heat_level_request' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({
    +   "level": "integer"
    +});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/remote_steering_wheel_heat_level_request", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/remote_steering_wheel_heat_level_request")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({
    +   "level": "integer"
    +})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({
    +   "level": "integer"
    +})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/remote_steering_wheel_heat_level_request", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Sets steering wheel heat level.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    levelbodyintegerYes
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    remote_steering_wheel_heater_request

    +

    POST /api/1/vehicles/{id}/command/remote_steering_wheel_heater_request

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{"on":"boolean"}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/remote_steering_wheel_heater_request' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({
    +   "on": "boolean"
    +});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/remote_steering_wheel_heater_request", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/remote_steering_wheel_heater_request")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({
    +   "on": "boolean"
    +})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({
    +   "on": "boolean"
    +})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/remote_steering_wheel_heater_request", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Sets steering wheel heating on/off. For vehicles that do not support auto steering wheel heat.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    onbodybooleanYes
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    reset_pin_to_drive_pin

    +

    POST /api/1/vehicles/{id}/command/reset_pin_to_drive_pin

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/reset_pin_to_drive_pin' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/reset_pin_to_drive_pin", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/reset_pin_to_drive_pin")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/reset_pin_to_drive_pin", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Removes PIN to Drive. Requires the car to be in pin to drive mode and not in valet mode.

    +

    Parameters

    + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    reset_valet_pin

    +

    POST /api/1/vehicles/{id}/command/reset_valet_pin

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/reset_valet_pin' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/reset_valet_pin", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/reset_valet_pin")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/reset_valet_pin", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Removes PIN for Valet Mode.

    +

    Parameters

    + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    schedule_software_update

    +

    POST /api/1/vehicles/{id}/command/schedule_software_update

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{"offset_sec":"integer"}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/schedule_software_update' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({
    +   "offset_sec": "integer"
    +});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/schedule_software_update", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/schedule_software_update")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({
    +   "offset_sec": "integer"
    +})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({
    +   "offset_sec": "integer"
    +})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/schedule_software_update", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Schedules a vehicle software update (over the air "OTA") to be installed in the future.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    offset_secbodyintegerYes
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    set_bioweapon_mode

    +

    POST /api/1/vehicles/{id}/command/set_bioweapon_mode

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{"on":"boolean","manual_override":"boolean"}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_bioweapon_mode' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({
    +   "on": "boolean",
    +   "manual_override": "boolean"
    +});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_bioweapon_mode", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_bioweapon_mode")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({
    +   "on": "boolean",
    +   "manual_override": "boolean"
    +})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({
    +   "on": "boolean",
    +   "manual_override": "boolean"
    +})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/set_bioweapon_mode", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Turns Bioweapon Defense Mode on and off.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    onbodybooleanYes
    manual_overridebodybooleanYes
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    set_cabin_overheat_protection

    +

    POST /api/1/vehicles/{id}/command/set_cabin_overheat_protection

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{"on":"boolean","fan_only":"boolean"}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_cabin_overheat_protection' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({
    +   "on": "boolean",
    +   "fan_only": "boolean"
    +});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_cabin_overheat_protection", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_cabin_overheat_protection")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({
    +   "on": "boolean",
    +   "fan_only": "boolean"
    +})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({
    +   "on": "boolean",
    +   "fan_only": "boolean"
    +})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/set_cabin_overheat_protection", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Sets the vehicle overheat protection.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    onbodybooleanYes
    fan_onlybodybooleanYes
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    set_charge_limit

    +

    POST /api/1/vehicles/{id}/command/set_charge_limit

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{"percent":"integer"}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_charge_limit' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({
    +   "percent": "integer"
    +});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_charge_limit", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_charge_limit")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({
    +   "percent": "integer"
    +})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({
    +   "percent": "integer"
    +})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/set_charge_limit", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Sets the vehicle charge limit.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    percentbodyintegerYes
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    set_charging_amps

    +

    POST /api/1/vehicles/{id}/command/set_charging_amps

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{"charging_amps":"integer"}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_charging_amps' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({
    +   "charging_amps": "integer"
    +});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_charging_amps", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_charging_amps")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({
    +   "charging_amps": "integer"
    +})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({
    +   "charging_amps": "integer"
    +})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/set_charging_amps", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Sets the vehicle charging amps.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    charging_ampsbodyintegerYes
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    set_climate_keeper_mode

    +

    POST /api/1/vehicles/{id}/command/set_climate_keeper_mode

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{"climate_keeper_mode":"integer"}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_climate_keeper_mode' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({
    +   "climate_keeper_mode": "integer"
    +});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_climate_keeper_mode", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_climate_keeper_mode")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({
    +   "climate_keeper_mode": "integer"
    +})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({
    +   "climate_keeper_mode": "integer"
    +})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/set_climate_keeper_mode", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Enables climate keeper mode.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    climate_keeper_modebodyintegerYes
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    set_cop_temp

    +

    POST /api/1/vehicles/{id}/command/set_cop_temp

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{"cop_temp":"integer"}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_cop_temp' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({
    +   "cop_temp": "integer"
    +});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_cop_temp", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_cop_temp")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({
    +   "cop_temp": "integer"
    +})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({
    +   "cop_temp": "integer"
    +})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/set_cop_temp", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Adjusts the Cabin Overheat Protection temperature.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    cop_tempbodyintegerYes
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    set_managed_charge_current_request

    +

    POST /api/1/vehicles/{id}/command/set_managed_charge_current_request

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_managed_charge_current_request' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_managed_charge_current_request", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_managed_charge_current_request")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/set_managed_charge_current_request", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Sets the desired managed AC charging current (in amps).

    +

    Parameters

    + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    set_managed_charger_location

    +

    POST /api/1/vehicles/{id}/command/set_managed_charger_location

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_managed_charger_location' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_managed_charger_location", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_managed_charger_location")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/set_managed_charger_location", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Sets the latitude and longitude coordinates of the location where managed AC charging should be active.

    +

    Parameters

    + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    set_managed_scheduled_charging_time

    +

    POST /api/1/vehicles/{id}/command/set_managed_scheduled_charging_time

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_managed_scheduled_charging_time' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_managed_scheduled_charging_time", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_managed_scheduled_charging_time")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/set_managed_scheduled_charging_time", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Sets a time at which managed AC charging should start.

    +

    Parameters

    + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    set_pin_to_drive

    +

    POST /api/1/vehicles/{id}/command/set_pin_to_drive

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{"on":"boolean","password":"string"}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_pin_to_drive' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({
    +   "on": "boolean",
    +   "password": "string"
    +});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_pin_to_drive", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_pin_to_drive")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({
    +   "on": "boolean",
    +   "password": "string"
    +})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({
    +   "on": "boolean",
    +   "password": "string"
    +})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/set_pin_to_drive", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Sets a four-digit passcode for PIN to Drive. This PIN must then be entered before the vehicle can be driven.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    onbodybooleanYes
    passwordbodystringYes
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    set_preconditioning_max

    +

    POST /api/1/vehicles/{id}/command/set_preconditioning_max

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{"on":"boolean","manual_override":"boolean"}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_preconditioning_max' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({
    +   "on": "boolean",
    +   "manual_override": "boolean"
    +});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_preconditioning_max", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_preconditioning_max")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({
    +   "on": "boolean",
    +   "manual_override": "boolean"
    +})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({
    +   "on": "boolean",
    +   "manual_override": "boolean"
    +})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/set_preconditioning_max", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Sets an override for preconditioning — it should default to empty if no override is used.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    onbodybooleanYes
    manual_overridebodybooleanYes
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    set_scheduled_charging

    +

    POST /api/1/vehicles/{id}/command/set_scheduled_charging

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{"enable":"boolean","time":"integer"}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_scheduled_charging' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({
    +   "enable": "boolean",
    +   "time": "integer"
    +});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_scheduled_charging", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_scheduled_charging")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({
    +   "enable": "boolean",
    +   "time": "integer"
    +})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({
    +   "enable": "boolean",
    +   "time": "integer"
    +})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/set_scheduled_charging", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Sets a time at which managed AC charging should start.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    enablebodybooleanYes
    timebodyintegerYes
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    set_scheduled_departure

    +

    POST /api/1/vehicles/{id}/command/set_scheduled_departure

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{"enable":"boolean","time":"integer"}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_scheduled_departure' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({
    +   "enable": "boolean",
    +   "time": "integer"
    +});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_scheduled_departure", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_scheduled_departure")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({
    +   "enable": "boolean",
    +   "time": "integer"
    +})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({
    +   "enable": "boolean",
    +   "time": "integer"
    +})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/set_scheduled_departure", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Sets a time at which charging should be completed.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    enablebodybooleanYes
    timebodyintegerYes
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    set_sentry_mode

    +

    POST /api/1/vehicles/{id}/command/set_sentry_mode

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{"on":"boolean"}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_sentry_mode' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({
    +   "on": "boolean"
    +});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_sentry_mode", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_sentry_mode")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({
    +   "on": "boolean"
    +})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({
    +   "on": "boolean"
    +})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/set_sentry_mode", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Enables and disables Sentry Mode. Sentry Mode allows customers to watch the vehicle cameras live from the mobile app, as well as record sentry events.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    onbodybooleanYes
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    set_temps

    +

    POST /api/1/vehicles/{id}/command/set_temps

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{"driver_temp":"integer","passenger_temp":"integer"}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_temps' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({
    +   "driver_temp": "integer",
    +   "passenger_temp": "integer"
    +});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_temps", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_temps")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({
    +   "driver_temp": "integer",
    +   "passenger_temp": "integer"
    +})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({
    +   "driver_temp": "integer",
    +   "passenger_temp": "integer"
    +})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/set_temps", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Sets the driver and/or passenger-side cabin temperature (and other zones if sync is enabled).

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    driver_tempbodyintegerYes
    passenger_tempbodyintegerYes
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    set_valet_mode

    +

    POST /api/1/vehicles/{id}/command/set_valet_mode

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{"on":"boolean","password":"string"}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_valet_mode' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({
    +   "on": "boolean",
    +   "password": "string"
    +});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_valet_mode", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_valet_mode")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({
    +   "on": "boolean",
    +   "password": "string"
    +})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({
    +   "on": "boolean",
    +   "password": "string"
    +})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/set_valet_mode", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Turns on Valet Mode and sets a four-digit passcode that must then be entered to disable Valet Mode.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    onbodybooleanYes
    passwordbodystringYes
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    set_vehicle_name

    +

    POST /api/1/vehicles/{id}/command/set_vehicle_name

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{"vehicle_name":"string"}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_vehicle_name' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({
    +   "vehicle_name": "string"
    +});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_vehicle_name", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/set_vehicle_name")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({
    +   "vehicle_name": "string"
    +})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({
    +   "vehicle_name": "string"
    +})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/set_vehicle_name", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Changes the name of a vehicle.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    vehicle_namebodystringYes
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    speed_limit_activate

    +

    POST /api/1/vehicles/{id}/command/speed_limit_activate

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{"pin":"string"}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/speed_limit_activate' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({
    +   "pin": "string"
    +});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/speed_limit_activate", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/speed_limit_activate")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({
    +   "pin": "string"
    +})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({
    +   "pin": "string"
    +})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/speed_limit_activate", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Activates Speed Limit Mode with a four-digit PIN.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    pinbodystringYes
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    speed_limit_clear_pin

    +

    POST /api/1/vehicles/{id}/command/speed_limit_clear_pin

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{"pin":"string"}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/speed_limit_clear_pin' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({
    +   "pin": "string"
    +});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/speed_limit_clear_pin", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/speed_limit_clear_pin")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({
    +   "pin": "string"
    +})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({
    +   "pin": "string"
    +})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/speed_limit_clear_pin", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Deactivates Speed Limit Mode and resets the associated PIN.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    pinbodystringYes
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    speed_limit_deactivate

    +

    POST /api/1/vehicles/{id}/command/speed_limit_deactivate

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{"pin":"string"}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/speed_limit_deactivate' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({
    +   "pin": "string"
    +});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/speed_limit_deactivate", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/speed_limit_deactivate")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({
    +   "pin": "string"
    +})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({
    +   "pin": "string"
    +})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/speed_limit_deactivate", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Deactivates Speed Limit Mode.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    pinbodystringYes
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    speed_limit_set_limit

    +

    POST /api/1/vehicles/{id}/command/speed_limit_set_limit

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{"limit_mph":"integer"}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/speed_limit_set_limit' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({
    +   "limit_mph": "integer"
    +});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/speed_limit_set_limit", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/speed_limit_set_limit")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({
    +   "limit_mph": "integer"
    +})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({
    +   "limit_mph": "integer"
    +})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/speed_limit_set_limit", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Sets the maximum speed (in miles per hours) for Speed Limit Mode.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    limit_mphbodyintegerYes
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    sun_roof_control

    +

    POST /api/1/vehicles/{id}/command/sun_roof_control

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{"state":"string"}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/sun_roof_control' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({
    +   "state": "string"
    +});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/sun_roof_control", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/sun_roof_control")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({
    +   "state": "string"
    +})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({
    +   "state": "string"
    +})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/sun_roof_control", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Control the sunroof on sunroof-enabled vehicles.\n\nSupported states: stop, close, and vent.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    statebodystringYes
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    take_drivenote

    +

    POST /api/1/vehicles/{id}/command/take_drivenote

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{"note":"string"}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/take_drivenote' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({
    +   "note": "string"
    +});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/take_drivenote", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/take_drivenote")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({
    +   "note": "string"
    +})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({
    +   "note": "string"
    +})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/take_drivenote", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Records a drive note. The note parameter is truncated to 80 characters in length.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    notebodystringYes
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +
    +

    POST /api/1/vehicles/{id}/command/trigger_homelink

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{"lat":null,"lon":null,"token":"string"}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/trigger_homelink' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({
    +   "lat": null,
    +   "lon": null,
    +   "token": "string"
    +});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/trigger_homelink", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/trigger_homelink")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({
    +   "lat": nil,
    +   "lon": nil,
    +   "token": "string"
    +})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({
    +   "lat": None,
    +   "lon": None,
    +   "token": "string"
    +})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/trigger_homelink", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Turns on HomeLink (used to open and close garage doors).

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    latbodyUnknownYes
    lonbodyUnknownYes
    tokenbodystringYes
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    update_calendar_entries

    +

    POST /api/1/vehicles/{id}/command/update_calendar_entries

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{"calendar_data":"string"}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/update_calendar_entries' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({
    +   "calendar_data": "string"
    +});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/update_calendar_entries", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/update_calendar_entries")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({
    +   "calendar_data": "string"
    +})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({
    +   "calendar_data": "string"
    +})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/update_calendar_entries", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Update the calendar entries stored on the vehicle.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    calendar_databodystringYes
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    window_control

    +

    POST /api/1/vehicles/{id}/command/window_control

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{"lat":null,"lon":null,"command":"string"}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/window_control' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({
    +   "lat": null,
    +   "lon": null,
    +   "command": "string"
    +});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/window_control", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/window_control")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({
    +   "lat": nil,
    +   "lon": nil,
    +   "command": "string"
    +})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({
    +   "lat": None,
    +   "lon": None,
    +   "command": "string"
    +})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/window_control", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Control the windows of a parked vehicle. Supported commands: vent and close. When closing, specify lat and lon of user to ensure they are within range of vehicle (unless this is an M3 platform vehicle).

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    latbodyUnknownYes
    lonbodyUnknownYes
    commandbodystringYes
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +

    Vehicle Endpoints

    list

    +

    GET /api/1/vehicles

    + +

    scopes: vehicle_device_data

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const requestOptions = {
    +   method: 'GET',
    +   headers: myHeaders,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Get.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = ''
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("GET", "/api/1/vehicles", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    pagequeryintegerNopage number
    per_pagequeryintegerNoquantity per page
    +
    Click to view successful response[ + { + "id": 100021, + "vehicle_id": 99999, + "vin": "TEST00000000VIN01", + "color": null, + "access_type": "OWNER", + "display_name": "Owned", + "option_codes": "TEST0,COUS", + "granular_access": { + "hide_private": false + }, + "tokens": [ + "4f993c5b9e2b937b", + "7a3153b1bbb48a96" + ], + "state": null, + "in_service": false, + "id_s": "100021", + "calendar_enabled": true, + "api_version": null, + "backseat_token": null, + "backseat_token_updated_at": null + } +] +

    mobile_enabled

    +

    GET /api/1/vehicles/{id}/mobile_enabled

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/mobile_enabled' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const requestOptions = {
    +   method: 'GET',
    +   headers: myHeaders,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/mobile_enabled", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/mobile_enabled")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Get.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = ''
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("GET", "/api/1/vehicles/{id}/mobile_enabled", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Returns whether or not mobile access is enabled for the vehicle.

    +

    Parameters

    + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    +
    Click to view successful response{ + "reason": "", + "result": true +} +

    nearby_charging_sites

    +

    GET /api/1/vehicles/{id}/nearby_charging_sites

    + +

    scopes: vehicle_device_data

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/nearby_charging_sites' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const requestOptions = {
    +   method: 'GET',
    +   headers: myHeaders,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/nearby_charging_sites", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/nearby_charging_sites")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Get.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = ''
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("GET", "/api/1/vehicles/{id}/nearby_charging_sites", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Returns the charging sites near the current location of the vehicle.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    countqueryintegerNoreturn quantity
    radiusqueryintegerNoradius in miles
    detailquerybooleanNoinclude site detail
    +
    Click to view successful response{ + "congestion_sync_time_utc_secs": 1693588513, + "destination_charging": [ + { + "location": { + "lat": 37.409314, + "long": -122.123068 + }, + "name": "Hilton Garden Inn Palo Alto", + "type": "destination", + "distance_miles": 1.35024, + "amenities": "restrooms,wifi,lodging" + }, + { + "location": { + "lat": 37.407771, + "long": -122.120076 + }, + "name": "Dinah's Garden Hotel & Poolside Restaurant", + "type": "destination", + "distance_miles": 1.534213, + "amenities": "restrooms,restaurant,wifi,cafe,lodging" + } + ], + "superchargers": [ + { + "location": { + "lat": 37.399071, + "long": -122.111216 + }, + "name": "Los Altos, CA", + "type": "supercharger", + "distance_miles": 2.202902, + "available_stalls": 12, + "total_stalls": 16, + "site_closed": false, + "amenities": "restrooms,restaurant,wifi,cafe,shopping", + "billing_info": "" + }, + { + "location": { + "lat": 37.441734, + "long": -122.170202 + }, + "name": "Palo Alto, CA - Stanford Shopping Center", + "type": "supercharger", + "distance_miles": 2.339135, + "available_stalls": 11, + "total_stalls": 20, + "site_closed": false, + "amenities": "restrooms,restaurant,wifi,cafe,shopping", + "billing_info": "" + } + ], + "timestamp": 1693588576552 +} +

    service_data

    +

    GET /api/1/vehicles/{id}/service_data

    + +

    scopes: vehicle_device_data

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/service_data' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const requestOptions = {
    +   method: 'GET',
    +   headers: myHeaders,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/service_data", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/service_data")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Get.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = ''
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("GET", "/api/1/vehicles/{id}/service_data", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Fetches information about the service status of the vehicle.

    +

    Parameters

    + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    +
    Click to view successful response{ + "service_status": "in_service", + "service_etc": "2023-05-02T17:10:53-10:00", + "service_visit_number": "SV12345678", + "status_id": 8 +} +

    share_invites

    +

    GET /api/1/vehicles/{vehicle_id}/invitations

    + +

    scopes: vehicle_device_data, vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_id}/invitations' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const requestOptions = {
    +   method: 'GET',
    +   headers: myHeaders,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_id}/invitations", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_id}/invitations")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Get.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = ''
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("GET", "/api/1/vehicles/{vehicle_id}/invitations", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Returns the active share invites for a vehicle.

    +

    Parameters

    + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    vehicle_idpathstringYesvehicle_id
    +
    Click to view successful response[ + { + "id": 429509621657, + "owner_id": 429511308124, + "share_user_id": null, + "product_id": "TEST00000000VIN01", + "state": "pending", + "code": "aqwl4JHU2q4aTeNROz8W9SpngoFvj-ReuDFIJs6-YOhA", + "expires_at": "2023-06-29T00:42:00.000Z", + "revoked_at": null, + "borrowing_device_id": null, + "key_id": null, + "product_type": "vehicle", + "share_type": "customer", + "active_pubkeys": [ + null + ], + "id_s": "429509621657", + "owner_id_s": "429511308124", + "share_user_id_s": "", + "borrowing_key_hash": null, + "vin": "TEST00000000VIN01", + "share_link": "https://www.tesla.com/_rs/1/aqwl4JHU2q4aTeNROz8W9SpngoFvj-ReuDFIJs6-YOhA" + } +] +

    share_invites create

    +

    POST /api/1/vehicles/{vehicle_id}/invitations

    + +

    scopes: vehicle_cmds

    +
    curl --request POST \
    +  --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_id}/invitations' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_id}/invitations", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_id}/invitations")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = ''
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{vehicle_id}/invitations", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +
      +
    • Each invite link is for single-use and expires after 24 hours.
    • +
    • An account that uses the invite will gain Tesla app access to the vehicle, which allows it to do the following: +
        +
      • View the live location of the vehicle.
      • +
      • Send remote commands.
      • +
      • Download the user's Tesla profile to the vehicle.
      • +
      +
    • +
    • To remove access, use the revoke API.
    • +
    • If a user does not have the Tesla app installed, they will be directed to this webpage for guidance.
    • +
    • A user can set up their phone as key with the Tesla app when in proximity of the vehicle.
    • +
    • The app access provides DRIVER privileges, which do not encompass all OWNER features.
    • +
    • Up to five drivers can be added at a time .
    • +
    • This API does not require the car to be online.
    • +
    +

    Parameters

    + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    vehicle_idpathstringYesvehicle_id
    +
    Click to view successful response{ + "id": 429509621657, + "owner_id": 429511308124, + "share_user_id": null, + "product_id": "TEST00000000VIN01", + "state": "pending", + "code": "aqwl4JHU2q4aTeNROz8W9SpngoFvj-ReuDFIJs6-YOhA", + "expires_at": "2023-06-29T00:42:00.000Z", + "revoked_at": null, + "borrowing_device_id": null, + "key_id": null, + "product_type": "vehicle", + "share_type": "customer", + "active_pubkeys": [ + null + ], + "id_s": "429509621657", + "owner_id_s": "429511308124", + "share_user_id_s": "", + "borrowing_key_hash": null, + "vin": "TEST00000000VIN01", + "share_link": "https://www.tesla.com/_rs/1/aqwl4JHU2q4aTeNROz8W9SpngoFvj-ReuDFIJs6-YOhA" +} +

    share_invites revoke

    +

    POST /api/1/vehicles/{vehicle_id}/invitations/{id}/revoke

    + +

    scopes: vehicle_cmds

    +
    curl --request POST \
    +  --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_id}/invitations/{id}/revoke' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_id}/invitations/{id}/revoke", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_id}/invitations/{id}/revoke")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = ''
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{vehicle_id}/invitations/{id}/revoke", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Revokes a share invite. This invalidates the share and makes the link invalid.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    vehicle_idpathstringYesvehicle_id
    idpathstringYesid of share_invite to revoke
    +
    Click to view successful responsetrue +

    subscriptions

    +

    GET /api/1/subscriptions

    + +

    scopes: user_data

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/subscriptions' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const requestOptions = {
    +   method: 'GET',
    +   headers: myHeaders,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/subscriptions", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/subscriptions")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Get.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = ''
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("GET", "/api/1/subscriptions", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Returns the list of vehicles for which this mobile device currently subscribes to push notifications

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    device_tokenquerystringNoEither an APNS device token or a GCM registration id
    device_typequerystringNoOne of 'android', 'ios-development', 'ios-enterprise', 'ios-beta', 'ios-production'
    +

    subscriptions set

    +

    POST /api/1/subscriptions

    + +

    scopes: user_data

    +
    curl --request POST \
    +  --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/subscriptions' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/subscriptions", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/subscriptions")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = ''
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/subscriptions", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Allows a mobile device to specify which vehicles to receive push notifications from. When calling from a mobile device, it is sufficient to only provide the vehicle IDs to which the mobile device wishes to subscribe to.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    device_tokenquerystringNoEither an APNS device token or a GCM registration id
    device_typequerystringNoOne of 'android', 'ios-development', 'ios-enterprise', 'ios-beta', 'ios-production'
    +

    vehicle

    +

    GET /api/1/vehicles/{id}

    + +

    scopes: vehicle_device_data

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const requestOptions = {
    +   method: 'GET',
    +   headers: myHeaders,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Get.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = ''
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("GET", "/api/1/vehicles/{id}", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Returns information about a vehicle.

    +

    Parameters

    + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    +
    Click to view successful response{ + "id": 100021, + "vehicle_id": 99999, + "vin": "TEST00000000VIN01", + "color": null, + "access_type": "OWNER", + "display_name": "Owned", + "option_codes": "TEST0,COUS", + "granular_access": { + "hide_private": false + }, + "tokens": [ + "4f993c5b9e2b937b", + "7a3153b1bbb48a96" + ], + "state": null, + "in_service": false, + "id_s": "100021", + "calendar_enabled": true, + "api_version": null, + "backseat_token": null, + "backseat_token_updated_at": null +} +

    vehicle_data

    +

    GET /api/1/vehicles/{id}/vehicle_data

    + +

    scopes: vehicle_device_data

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/vehicle_data' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const requestOptions = {
    +   method: 'GET',
    +   headers: myHeaders,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/vehicle_data", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/vehicle_data")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Get.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = ''
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("GET", "/api/1/vehicles/{id}/vehicle_data", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Makes a live call to the vehicle. This may return cached data if the vehicle is offline.

    +

    Parameters

    + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    +
    Click to view successful response{ + "id": 100021, + "user_id": 800001, + "vehicle_id": 99999, + "vin": "TEST00000000VIN01", + "color": null, + "access_type": "OWNER", + "granular_access": { + "hide_private": false + }, + "tokens": [ + "4f993c5b9e2b937b", + "7a3153b1bbb48a96" + ], + "state": null, + "in_service": false, + "id_s": "100021", + "calendar_enabled": true, + "api_version": 54, + "backseat_token": null, + "backseat_token_updated_at": null, + "charge_state": { + "battery_heater_on": false, + "battery_level": 42, + "battery_range": 133.99, + "charge_amps": 48, + "charge_current_request": 48, + "charge_current_request_max": 48, + "charge_enable_request": true, + "charge_energy_added": 48.45, + "charge_limit_soc": 90, + "charge_limit_soc_max": 100, + "charge_limit_soc_min": 50, + "charge_limit_soc_std": 90, + "charge_miles_added_ideal": 202, + "charge_miles_added_rated": 202, + "charge_port_cold_weather_mode": false, + "charge_port_color": "<invalid>", + "charge_port_door_open": false, + "charge_port_latch": "Engaged", + "charge_rate": 0, + "charger_actual_current": 0, + "charger_phases": null, + "charger_pilot_current": 48, + "charger_power": 0, + "charger_voltage": 2, + "charging_state": "Disconnected", + "conn_charge_cable": "<invalid>", + "est_battery_range": 143.88, + "fast_charger_brand": "<invalid>", + "fast_charger_present": false, + "fast_charger_type": "<invalid>", + "ideal_battery_range": 133.99, + "managed_charging_active": false, + "managed_charging_start_time": null, + "managed_charging_user_canceled": false, + "max_range_charge_counter": 0, + "minutes_to_full_charge": 0, + "not_enough_power_to_heat": null, + "off_peak_charging_enabled": false, + "off_peak_charging_times": "all_week", + "off_peak_hours_end_time": 360, + "preconditioning_enabled": false, + "preconditioning_times": "all_week", + "scheduled_charging_mode": "Off", + "scheduled_charging_pending": false, + "scheduled_charging_start_time": null, + "scheduled_departure_time": 1634914800, + "scheduled_departure_time_minutes": 480, + "supercharger_session_trip_planner": false, + "time_to_full_charge": 0, + "timestamp": 1692141038420, + "trip_charging": false, + "usable_battery_level": 42, + "user_charge_enable_request": null + }, + "climate_state": { + "allow_cabin_overheat_protection": true, + "auto_seat_climate_left": false, + "auto_seat_climate_right": false, + "auto_steering_wheel_heat": false, + "battery_heater": false, + "battery_heater_no_power": null, + "bioweapon_mode": false, + "cabin_overheat_protection": "On", + "cabin_overheat_protection_actively_cooling": true, + "climate_keeper_mode": "off", + "cop_activation_temperature": "High", + "defrost_mode": 0, + "driver_temp_setting": 21, + "fan_status": 0, + "hvac_auto_request": "On", + "inside_temp": 38.4, + "is_auto_conditioning_on": true, + "is_climate_on": false, + "is_front_defroster_on": false, + "is_preconditioning": false, + "is_rear_defroster_on": false, + "left_temp_direction": -293, + "max_avail_temp": 28, + "min_avail_temp": 15, + "outside_temp": 36.5, + "passenger_temp_setting": 21, + "remote_heater_control_enabled": false, + "right_temp_direction": -276, + "seat_heater_left": 0, + "seat_heater_rear_center": 0, + "seat_heater_rear_left": 0, + "seat_heater_rear_right": 0, + "seat_heater_right": 0, + "side_mirror_heaters": false, + "steering_wheel_heat_level": 0, + "steering_wheel_heater": false, + "supports_fan_only_cabin_overheat_protection": true, + "timestamp": 1692141038419, + "wiper_blade_heater": false + }, + "drive_state": { + "active_route_latitude": 37.7765494, + "active_route_longitude": -122.4195418, + "active_route_traffic_minutes_delay": 0, + "gps_as_of": 1692137422, + "heading": 289, + "latitude": 37.7765494, + "longitude": -122.4195418, + "native_latitude": 37.7765494, + "native_location_supported": 1, + "native_longitude": -122.4195418, + "native_type": "wgs", + "power": 1, + "shift_state": null, + "speed": null, + "timestamp": 1692141038420 + }, + "gui_settings": { + "gui_24_hour_time": false, + "gui_charge_rate_units": "mi/hr", + "gui_distance_units": "mi/hr", + "gui_range_display": "Rated", + "gui_temperature_units": "F", + "gui_tirepressure_units": "Psi", + "show_range_units": false, + "timestamp": 1692141038420 + }, + "vehicle_config": { + "aux_park_lamps": "NaPremium", + "badge_version": 0, + "can_accept_navigation_requests": true, + "can_actuate_trunks": true, + "car_special_type": "base", + "car_type": "modely", + "charge_port_type": "US", + "cop_user_set_temp_supported": true, + "dashcam_clip_save_supported": true, + "default_charge_to_max": false, + "driver_assist": "TeslaAP3", + "ece_restrictions": false, + "efficiency_package": "MY2021", + "eu_vehicle": false, + "exterior_color": "MidnightSilver", + "exterior_trim": "Black", + "exterior_trim_override": "", + "has_air_suspension": false, + "has_ludicrous_mode": false, + "has_seat_cooling": false, + "headlamp_type": "Premium", + "interior_trim_type": "Black2", + "key_version": 2, + "motorized_charge_port": true, + "paint_color_override": "19,20,22,0.8,0.04", + "performance_package": "Base", + "plg": true, + "pws": true, + "rear_drive_unit": "PM216MOSFET", + "rear_seat_heaters": 1, + "rear_seat_type": 0, + "rhd": false, + "roof_color": "RoofColorGlass", + "seat_type": null, + "spoiler_type": "None", + "sun_roof_installed": null, + "supports_qr_pairing": false, + "third_row_seats": "None", + "timestamp": 1692141038420, + "trim_badging": "74d", + "use_range_badging": true, + "utc_offset": -25200, + "webcam_selfie_supported": true, + "webcam_supported": true, + "wheel_type": "Apollo19" + }, + "vehicle_state": { + "api_version": 54, + "autopark_state_v3": "ready", + "autopark_style": "dead_man", + "calendar_supported": true, + "car_version": "2023.7.20 7910d26d5c64", + "center_display_state": 0, + "dashcam_clip_save_available": false, + "dashcam_state": "Unavailable", + "df": 0, + "dr": 0, + "fd_window": 0, + "feature_bitmask": "15dffbff,0", + "fp_window": 0, + "ft": 0, + "homelink_device_count": 3, + "homelink_nearby": false, + "is_user_present": false, + "last_autopark_error": "no_error", + "locked": true, + "media_info": { + "a2dp_source_name": "Pixel 6", + "audio_volume": 2.6667, + "audio_volume_increment": 0.333333, + "audio_volume_max": 10.333333, + "media_playback_status": "Playing", + "now_playing_album": "KQED", + "now_playing_artist": "PBS Newshour on KQED FM", + "now_playing_duration": 0, + "now_playing_elapsed": 0, + "now_playing_source": "13", + "now_playing_station": "88.5 FM KQED", + "now_playing_title": "PBS Newshour" + }, + "media_state": { + "remote_control_enabled": true + }, + "notifications_supported": true, + "odometer": 15720.074889, + "parsed_calendar_supported": true, + "pf": 0, + "pr": 0, + "rd_window": 0, + "remote_start": false, + "remote_start_enabled": true, + "remote_start_supported": true, + "rp_window": 0, + "rt": 0, + "santa_mode": 0, + "sentry_mode": false, + "sentry_mode_available": true, + "service_mode": false, + "service_mode_plus": false, + "smart_summon_available": true, + "software_update": { + "download_perc": 0, + "expected_duration_sec": 2700, + "install_perc": 1, + "status": "", + "version": " " + }, + "speed_limit_mode": { + "active": false, + "current_limit_mph": 85, + "max_limit_mph": 120, + "min_limit_mph": 50, + "pin_code_set": false + }, + "summon_standby_mode_enabled": false, + "timestamp": 1692141038419, + "tpms_hard_warning_fl": false, + "tpms_hard_warning_fr": false, + "tpms_hard_warning_rl": false, + "tpms_hard_warning_rr": false, + "tpms_last_seen_pressure_time_fl": 1692136878, + "tpms_last_seen_pressure_time_fr": 1692136878, + "tpms_last_seen_pressure_time_rl": 1692136878, + "tpms_last_seen_pressure_time_rr": 1692136878, + "tpms_pressure_fl": 3.1, + "tpms_pressure_fr": 3.1, + "tpms_pressure_rl": 3.15, + "tpms_pressure_rr": 3, + "tpms_rcp_front_value": 2.9, + "tpms_rcp_rear_value": 2.9, + "tpms_soft_warning_fl": false, + "tpms_soft_warning_fr": false, + "tpms_soft_warning_rl": false, + "tpms_soft_warning_rr": false, + "valet_mode": false, + "valet_pin_needed": true, + "vehicle_name": "grADOFIN", + "vehicle_self_test_progress": 0, + "vehicle_self_test_requested": false, + "webcam_available": true + } +} +

    vehicle_subscriptions

    +

    GET /api/1/vehicle_subscriptions

    + +

    scopes: user_data

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicle_subscriptions' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const requestOptions = {
    +   method: 'GET',
    +   headers: myHeaders,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicle_subscriptions", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicle_subscriptions")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Get.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = ''
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("GET", "/api/1/vehicle_subscriptions", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Returns the list of vehicles for which this mobile device currently subscribes to push notifications.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    device_tokenquerystringNoEither an APNS device token or a GCM registration id
    device_typequerystringNoOne of 'android', 'ios-development', 'ios-enterprise', 'ios-beta', 'ios-production'
    +
    Click to view successful response[ + 100021 +] +

    vehicle_subscriptions set

    +

    POST /api/1/vehicle_subscriptions

    + +

    scopes: user_data

    +
    curl --request POST \
    +  --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicle_subscriptions' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicle_subscriptions", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicle_subscriptions")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = ''
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicle_subscriptions", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Allows a mobile device to specify which vehicles to receive push notifications from. It is sufficient to only provide the vehicle IDs to which a mobile device wishes to subscribe to.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    device_tokenquerystringNoEither an APNS device token or a GCM registration id
    device_typequerystringNoOne of 'android', 'ios-development', 'ios-enterprise', 'ios-beta', 'ios-production'
    +
    Click to view successful response[] +

    wake_up

    +

    POST /api/1/vehicles/{id}/wake_up

    + +

    scopes: vehicle_device_data

    +
    curl --request POST \
    +  --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/wake_up' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/wake_up", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/wake_up")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = ''
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/wake_up", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Wakes the vehicle from sleep, which is a state to minimize idle energy consumption.

    +

    Parameters

    + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    +
    Click to view successful response{ + "id": 100021, + "user_id": 800001, + "vehicle_id": 99999, + "vin": "TEST00000000VIN01", + "color": null, + "access_type": "OWNER", + "granular_access": { + "hide_private": false + }, + "tokens": [ + "4f993c5b9e2b937b", + "7a3153b1bbb48a96" + ], + "state": null, + "in_service": false, + "id_s": "100021", + "calendar_enabled": true, + "api_version": null, + "backseat_token": null, + "backseat_token_updated_at": null +} +

    warranty_details

    +

    GET /api/1/dx/warranty/details

    + +

    scopes: vehicle_device_data

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/dx/warranty/details' 
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const requestOptions = {
    +   method: 'GET',
    +   headers: myHeaders,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/dx/warranty/details", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/dx/warranty/details")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Get.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = ''
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("GET", "/api/1/dx/warranty/details", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Returns the warranty information for a vehicle.

    +

    Parameters

    + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    vinquerystringNoVehicle vin
    +
    Click to view successful response{ + "activeWarranty": [ + { + "warrantyType": "NEW_MFG_WARRANTY", + "warrantyDisplayName": "Basic Vehicle Limited Warranty", + "expirationDate": "2025-10-21T00:00:00Z", + "expirationOdometer": 50000, + "odometerUnit": "MI", + "warrantyExpiredOn": null, + "coverageAgeInYears": 4 + }, + { + "warrantyType": "BATTERY_WARRANTY", + "warrantyDisplayName": "Battery Limited Warranty", + "expirationDate": "2029-10-21T00:00:00Z", + "expirationOdometer": 120000, + "odometerUnit": "MI", + "warrantyExpiredOn": null, + "coverageAgeInYears": 8 + }, + { + "warrantyType": "DRIVEUNIT_WARRANTY", + "warrantyDisplayName": "Drive Unit Limited Warranty", + "expirationDate": "2029-10-21T00:00:00Z", + "expirationOdometer": 120000, + "odometerUnit": "MI", + "warrantyExpiredOn": null, + "coverageAgeInYears": 8 + } + ], + "upcomingWarranty": [], + "expiredWarranty": [] +} +

    FAQ

    +

    +Why do some calls return a 429? +

    + +

    This means the account has reached the request rate limit for the endpoint. Check the 'Retry-After' request header (in seconds) to determine when to make the next request. See more information on response codes.

    + +

    +Why do some calls to vehicles return a 408? +

    + +

    This tends to mean the device is offline. Does the device have internet connectivity? If so, is it asleep (saving energy) in which case might need to wake it up ?

    + +

    +What does it mean when I get an Unauthorized missing scopes 403 error? +

    + +

    The token that is being provided does not have the required scopes for the current resource. Look at the scopes requirements for the endpoint and ensure the token has those scopes. If the token is not created with the required scopes, it means the owner needs to explicity grant the required scope(s) as part of the authorization flow.

    +

    Fleet Telemetry

    +

    For high data fidelity use cases as well as general efficiency, vehicles can stream directly to your server. See account tier information at https://developer.tesla.com, and the setup steps on the open-source server: https://github.com/teslamotors/fleet-telemetry.

    + +

    As part of the discovery offering, developers can get limited Fleet Telemetry access to stream up to 10 fields per minute. See compatibility requirements here.

    +

    Announcements & API Changelog

    2023-10-09: Rest API vehicle commands endpoint - deprecation warning

    +

    Following the release of Tesla Vehicle Command SDK support for REST API vehicle command endpoints is now reaching end of life. Starting 2024 most vehicles will require sending commands via Tesla Vehicle Command SDK.

    + +

    The use of Tesla http proxy is recommended for ease of development and to accelerate the transition to Tesla Vehicle Command (via SDK). When applicable, the proxy will transform Rest API HTTP commands into signed commands. Once configured, developers can simply point their application to the proxy without making any code changes to their application.

    +

    2023-10-09: Tesla Vehicle Command SDK

    +

    Tesla Vehicle Command SDK provides end-to-end authentication for sending commands to vehicles. This is the recommended way of sending commands to vehicles.

    + +

    Security experts are encouraged to dive more into the protocol and give feedback on Github. To report a security issue, follow the directions on https://www.tesla.com/legal/security.

    +

    Help and Support

    +

    Email fleetapisupport@tesla.com for developer support. Please include a description of your use case, and any example logs or curl statements, and include server responses.

    + +

    Please make sure NOT to share any API token, OauthToken, or any credentials via email. Tesla does not need passwords or tokens to help diagnose a potential issue.

    + + +
    +
    + +
    +
    +
    + +
    +
    + + + + + + + diff --git a/scrape_fleet_api/src/main.rs b/scrape_fleet_api/src/main.rs new file mode 100644 index 0000000..bc26987 --- /dev/null +++ b/scrape_fleet_api/src/main.rs @@ -0,0 +1,425 @@ +use clap::{Command, Parser}; +use scraper::{Element, ElementRef, Html, Selector}; +use std::collections::HashMap; +use std::path::{Path, PathBuf}; +use std::str::FromStr; + +#[derive(Parser, Debug)] +#[clap(author, version)] +struct Cli { + /// Only use the cached html to avoid making a request. + #[clap(short, long)] + cache: bool, +} + +#[tokio::main] +async fn main() { + tracing_subscriber::fmt::init(); + let args = Cli::parse(); + + let html = get_and_save_html(&args).await; + + let fleet_api = parse(&html); +} + +async fn get_and_save_html(args: &Cli) -> String { + // Write to where this project root is, not in the parent project. + let mut path = PathBuf::new(); + path.push(env!("CARGO_MANIFEST_DIR")); + path.push("fleet.html"); + + if args.cache { + return std::fs::read_to_string(path).unwrap(); + } + + let response = reqwest::get("https://developer.tesla.com/docs/fleet-api") + .await + .unwrap(); + + let html = response.text().await.unwrap(); + + std::fs::write(path, &html).unwrap(); + + html +} + +struct FleetApiSpec { + calls: HashMap, +} + +// e.g. serialize to similar: vehicle-endpoints +#[derive(Debug, strum::EnumString)] +#[strum(serialize_all = "kebab-case")] +enum Category { + ChargingEndpoints, + PartnerEndpoints, + UserEndpoints, + VehicleCommands, + VehicleEndpoints, +} + +/* +Profile Information user_data Contact information, home address, profile picture, and referral information +Vehicle Information vehicle_device_data Vehicle live data, location, eligible upgrades, nearby superchargers, ownership, and service scheduling data +Vehicle Commands vehicle_cmds Commands like add/remove driver, access Live Camera, unlock, wake up, remote start, and schedule software updates +Vehicle Charging Management vehicle_charging_cmds Vehicle charging history, billed amount, charging location, commands to schedule, and start/stop charging +Energy Product Information energy_device_data Energy flow history, saving forecast, tariff rates, grid import, calendar, site status, time of use, and ownership +Energy Product Commands energy_cmds Commands like update storm mode + */ + +#[derive(Debug, strum::EnumString)] +#[strum(serialize_all = "snake_case")] +enum Scope { + /// Profile Information + /// + /// Contact information, home address, profile picture, and referral information. + UserData, + + /// Vehicle Information + /// + /// Vehicle live data, location, eligible upgrades, nearby superchargers, ownership, and service scheduling data. + VehicleDeviceData, + + /// Vehicle Commands + /// + /// Commands like add/remove driver, access Live Camera, unlock, wake up, remote start, and schedule software updates. + VehicleCmds, + + /// Vehicle Charging Management + /// + /// Vehicle charging history, billed amount, charging location, commands to schedule, and start/stop charging. + VehicleChargingCmds, + + /// Energy Product Information + /// + /// Energy flow history, saving forecast, tariff rates, grid import, calendar, site status, time of use, and ownership. + EnergyDeviceData, + + /// Energy Product Commands + /// + /// Commands like update storm mode. + EnergyCmds, +} + +/* +Name In Type Required Description +vin query string No VIN +startTime query string No StartTime +endTime query string No EndTime + */ + +enum InRequestData { + Query, + Body, +} + +struct Parameter { + name: String, + request: InRequestData, + var_type: String, + required: bool, + description: String, +} + +struct Call { + name: String, + method: reqwest::Method, + url_definition: String, + description: String, + category: Category, + scopes: Vec, + parameters: Vec, + request_example: String, + response_example: String, +} + +/* +Example HTML docs for two calls: + + +

    Vehicle Commands

    actuate_trunk

    +

    POST /api/1/vehicles/{id}/command/actuate_trunk

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{"which_trunk":"string"}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/actuate_trunk'
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({
    +   "which_trunk": "string"
    +});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/actuate_trunk", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/actuate_trunk")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({
    +   "which_trunk": "string"
    +})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({
    +   "which_trunk": "string"
    +})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/actuate_trunk", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Controls the front (which_trunk: "front") or rear (which_trunk: "rear") trunk.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    which_trunkbodystringYes
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +
    + +

    adjust_volume

    +

    POST /api/1/vehicles/{id}/command/adjust_volume

    + +

    scopes: vehicle_cmds

    +
    curl --header 'Content-Type: application/json' \
    +  --header "Authorization: Bearer $TESLA_API_TOKEN" \
    +  --data '{"volume":"integer"}' \
    +  'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/adjust_volume'
    +
    const myHeaders = new Headers();
    +myHeaders.append("Content-Type", "application/json");
    +myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
    +
    +const body = JSON.stringify({
    +   "volume": "integer"
    +});
    +
    +const requestOptions = {
    +   method: 'POST',
    +   headers: myHeaders,
    +   body,
    +   redirect: 'follow'
    +};
    +
    +fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/adjust_volume", requestOptions)
    +   .then(response => response.json())
    +   .then(result => console.log(result))
    +   .catch(error => console.log('error', error));
    +
    require "uri"
    +require "json"
    +require "net/http"
    +
    +url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{id}/command/adjust_volume")
    +
    +https = Net::HTTP.new(url.host, url.port)
    +https.use_ssl = true
    +
    +request = Net::HTTP::Post.new(url)
    +request["Content-Type"] = "application/json"
    +request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
    +request.body = JSON.dump({
    +   "volume": "integer"
    +})
    +
    +response = https.request(request)
    +puts response.read_body
    +
    +
    import os
    +import http.client
    +import json
    +
    +conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
    +payload = json.dumps({
    +   "volume": "integer"
    +})
    +headers = {
    +   'Content-Type': 'application/json',
    +   'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
    +}
    +conn.request("POST", "/api/1/vehicles/{id}/command/adjust_volume", payload, headers)
    +res = conn.getresponse()
    +data = res.read()
    +print(data.decode("utf-8"))
    +
    +

    Adjusts vehicle media playback volume.

    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameInTypeRequiredDescription
    idpathintegerYesvehicle id
    volumebodyintegerYes
    +
    Click to view successful response{ + "result": true, + "reason": "" +} +
    + + */ + +fn parse(html: &str) -> FleetApiSpec { + let document = Html::parse_document(html); + let content_selector = selector(".content h1"); + let mut element = document.select(&content_selector).next().unwrap(); + let mut category = None; + + // Iterate over all the elements in the content section until we see a h1 or h2. + loop { + match element.value().name() { + "h1" => { + let category_name = element.value().id().unwrap(); + category = Category::from_str(&category_name).ok(); + } + "h2" => { + if category.is_some() { + let name = element.inner_html(); + println!("{category:?} {name:?}"); + // let call = parse_call(element); + } + } + _ => {} + } + + let Some(next_element) = element.next_sibling_element() else { + println!("exiting..."); + break; + }; + element = next_element; + } + + todo!() +} + +/// Return None if this is not an endpoint. +/// +/// Will panic if it looks like an endpoint and has trouble parsing. +fn parse_call(element: ElementRef) -> Option { + let name = element.value().id().unwrap(); + + //

    POST /api/1/vehicles/{id}/command/auto_conditioning_start

    + // This section determines if this is an endpoint or not. + let (fragment, element) = next(element); + let url = fragment.select(&selector("code")).next()?.inner_html(); + if !url.starts_with("GET ") && !url.starts_with("POST ") { + return None; + } + + let (method, url) = url.split_once(' ').unwrap(); + println!("{} {}", method, url); + + //

    scopes: vehicle_cmds

    + let (fragment, element) = next(element); + let scopes = fragment + .select(&selector("em")) + .map(|e| e.inner_html()) + .map(|e| Scope::from_str(&e)) + .collect::>(); + + // 4
    nodes containing example requests in different languages. + // TODO: Skip for now + let mut count = 0; + let mut element = element; + loop { + let (fragment, new_element) = next(element); + element = new_element; + if fragment + .select(&selector(r#"div[class="highlight"]"#)) + .next() + .is_none() + { + break; + } + + count += 1; + if count == 10 { + panic!("Too many examples"); + } + } + if count == 0 && name != "api-status" { + panic!("No examples for {}", name); + } + + None +} + +fn next(element: ElementRef) -> (Html, ElementRef) { + let element = element.next_sibling_element().unwrap(); + let html = Html::parse_fragment(&element.html()); + (html, element) +} + +fn selector(s: &str) -> Selector { + Selector::parse(s).unwrap() +}