# Generate IAM User Token

### Environment

<table><thead><tr><th width="218">Environment</th><th>IAM Base URL</th></tr></thead><tbody><tr><td>Saafe Hackathon</td><td><code>https://api.sandbox.sahamati.org.in/iam</code></td></tr><tr><td>Saafe Sandbox</td><td><code>https://api.uat.sahamati.org.in/iam</code></td></tr></tbody></table>

### API Request

<mark style="color:green;">`POST`</mark> `{{IAM Base URL}}/v1/user/token/generate`

User Token is used to access the IAM user APIs

**Headers**

| Name         | Value                               |
| ------------ | ----------------------------------- |
| Content-Type | `application/x-www-form-urlencoded` |

**Body**

| Key      | Value  | Description        |
| -------- | ------ | ------------------ |
| username | string | IAM admin username |
| password | string | IAM admin password |

**Response**

{% tabs %}
{% tab title="200" %}
{% code overflow="wrap" %}

```json
{
    "ver": "1.0.0",
    "timestamp": "2024-10-10T10:33:56.177646614Z",
    "txnId": "a3229d47-c50c-4ce5-8aa2-9325dcdfe1b8",
    "accessToken": "JWT TOKEN",
    "expiresIn": 86400,
    "refreshExpiresIn": 0,
    "tokenType": "Bearer",
    "notBeforePolicy": 0,
    "scope": "email secret-expiry-ts profile entityMetadata"
}
```

{% endcode %}
{% endtab %}
{% endtabs %}
