DeveloperSkip to main content

  1. Fleet API
  2. Charging

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: jsonJSON 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 {vehicle_tag} 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
• invalid_command - The data request or command is unknown.
• invalid_field - A field in the input is not valid.
• invalid_request - The request body is not valid, a description giving a more specific error message may be returned.
• invalid_auth_code - The "code" in request body is invalid, generate a new one and try again.
• invalid_redirect_url - Invalid redirect URI/URL. The authorize redirect URI and token redirect URI must match.
• unsupported_grant_type - The grant type is invalid. Use one of: client_credentials, refresh_token, authorization_code.
• unauthorized_client - We don't recognize this client_id and client_secret combination. Use the client_id and client_secret that has been granted for the application.
401Unauthorized
• mobile_access_disabled - The vehicle has turned off remote access.
• no response body - The OAuth token has expired.
• login_required - The user has reset their password and a new auth code is required, the refresh_token has already been used, or the user has revoked application access.
402Payment RequiredPayment is required in order to use the API (non-free account only)
403Forbidden
• Access to this resource is not authorized, developers should check required scopes.
Tesla Vehicle Command Protocol required in order to interact with the devices.
404Not FoundThe requested resource does not exist.
405Not AllowedThe operation is not allowed.
406Not AcceptableThe HTTP request does not have a Content-Type header 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 - first call the partner account register endpoint.
418Client Too Old (Not supported)Mobile application needs to be updated (Tesla App only).
421Incorrect regionThis user is not present in the current region. See the regional requirements section for more information.
422Invalid ResourceThere is a semantic problem with the data, e.g. missing or invalid data.
• Vehicle does not yet support the Tesla Vehicle Command Protocol.
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 'RateLimit-Reset' or 'Retry-After' request headers 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.