---
updatedAt: 2025-11-12T22:16:44.000Z
agentTools:
  projectIndex: https://docs.nmp.arianee.com/llms.txt
---

# Generate/Update User's API Key

Generate the first API key of a specific user or update it.

> ⚠️
>
> When updating an API key, the previous one is revoked.

### Step 1. Fetch users' ID

#### URL

> Required rights: `admin`, `accountManage` or `usersManage`

To retrieve all the users of your NFT Management Platform and their information, use [`/users`](https://docs.nmp.arianee.com/reference/fetchallusers).

```Text URL
GET - https://{{nmpUrl}}/users
```

<Callout icon="💡" theme="default">
  ### The user's `userId` will allow you to generate or update the API key.
</Callout>

#### Return Payload

Your users' information is returned.

```json 200 Return Payload
[
    {
        "_id": "605c9a833ad5c229e7267bd",
        "profile": "admin",
        "email": "user1@arianee.org",
        "userId": "QMQP2yTFcQaszbyUdGV4mJcKP",
        "deleted": false,
        "__v": 0,
        "auth0Id": "email|611a2dcad1ce9f9dc8",
        "apiKey": "...",
        "id": "605c9a833ad5c229e7267bd"
    },
    {
        "_id": "612f6a6bc9b767880ccd46",
        "email": "user2@arianee.org",
        "profile": "admin",
        "userId": "email|612f6a6bd1ce9f9dc8",
        "auth0Id": "email|612f6a6bd1ce9f9dc8",
        "deleted": true,
        "__v": 0,
        "id": "612f6a6bc9b767880ccd46"
    },
    {
        "_id": "61375e88f103e0904b517",
        "email": "user3@arianee.org",
        "profile": "admin",
        "userId": "423ce7d5-eb30-4b04-9d73-d4b4aed",
        "auth0Id": "email|61375e88d1ce9f9dc881",
        "deleted": true,
        "__v": 0,
        "id": "61375e88f103e0904b517"
    }
]
```

### Step 2. Generate or update API key

#### URL

> Required rights: `admin`, `accountManage` or `usersManage`

To generate or update a user's API key, use the [`/users/:userID/apiKey`](https://docs.nmp.arianee.com/reference/generateupdateusersapikey).

```Text URL
POST - https://{{nmpUrl}}/users/:userID/apiKey
```

| Input    | Mandatory | Type   | Description                               |
| :------- | :-------- | :----- | :---------------------------------------- |
| `userID` | ✅         | String | Identification of the NMP user's account. |

#### Return Payload

| Statut Code | Success | Description              |
| :---------- | :------ | :----------------------- |
| `200`       | `true`  | The API Key is returned. |

```json 200 Return Payload
{
    "apiKey": "4fb34d26-e20f-47c8-9757-ab7ca68f3..."
}
```

#### Errors

| Statut Code | Success | Description                                              |
| :---------- | :------ | :------------------------------------------------------- |
| `401`       | `false` | Unauthorized: You may not have the required permissions. |
| `500`       | `false` | Your `userID` may be wrong or does not exist.            |

```json 401 Return Payload
{
    "message": "Unauthorized"
}
```

```json 500 Return Payload
{
    "message": "User not found"
}
```