> For the complete documentation index, see [llms.txt](https://40factory.gitbook.io/wilson/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://40factory.gitbook.io/wilson/3.11/rest-api/authentication/get-access-token.md).

# Get access token

## Request

### Url

```
POST 
https://wilson.40mat.com/apif/v2/auth/token
```

### Headers

```
No header is required for this endpoint.
```

### Parameters

```
No parameters are required for this endpoint.
```

#### Body

```json
{
  "app_name": "company-9d5e82680b7b9d...",
  "client_id": "19cd83c2-5137-47d7-905f-...",
  "client_secret": "S-ae305302a441bd4268~8fc..."
}
```

The request body is in JSON format contain following properties:

* `app_name` (string, required): The name of the application.
* `client_id` (string, required): The client ID for authentication.
* `client_secret` (string, required): The client secret for authentication.

***

## Response

```json
{
    "access_token": "eyJ0eXAiOiJKV1QiLCJub25jZSI6IlZFLXQxZTJUX2Y1...",
    "expires_at": 1747933502,
    "expires_in": 3599,
    "ext_expires_in": 3599,
    "token_type": "Bearer"
}
```

The response is in JSON format contain following properties:

* `access_token` (string): The obtained access token.
* `expires_at` (number): Timestamp indicating when the token expires.
* `expires_in` (number): Duration until the token expires.
* `ext_expires_in` (number): Extended duration until the token expires.
* `token_type` (string): Type of the token.

{% hint style="info" %}
The token must be entered in all other requests, in the Auth section as Bearer Token in the string format prefixed with "Bearer" followed by the access token.

i.e. "Bearer eyJ0eXAiOiJKV1QiLCJub25jZSI6IndUZXphSTNjdTNVYj..."
{% endhint %}

***

## Code example

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

```python
import requests
import json

url = "https://wilson.40mat.com/apif/v2/auth/token"

payload = json.dumps({
  "app_name": "company-9d5e82680b7b9d...",
  "client_id": "19cd83c2-5137-47d7-905f-...",
  "client_secret": "S-ae305302a441bd4268~8fc..."
})
headers = {
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

{% endtab %}

{% tab title="cURL" %}

```powershell
curl --location 'https://wilson.40mat.com/apif/v2/auth/token' \
--header 'Content-Type: application/json' \
--data '{
    "app_name": "company-9d5e82680b7b9d...",
    "client_id": "19cd83c2-5137-47d7-905f-...",
    "client_secret": "S-ae305302a441bd4268~8fc..."
}'
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://40factory.gitbook.io/wilson/3.11/rest-api/authentication/get-access-token.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
