# OAuth

OAuth grant types supported

* `refresh_token` &#x20;
* `password`

## Get Access Token

<mark style="color:green;">`POST`</mark> `https://owner-api.teslamotors.com/oauth/token`

Performs the login and returns the access token for all subsequent actions

#### Headers

| Name         | Type   | Description        |
| ------------ | ------ | ------------------ |
| Content-Type | string | `application/json` |

#### Request Body

| Name           | Type   | Description                                                        |
| -------------- | ------ | ------------------------------------------------------------------ |
| password       | string | tesla.com user password                                            |
| email          | string | tesla.com user email address                                       |
| client\_secret | string | `c7257eb71a564034f9419ee651c7d0e5f7aa6bfbd18bafb5c5c033b093bb2fa3` |
| client\_id     | string | `81527cff06843c8634fdc09e8ac0abefb46ac849f38fe1e431c2ef2106796384` |
| grant\_type    | string | `password` or `refresh_token`                                      |

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "access_token":"ACCESS_TOKEN_FOR_ALL_API_CALLS",
  "token_type":"bearer",
  "expires_in":3888000,
  "refresh_token":"REFRESH_TOKEN_FOR_REFRESH_API_CALL",
  "created_at":1571519135
}
```

{% endtab %}
{% endtabs %}

## Revoke Access Token

<mark style="color:green;">`POST`</mark> `https://owner-api.teslamotors.com/oauth/revoke`

Revokes the `{access_token}` issued by the token command

#### Path Parameters

| Name         | Type   | Description        |
| ------------ | ------ | ------------------ |
| Content-Type | string | `application/json` |

#### Request Body

| Name  | Type   | Description      |
| ----- | ------ | ---------------- |
| token | string | `{access_token}` |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.teslaapi.io/authentication/oauth.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
