> For the complete documentation index, see [llms.txt](https://docs.saafe.in/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.saafe.in/central-registry/iam-user-endpoints/generate-iam-user-token.md).

# 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 %}


---

# 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:

```
GET https://docs.saafe.in/central-registry/iam-user-endpoints/generate-iam-user-token.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.
