# Token (Auth Code Flow)

### Request Access Token Using Authorization Code Flow:

URL : `/api/v1/oauth2/token`\
Method : `POST`

### Parameters

*`client_id`* (**required**)\
Your application client id

*`client_secret`* (**required**)\
Your application client secret

*`grant_type`* (**required**)\
Use the value as “`authorization_code`“

*`code`* (**required**)\
Authorisation code received in authorise response

### Sample Request

`curl -X POST -d "client_id=ibl90vqe9ll5198ss53v1b1knpk4fhacv4y7uzpa.worksmart.net&client_secret= avfyflz1ygyaxrmx95nf&grant_type=authorization_code&code=m98z8wr6mxvmtr9sf3kl" https:://my.worksmart.app/api/v1/oauth2/token`

### Sample Response

```
{
    "access_token": "abcdefghijklmnopqrstuvwxyz123456789", 
    "expires_in": 3600, 
    "token_type": "Bearer", 
    "scope": null, 
    "refresh_token": "123456789abcdefghijklmnopqrstuvwxyz"
}
```


---

# 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://developer.workdigital.io/web-api/untitled/token-auth-code-flow.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.
