-
-
Notifications
You must be signed in to change notification settings - Fork 535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invoices #539
Comments
Curious about this too. I've tried for days to get supercharging costs from the API but have not gotten anywhere. |
What headers are you sending? |
The BFF (backend-for-frontend) endpoints don't appear to authenticate the same way as the other vehicle endpoints do. I'd love to figure out what's going on here. Since they started obfuscating the JavaScript bundle in the app, it's gotten a little more difficult to figure out what the app is up to with these endpoints. I either need to packet sniff or just de-obfuscate the JS bundle, but we should probably focus a bit on figuring out how to call these endpoints. |
I've been able to packet sniff the app and I'll post that information here when I get a chance. Currently trying to packet sniff the actual car as well, but that's proving to be a little tricky so far. |
Through checking the HTTP requests on the app, I've been able to get Invoice data through:
The request is as follows:
Which in turn will return roughly the following response
I've only been able to view the request on the Tesla app. I'm still trying to figure out the header situation since I believe the If you are trying to get the actual PDF invoice instead, you can try:
Which takes the same headers as above. I do get a 401 when trying to make the request through a REST client, which I think may be related to this |
Any update on this? As there is no way to get my invoices (premium connectivity and supercharging) via mail, I’d like to access them via api… |
I'm also curious if you found anything here. If i were to guess, the secret is in the cookies. |
PDF invoices can be accessed with
The inconvenience is that you'd need to know the INVOICE_ID. |
thanks @idriskhenchil, we're still a bit stuck on getting the list of invoices. Presently getting back "Bad Request". Perhaps missing some headers. |
@davidhodge Also the same error I get back when trying to access the request outside of the app. I used the same headers present in the mobile request as the headers I used in the client. My wild guess is that I think the app may generate a client-side token that is used to validate where the request is coming from, in order to prevent the request from being made elsewhere. In a sense each request would only be single-use which could be why it works once when analyzing the request in the app, and doesn't work elsewhere. |
@idriskhenchil @wannesdemaeght I've seen other I did not need to add the "x-txid" key to the header (or even the bm_sv cookies). I hope I'm on the right track and this is helping. |
hi @chadhurin I used both POST and GET, with the url you provided, and a working bearer-token... |
Hey, @wannesdemaeght
with these headers:
|
@wannesdemaeght Did that work? |
Hi @chadhurin, thanks for your help! could you maybe help me along with the correct body to get a list of the premium connectivity invoices? |
@chadhurin do you know what endpoint I could use for the premium connectivity invoices, as well as what to put in the body? |
@chadhurin Hey, do you know if it is possible to get the supercharger location's latitude and longitude from the graphql query from your comment: If so, can you let me know what needs to be added to that query? Thank you. |
So this is still working in 2023, but I noticed it no longer returns the invoices for each VIN. It'll instead send a list of the most recent invoices regardless of VIN, but you still need to provide a VIN query parameter or it'll return an error 400. Is that your experience or am I sending my request incorrectly? I also noticed invoice.invoices.contentId is null for some invoices. Does this just mean a PDF isn't available to download yet? |
getChargingHistoryV2 and GetNearbyChargingSites return http 403 since approx 24h does it still work for you? |
@superfloh247 I was getting the same error for
It only returns the 5 most recent invoices and I am not sure how to query for more pages. Would you or anyone else know how? |
Just checked and I too am getting error 403 now :// |
Thank you for the solution! I implemented it and I got ALL of my invoices since late November of 2022 |
No problem. Did you add any extra query params? |
|
works for me, but it's incomplete https://akamai-apigateway-charging-ownership.tesla.com/graphql?deviceLanguage=en&deviceCountry=US&ttpLocale=en_US&vin=" + car.Vin + "&operationName=getChargingHistoryV2" the App also loads paginated, I'll play around with URL params :) |
What'd you find? @superfloh247 |
It was a combination of HTTP headers to make it work again |
and by "it works" I mean the GraphQL queries, not the GET request |
this endpoint works, and is a lot cleaner to implement. Anyone have an idea on how to get the premium connectivity invoices? |
hi @wannesdemaeght this is what you need for Premium Connectivity Invoices
hope this helps anyone |
in the endpoints file there is some documentation about invoices.
I would like to automatically download my supercharging invoices, but can not get it to work.
using these endpoints needs a uuid or invoiceId, which I am trying to obtain with this endpoint:
I am using this url:
https://owner-api.teslamotors.com/bff/v2/mobile-app/subscriptions/invoices
I am using GET, with requestheader application/json
params is: {"vehicle_id":"xxxxxxxxxxxx"} (id is correct, and works for all other api requests)
response is:
{"response":null,"error":"param is missing or the value is empty: vehicle_id","error_description":""}
I tried attaching the vehicle_id in the url, as needs to be done for other calls, but then I get a 404 error.
Any help?
The text was updated successfully, but these errors were encountered: