# Public Cloud › Databases › Valkey › Users API

> Part of the OVHcloud developer hub. Index of every page and section: https://developers.eu.ovhcloud.com/llms.txt
> The Public Cloud product's sections: https://developers.eu.ovhcloud.com/reference/public-cloud/llms.txt
> Everything in one file: https://developers.eu.ovhcloud.com/llms-full.txt

> 7 operations of the OVHcloud API. Calls carry `authorization: Bearer $OVH_TOKEN`; the EU host is shown, Canada and the United States answer on api.ca.ovhcloud.com and api.us.ovhcloud.com.

Page: https://developers.eu.ovhcloud.com/reference/public-cloud/databases/valkey/users/

OpenAPI v1: https://api.eu.ovhcloud.com/1.0/__schemas/developer-hub-navigation/public-cloud/databases/valkey/users.json?format=openapi3
OpenAPI v2: https://api.eu.ovhcloud.com/v2/__schemas/developer-hub-navigation/public-cloud/databases/valkey/users.json?format=openapi3

## Operations

- `GET /publicCloud/project/{projectId}/managedDatabase/valkey/{serviceId}/user` — List users
- `GET /publicCloud/project/{projectId}/managedDatabase/valkey/{serviceId}/user/{userId}` — Get a user
- `POST /publicCloud/project/{projectId}/managedDatabase/valkey/{serviceId}/user` — Create a user
- `DELETE /publicCloud/project/{projectId}/managedDatabase/valkey/{serviceId}/user/{userId}` — Delete a user
- `PUT /publicCloud/project/{projectId}/managedDatabase/valkey/{serviceId}/user/{userId}` — Update a user
- `PATCH /publicCloud/project/{projectId}/managedDatabase/valkey/{serviceId}/user/{userId}` — Partially update a user
- `POST /publicCloud/project/{projectId}/managedDatabase/valkey/{serviceId}/user/{userId}/resetPassword` — Reset the password of a user

## List users

`GET /v2/publicCloud/project/{projectId}/managedDatabase/valkey/{serviceId}/user`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/databases/valkey/users/#get-publiccloud-project-projectid-manageddatabase-valkey-serviceid-user

**Status:** Beta version  
**IAM actions:** `publicCloudProject:apiovh:database/valkey/user/get`

Returns the users of the service with their access rules and status. Passwords are not returned.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `X-Pagination-Cursor` | header | string |  | Pagination cursor |
| `X-Pagination-Size` | header | integer |  | Pagination size |
| `projectId` | path | string | yes | Project ID |
| `serviceId` | path | string (uuid) | yes | Service ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.database.valkey.User[] | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `admin` | boolean | read-only | Whether this is the service administrator, the user created automatically at provisioning time, which cannot be deleted |
| `categories` | string[] | read-only | Command category rules granted to the user, each written as a category name prefixed with `+@` when it is allowed or `-@` when it is denied, for example `+@read`, `-@dangerous` |
| `channels` | string[] | read-only | Glob patterns of the Pub/Sub channels the user can subscribe to and publish on, for example `news:*`, `chat:room1`. `*` means every channel, and an empty list means the user cannot use any channel. |
| `checksum` | string | read-only | Hash of the resource used for concurrency control |
| `commands` | string[] | read-only | Individual command rules refining the permissions granted through the categories, each written as a Valkey command name prefixed with `+` when it is allowed or `-` when it is denied, for example `+get`, `-flushall` |
| `createdAt` | string (date-time) | read-only | Date at which the user was created |
| `credentialsLastUpdatedAt` | string (date-time) | read-only | Date at which the user credentials were last updated |
| `id` | string (uuid) | read-only | Unique identifier of the user |
| `keys` | string[] | read-only | Glob patterns of the keys the user can access, for example `cache:*`, `session:user:42`. `*` means every key, and an empty list means the user cannot access any key. |
| `password` | string (password) | read-only | Password of the user. Returned only on creation or password reset. |
| `status` | publicCloud.database.UserStatusEnum | read-only | Current readiness status of the user — one of `CREATING`, `DELETING`, `ERROR`, `READY`, `UPDATING` |
| `username` | string | read-only | Login name of the user |

```json
[
  {
    "admin": true,
    "categories": [
      "string"
    ],
    "channels": [
      "string"
    ],
    "checksum": "string",
    "commands": [
      "string"
    ],
    "createdAt": "2024-01-01T12:00:00Z",
    "credentialsLastUpdatedAt": "2024-01-01T12:00:00Z",
    "id": "00000000-0000-0000-0000-000000000000",
    "keys": [
      "string"
    ],
    "password": "string",
    "status": "CREATING",
    "username": "string"
  }
]
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/managedDatabase/valkey/{serviceId}/user" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/v2/publicCloud/project/{projectId}/managedDatabase/valkey/{serviceId}/user")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/v2/publicCloud/project/{projectId}/managedDatabase/valkey/{serviceId}/user");

print_r($result);
?>
```

## Get a user

`GET /v2/publicCloud/project/{projectId}/managedDatabase/valkey/{serviceId}/user/{userId}`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/databases/valkey/users/#get-publiccloud-project-projectid-manageddatabase-valkey-serviceid-user-userid

**Status:** Beta version  
**IAM actions:** `publicCloudProject:apiovh:database/valkey/user/get`

Returns the user, its access rules and its status. The password is not returned.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `projectId` | path | string | yes | Project ID |
| `serviceId` | path | string (uuid) | yes | Service ID |
| `userId` | path | string (uuid) | yes | User ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.database.valkey.User | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `admin` | boolean | read-only | Whether this is the service administrator, the user created automatically at provisioning time, which cannot be deleted |
| `categories` | string[] | read-only | Command category rules granted to the user, each written as a category name prefixed with `+@` when it is allowed or `-@` when it is denied, for example `+@read`, `-@dangerous` |
| `channels` | string[] | read-only | Glob patterns of the Pub/Sub channels the user can subscribe to and publish on, for example `news:*`, `chat:room1`. `*` means every channel, and an empty list means the user cannot use any channel. |
| `checksum` | string | read-only | Hash of the resource used for concurrency control |
| `commands` | string[] | read-only | Individual command rules refining the permissions granted through the categories, each written as a Valkey command name prefixed with `+` when it is allowed or `-` when it is denied, for example `+get`, `-flushall` |
| `createdAt` | string (date-time) | read-only | Date at which the user was created |
| `credentialsLastUpdatedAt` | string (date-time) | read-only | Date at which the user credentials were last updated |
| `id` | string (uuid) | read-only | Unique identifier of the user |
| `keys` | string[] | read-only | Glob patterns of the keys the user can access, for example `cache:*`, `session:user:42`. `*` means every key, and an empty list means the user cannot access any key. |
| `password` | string (password) | read-only | Password of the user. Returned only on creation or password reset. |
| `status` | publicCloud.database.UserStatusEnum | read-only | Current readiness status of the user — one of `CREATING`, `DELETING`, `ERROR`, `READY`, `UPDATING` |
| `username` | string | read-only | Login name of the user |

```json
{
  "admin": true,
  "categories": [
    "string"
  ],
  "channels": [
    "string"
  ],
  "checksum": "string",
  "commands": [
    "string"
  ],
  "createdAt": "2024-01-01T12:00:00Z",
  "credentialsLastUpdatedAt": "2024-01-01T12:00:00Z",
  "id": "00000000-0000-0000-0000-000000000000",
  "keys": [
    "string"
  ],
  "password": "string",
  "status": "CREATING",
  "username": "string"
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/managedDatabase/valkey/{serviceId}/user/{userId}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/v2/publicCloud/project/{projectId}/managedDatabase/valkey/{serviceId}/user/{userId}")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/v2/publicCloud/project/{projectId}/managedDatabase/valkey/{serviceId}/user/{userId}");

print_r($result);
?>
```

## Create a user

`POST /v2/publicCloud/project/{projectId}/managedDatabase/valkey/{serviceId}/user`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/databases/valkey/users/#post-publiccloud-project-projectid-manageddatabase-valkey-serviceid-user

**Status:** Beta version  
**IAM actions:** `publicCloudProject:apiovh:database/valkey/user/create`

Creates a user with access rules on command categories, commands, keys and Pub/Sub channels. An empty keys or channels list grants no access. The generated password is returned only on creation and on password reset.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `projectId` | path | string | yes | Project ID |
| `serviceId` | path | string (uuid) | yes | Service ID |

### Request body (required)

Type: `publicCloud.database.valkey.UserCreation`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `categories` | string[] |  | Command category rules granted to the user, each written as a category name prefixed with `+@` to allow it or `-@` to deny it, for example `+@read`, `-@dangerous`. Available categories are all, admin, bitmap, blocking, connection, dangerous, fast, geo, hash, hyperloglog, keyspace, list, pubsub, read, scripting, set, slow, sortedset, stream, string, transaction and write. |
| `channels` | string[] |  | Glob patterns of the Pub/Sub channels the user can subscribe to and publish on, for example `news:*`, `chat:room1`. Use `*` to allow every channel. When the list is empty, the user cannot use any channel. |
| `commands` | string[] |  | Individual command rules that refine the permissions granted through the categories, each written as a Valkey command name in lowercase prefixed with `+` to allow it or `-` to deny it, for example `+get`, `-flushall` |
| `keys` | string[] |  | Glob patterns of the keys the user can access, for example `cache:*`, `session:user:42`. Use `*` to allow every key. When the list is empty, the user cannot access any key. |
| `name` | string | yes | Login name of the new user, unique on the service. It must be 1 to 32 characters long, start with a letter, a digit or an underscore, and contain only letters, digits, underscores, dots and hyphens. |

```json
{
  "categories": [
    "string"
  ],
  "channels": [
    "string"
  ],
  "commands": [
    "string"
  ],
  "keys": [
    "string"
  ],
  "name": "string"
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.database.valkey.User | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `admin` | boolean | read-only | Whether this is the service administrator, the user created automatically at provisioning time, which cannot be deleted |
| `categories` | string[] | read-only | Command category rules granted to the user, each written as a category name prefixed with `+@` when it is allowed or `-@` when it is denied, for example `+@read`, `-@dangerous` |
| `channels` | string[] | read-only | Glob patterns of the Pub/Sub channels the user can subscribe to and publish on, for example `news:*`, `chat:room1`. `*` means every channel, and an empty list means the user cannot use any channel. |
| `checksum` | string | read-only | Hash of the resource used for concurrency control |
| `commands` | string[] | read-only | Individual command rules refining the permissions granted through the categories, each written as a Valkey command name prefixed with `+` when it is allowed or `-` when it is denied, for example `+get`, `-flushall` |
| `createdAt` | string (date-time) | read-only | Date at which the user was created |
| `credentialsLastUpdatedAt` | string (date-time) | read-only | Date at which the user credentials were last updated |
| `id` | string (uuid) | read-only | Unique identifier of the user |
| `keys` | string[] | read-only | Glob patterns of the keys the user can access, for example `cache:*`, `session:user:42`. `*` means every key, and an empty list means the user cannot access any key. |
| `password` | string (password) | read-only | Password of the user. Returned only on creation or password reset. |
| `status` | publicCloud.database.UserStatusEnum | read-only | Current readiness status of the user — one of `CREATING`, `DELETING`, `ERROR`, `READY`, `UPDATING` |
| `username` | string | read-only | Login name of the user |

```json
{
  "admin": true,
  "categories": [
    "string"
  ],
  "channels": [
    "string"
  ],
  "checksum": "string",
  "commands": [
    "string"
  ],
  "createdAt": "2024-01-01T12:00:00Z",
  "credentialsLastUpdatedAt": "2024-01-01T12:00:00Z",
  "id": "00000000-0000-0000-0000-000000000000",
  "keys": [
    "string"
  ],
  "password": "string",
  "status": "CREATING",
  "username": "string"
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/managedDatabase/valkey/{serviceId}/user" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN" \
  -H "content-type: application/json" \
  -d '{ }'
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

# Request body type: publicCloud.database.valkey.UserCreation
result = client.post("/v2/publicCloud/project/{projectId}/managedDatabase/valkey/{serviceId}/user",
	categories = None, # Command category rules granted to the user, each written as a category name prefixed with `+@` to allow it or `-@` to deny it, for example `+@read`, `-@dangerous`. Available categories are all, admin, bitmap, blocking, connection, dangerous, fast, geo, hash, hyperloglog, keyspace, list, pubsub, read, scripting, set, slow, sortedset, stream, string, transaction and write. (type: array)
	channels = None, # Glob patterns of the Pub/Sub channels the user can subscribe to and publish on, for example `news:*`, `chat:room1`. Use `*` to allow every channel. When the list is empty, the user cannot use any channel. (type: array)
	commands = None, # Individual command rules that refine the permissions granted through the categories, each written as a Valkey command name in lowercase prefixed with `+` to allow it or `-` to deny it, for example `+get`, `-flushall` (type: array)
	keys = None, # Glob patterns of the keys the user can access, for example `cache:*`, `session:user:42`. Use `*` to allow every key. When the list is empty, the user cannot access any key. (type: array)
	name = None, # Login name of the new user, unique on the service. It must be 1 to 32 characters long, start with a letter, a digit or an underscore, and contain only letters, digits, underscores, dots and hyphens. (type: string)
)

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

// Request body type: publicCloud.database.valkey.UserCreation
$result = $ovh->post("/v2/publicCloud/project/{projectId}/managedDatabase/valkey/{serviceId}/user", array(
	categories => null, // Command category rules granted to the user, each written as a category name prefixed with `+@` to allow it or `-@` to deny it, for example `+@read`, `-@dangerous`. Available categories are all, admin, bitmap, blocking, connection, dangerous, fast, geo, hash, hyperloglog, keyspace, list, pubsub, read, scripting, set, slow, sortedset, stream, string, transaction and write. (type: array)
	channels => null, // Glob patterns of the Pub/Sub channels the user can subscribe to and publish on, for example `news:*`, `chat:room1`. Use `*` to allow every channel. When the list is empty, the user cannot use any channel. (type: array)
	commands => null, // Individual command rules that refine the permissions granted through the categories, each written as a Valkey command name in lowercase prefixed with `+` to allow it or `-` to deny it, for example `+get`, `-flushall` (type: array)
	keys => null, // Glob patterns of the keys the user can access, for example `cache:*`, `session:user:42`. Use `*` to allow every key. When the list is empty, the user cannot access any key. (type: array)
	name => null, // Login name of the new user, unique on the service. It must be 1 to 32 characters long, start with a letter, a digit or an underscore, and contain only letters, digits, underscores, dots and hyphens. (type: string)
));

print_r($result);
?>
```

## Delete a user

`DELETE /v2/publicCloud/project/{projectId}/managedDatabase/valkey/{serviceId}/user/{userId}`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/databases/valkey/users/#delete-publiccloud-project-projectid-manageddatabase-valkey-serviceid-user-userid

**Status:** Beta version  
**IAM actions:** `publicCloudProject:apiovh:database/valkey/user/delete`

Permanently deletes the user.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `projectId` | path | string | yes | Project ID |
| `serviceId` | path | string (uuid) | yes | Service ID |
| `userId` | path | string (uuid) | yes | User ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.database.valkey.User | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `admin` | boolean | read-only | Whether this is the service administrator, the user created automatically at provisioning time, which cannot be deleted |
| `categories` | string[] | read-only | Command category rules granted to the user, each written as a category name prefixed with `+@` when it is allowed or `-@` when it is denied, for example `+@read`, `-@dangerous` |
| `channels` | string[] | read-only | Glob patterns of the Pub/Sub channels the user can subscribe to and publish on, for example `news:*`, `chat:room1`. `*` means every channel, and an empty list means the user cannot use any channel. |
| `checksum` | string | read-only | Hash of the resource used for concurrency control |
| `commands` | string[] | read-only | Individual command rules refining the permissions granted through the categories, each written as a Valkey command name prefixed with `+` when it is allowed or `-` when it is denied, for example `+get`, `-flushall` |
| `createdAt` | string (date-time) | read-only | Date at which the user was created |
| `credentialsLastUpdatedAt` | string (date-time) | read-only | Date at which the user credentials were last updated |
| `id` | string (uuid) | read-only | Unique identifier of the user |
| `keys` | string[] | read-only | Glob patterns of the keys the user can access, for example `cache:*`, `session:user:42`. `*` means every key, and an empty list means the user cannot access any key. |
| `password` | string (password) | read-only | Password of the user. Returned only on creation or password reset. |
| `status` | publicCloud.database.UserStatusEnum | read-only | Current readiness status of the user — one of `CREATING`, `DELETING`, `ERROR`, `READY`, `UPDATING` |
| `username` | string | read-only | Login name of the user |

```json
{
  "admin": true,
  "categories": [
    "string"
  ],
  "channels": [
    "string"
  ],
  "checksum": "string",
  "commands": [
    "string"
  ],
  "createdAt": "2024-01-01T12:00:00Z",
  "credentialsLastUpdatedAt": "2024-01-01T12:00:00Z",
  "id": "00000000-0000-0000-0000-000000000000",
  "keys": [
    "string"
  ],
  "password": "string",
  "status": "CREATING",
  "username": "string"
}
```

### Example

```bash
curl -X DELETE \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/managedDatabase/valkey/{serviceId}/user/{userId}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.delete("/v2/publicCloud/project/{projectId}/managedDatabase/valkey/{serviceId}/user/{userId}")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->delete("/v2/publicCloud/project/{projectId}/managedDatabase/valkey/{serviceId}/user/{userId}");

print_r($result);
?>
```

## Update a user

`PUT /v2/publicCloud/project/{projectId}/managedDatabase/valkey/{serviceId}/user/{userId}`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/databases/valkey/users/#put-publiccloud-project-projectid-manageddatabase-valkey-serviceid-user-userid

**Status:** Beta version  
**IAM actions:** `publicCloudProject:apiovh:database/valkey/user/edit`

Updates the access rules of the user. Each list replaces the current one, and an empty keys or channels list revokes all access. To reset the password, use the resetPassword route of the user or a partial update with credentialsLastUpdatedAt.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `projectId` | path | string | yes | Project ID |
| `serviceId` | path | string (uuid) | yes | Service ID |
| `userId` | path | string (uuid) | yes | User ID |

### Request body (required)

Type: `publicCloud.database.valkey.UserReplace`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `categories` | string[] | yes | Command category rules granted to the user, each written as a category name prefixed with `+@` to allow it or `-@` to deny it, for example `+@read`, `-@dangerous`. Available categories are all, admin, bitmap, blocking, connection, dangerous, fast, geo, hash, hyperloglog, keyspace, list, pubsub, read, scripting, set, slow, sortedset, stream, string, transaction and write. The list replaces the one currently set on the user. |
| `channels` | string[] | yes | Glob patterns of the Pub/Sub channels the user can subscribe to and publish on, for example `news:*`, `chat:room1`. Use `*` to allow every channel. The list replaces the one currently set on the user, and an empty list revokes access to every channel. |
| `commands` | string[] | yes | Individual command rules that refine the permissions granted through the categories, each written as a Valkey command name in lowercase prefixed with `+` to allow it or `-` to deny it, for example `+get`, `-flushall`. The list replaces the one currently set on the user. |
| `keys` | string[] | yes | Glob patterns of the keys the user can access, for example `cache:*`, `session:user:42`. Use `*` to allow every key. The list replaces the one currently set on the user, and an empty list revokes access to every key. |

```json
{
  "categories": [
    "string"
  ],
  "channels": [
    "string"
  ],
  "commands": [
    "string"
  ],
  "keys": [
    "string"
  ]
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.database.valkey.User | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `admin` | boolean | read-only | Whether this is the service administrator, the user created automatically at provisioning time, which cannot be deleted |
| `categories` | string[] | read-only | Command category rules granted to the user, each written as a category name prefixed with `+@` when it is allowed or `-@` when it is denied, for example `+@read`, `-@dangerous` |
| `channels` | string[] | read-only | Glob patterns of the Pub/Sub channels the user can subscribe to and publish on, for example `news:*`, `chat:room1`. `*` means every channel, and an empty list means the user cannot use any channel. |
| `checksum` | string | read-only | Hash of the resource used for concurrency control |
| `commands` | string[] | read-only | Individual command rules refining the permissions granted through the categories, each written as a Valkey command name prefixed with `+` when it is allowed or `-` when it is denied, for example `+get`, `-flushall` |
| `createdAt` | string (date-time) | read-only | Date at which the user was created |
| `credentialsLastUpdatedAt` | string (date-time) | read-only | Date at which the user credentials were last updated |
| `id` | string (uuid) | read-only | Unique identifier of the user |
| `keys` | string[] | read-only | Glob patterns of the keys the user can access, for example `cache:*`, `session:user:42`. `*` means every key, and an empty list means the user cannot access any key. |
| `password` | string (password) | read-only | Password of the user. Returned only on creation or password reset. |
| `status` | publicCloud.database.UserStatusEnum | read-only | Current readiness status of the user — one of `CREATING`, `DELETING`, `ERROR`, `READY`, `UPDATING` |
| `username` | string | read-only | Login name of the user |

```json
{
  "admin": true,
  "categories": [
    "string"
  ],
  "channels": [
    "string"
  ],
  "checksum": "string",
  "commands": [
    "string"
  ],
  "createdAt": "2024-01-01T12:00:00Z",
  "credentialsLastUpdatedAt": "2024-01-01T12:00:00Z",
  "id": "00000000-0000-0000-0000-000000000000",
  "keys": [
    "string"
  ],
  "password": "string",
  "status": "CREATING",
  "username": "string"
}
```

### Example

```bash
curl -X PUT \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/managedDatabase/valkey/{serviceId}/user/{userId}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN" \
  -H "content-type: application/json" \
  -d '{ }'
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

# Request body type: publicCloud.database.valkey.UserReplace
result = client.put("/v2/publicCloud/project/{projectId}/managedDatabase/valkey/{serviceId}/user/{userId}",
	categories = None, # Command category rules granted to the user, each written as a category name prefixed with `+@` to allow it or `-@` to deny it, for example `+@read`, `-@dangerous`. Available categories are all, admin, bitmap, blocking, connection, dangerous, fast, geo, hash, hyperloglog, keyspace, list, pubsub, read, scripting, set, slow, sortedset, stream, string, transaction and write. The list replaces the one currently set on the user. (type: array)
	channels = None, # Glob patterns of the Pub/Sub channels the user can subscribe to and publish on, for example `news:*`, `chat:room1`. Use `*` to allow every channel. The list replaces the one currently set on the user, and an empty list revokes access to every channel. (type: array)
	commands = None, # Individual command rules that refine the permissions granted through the categories, each written as a Valkey command name in lowercase prefixed with `+` to allow it or `-` to deny it, for example `+get`, `-flushall`. The list replaces the one currently set on the user. (type: array)
	keys = None, # Glob patterns of the keys the user can access, for example `cache:*`, `session:user:42`. Use `*` to allow every key. The list replaces the one currently set on the user, and an empty list revokes access to every key. (type: array)
)

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

// Request body type: publicCloud.database.valkey.UserReplace
$result = $ovh->put("/v2/publicCloud/project/{projectId}/managedDatabase/valkey/{serviceId}/user/{userId}", array(
	categories => null, // Command category rules granted to the user, each written as a category name prefixed with `+@` to allow it or `-@` to deny it, for example `+@read`, `-@dangerous`. Available categories are all, admin, bitmap, blocking, connection, dangerous, fast, geo, hash, hyperloglog, keyspace, list, pubsub, read, scripting, set, slow, sortedset, stream, string, transaction and write. The list replaces the one currently set on the user. (type: array)
	channels => null, // Glob patterns of the Pub/Sub channels the user can subscribe to and publish on, for example `news:*`, `chat:room1`. Use `*` to allow every channel. The list replaces the one currently set on the user, and an empty list revokes access to every channel. (type: array)
	commands => null, // Individual command rules that refine the permissions granted through the categories, each written as a Valkey command name in lowercase prefixed with `+` to allow it or `-` to deny it, for example `+get`, `-flushall`. The list replaces the one currently set on the user. (type: array)
	keys => null, // Glob patterns of the keys the user can access, for example `cache:*`, `session:user:42`. Use `*` to allow every key. The list replaces the one currently set on the user, and an empty list revokes access to every key. (type: array)
));

print_r($result);
?>
```

## Partially update a user

`PATCH /v2/publicCloud/project/{projectId}/managedDatabase/valkey/{serviceId}/user/{userId}`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/databases/valkey/users/#patch-publiccloud-project-projectid-manageddatabase-valkey-serviceid-user-userid

**Status:** Beta version  
**IAM actions:** `publicCloudProject:apiovh:database/valkey/user/edit`

Partially updates the access rules of the user. Each list replaces the current one, and an empty keys or channels list revokes all access. Setting credentialsLastUpdatedAt resets the password and returns the new one.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `projectId` | path | string | yes | Project ID |
| `serviceId` | path | string (uuid) | yes | Service ID |
| `userId` | path | string (uuid) | yes | User ID |

### Request body (required)

Type: `publicCloud.database.valkey.UserUpdate`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `categories` | string[] |  | Command category rules granted to the user, each written as a category name prefixed with `+@` to allow it or `-@` to deny it, for example `+@read`, `-@dangerous`. Available categories are all, admin, bitmap, blocking, connection, dangerous, fast, geo, hash, hyperloglog, keyspace, list, pubsub, read, scripting, set, slow, sortedset, stream, string, transaction and write. The list replaces the one currently set on the user. |
| `channels` | string[] |  | Glob patterns of the Pub/Sub channels the user can subscribe to and publish on, for example `news:*`, `chat:room1`. Use `*` to allow every channel. The list replaces the one currently set on the user, and an empty list revokes access to every channel. |
| `commands` | string[] |  | Individual command rules that refine the permissions granted through the categories, each written as a Valkey command name in lowercase prefixed with `+` to allow it or `-` to deny it, for example `+get`, `-flushall`. The list replaces the one currently set on the user. |
| `credentialsLastUpdatedAt` | string (date-time) |  | Date at which the user credentials were last updated. Setting this field triggers a credential reset and returns the new password. |
| `keys` | string[] |  | Glob patterns of the keys the user can access, for example `cache:*`, `session:user:42`. Use `*` to allow every key. The list replaces the one currently set on the user, and an empty list revokes access to every key. |

```json
{
  "categories": [
    "string"
  ],
  "channels": [
    "string"
  ],
  "commands": [
    "string"
  ],
  "credentialsLastUpdatedAt": "2024-01-01T12:00:00Z",
  "keys": [
    "string"
  ]
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.database.valkey.User | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `admin` | boolean | read-only | Whether this is the service administrator, the user created automatically at provisioning time, which cannot be deleted |
| `categories` | string[] | read-only | Command category rules granted to the user, each written as a category name prefixed with `+@` when it is allowed or `-@` when it is denied, for example `+@read`, `-@dangerous` |
| `channels` | string[] | read-only | Glob patterns of the Pub/Sub channels the user can subscribe to and publish on, for example `news:*`, `chat:room1`. `*` means every channel, and an empty list means the user cannot use any channel. |
| `checksum` | string | read-only | Hash of the resource used for concurrency control |
| `commands` | string[] | read-only | Individual command rules refining the permissions granted through the categories, each written as a Valkey command name prefixed with `+` when it is allowed or `-` when it is denied, for example `+get`, `-flushall` |
| `createdAt` | string (date-time) | read-only | Date at which the user was created |
| `credentialsLastUpdatedAt` | string (date-time) | read-only | Date at which the user credentials were last updated |
| `id` | string (uuid) | read-only | Unique identifier of the user |
| `keys` | string[] | read-only | Glob patterns of the keys the user can access, for example `cache:*`, `session:user:42`. `*` means every key, and an empty list means the user cannot access any key. |
| `password` | string (password) | read-only | Password of the user. Returned only on creation or password reset. |
| `status` | publicCloud.database.UserStatusEnum | read-only | Current readiness status of the user — one of `CREATING`, `DELETING`, `ERROR`, `READY`, `UPDATING` |
| `username` | string | read-only | Login name of the user |

```json
{
  "admin": true,
  "categories": [
    "string"
  ],
  "channels": [
    "string"
  ],
  "checksum": "string",
  "commands": [
    "string"
  ],
  "createdAt": "2024-01-01T12:00:00Z",
  "credentialsLastUpdatedAt": "2024-01-01T12:00:00Z",
  "id": "00000000-0000-0000-0000-000000000000",
  "keys": [
    "string"
  ],
  "password": "string",
  "status": "CREATING",
  "username": "string"
}
```

### Example

```bash
curl -X PATCH \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/managedDatabase/valkey/{serviceId}/user/{userId}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN" \
  -H "content-type: application/json" \
  -d '{ }'
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

# Request body type: publicCloud.database.valkey.UserUpdate
result = client.patch("/v2/publicCloud/project/{projectId}/managedDatabase/valkey/{serviceId}/user/{userId}",
	categories = None, # Command category rules granted to the user, each written as a category name prefixed with `+@` to allow it or `-@` to deny it, for example `+@read`, `-@dangerous`. Available categories are all, admin, bitmap, blocking, connection, dangerous, fast, geo, hash, hyperloglog, keyspace, list, pubsub, read, scripting, set, slow, sortedset, stream, string, transaction and write. The list replaces the one currently set on the user. (type: array)
	channels = None, # Glob patterns of the Pub/Sub channels the user can subscribe to and publish on, for example `news:*`, `chat:room1`. Use `*` to allow every channel. The list replaces the one currently set on the user, and an empty list revokes access to every channel. (type: array)
	commands = None, # Individual command rules that refine the permissions granted through the categories, each written as a Valkey command name in lowercase prefixed with `+` to allow it or `-` to deny it, for example `+get`, `-flushall`. The list replaces the one currently set on the user. (type: array)
	credentialsLastUpdatedAt = None, # Date at which the user credentials were last updated. Setting this field triggers a credential reset and returns the new password. (type: string)
	keys = None, # Glob patterns of the keys the user can access, for example `cache:*`, `session:user:42`. Use `*` to allow every key. The list replaces the one currently set on the user, and an empty list revokes access to every key. (type: array)
)

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

// Request body type: publicCloud.database.valkey.UserUpdate
$result = $ovh->patch("/v2/publicCloud/project/{projectId}/managedDatabase/valkey/{serviceId}/user/{userId}", array(
	categories => null, // Command category rules granted to the user, each written as a category name prefixed with `+@` to allow it or `-@` to deny it, for example `+@read`, `-@dangerous`. Available categories are all, admin, bitmap, blocking, connection, dangerous, fast, geo, hash, hyperloglog, keyspace, list, pubsub, read, scripting, set, slow, sortedset, stream, string, transaction and write. The list replaces the one currently set on the user. (type: array)
	channels => null, // Glob patterns of the Pub/Sub channels the user can subscribe to and publish on, for example `news:*`, `chat:room1`. Use `*` to allow every channel. The list replaces the one currently set on the user, and an empty list revokes access to every channel. (type: array)
	commands => null, // Individual command rules that refine the permissions granted through the categories, each written as a Valkey command name in lowercase prefixed with `+` to allow it or `-` to deny it, for example `+get`, `-flushall`. The list replaces the one currently set on the user. (type: array)
	credentialsLastUpdatedAt => null, // Date at which the user credentials were last updated. Setting this field triggers a credential reset and returns the new password. (type: string)
	keys => null, // Glob patterns of the keys the user can access, for example `cache:*`, `session:user:42`. Use `*` to allow every key. The list replaces the one currently set on the user, and an empty list revokes access to every key. (type: array)
));

print_r($result);
?>
```

## Reset the password of a user

`POST /v2/publicCloud/project/{projectId}/managedDatabase/valkey/{serviceId}/user/{userId}/resetPassword`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/databases/valkey/users/#post-publiccloud-project-projectid-manageddatabase-valkey-serviceid-user-userid-resetpassword

**Status:** Beta version  
**IAM actions:** `publicCloudProject:apiovh:database/valkey/user/credentials/reset`

Generates a new password for the user and returns it in the response. Reading the user never returns it. The previous password stops working once the new one is applied, and credentialsLastUpdatedAt becomes the date of this reset. This is the same reset as a partial update of the user that sets credentialsLastUpdatedAt.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `projectId` | path | string | yes | Project ID |
| `serviceId` | path | string (uuid) | yes | Service ID |
| `userId` | path | string (uuid) | yes | User ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.database.valkey.User | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `admin` | boolean | read-only | Whether this is the service administrator, the user created automatically at provisioning time, which cannot be deleted |
| `categories` | string[] | read-only | Command category rules granted to the user, each written as a category name prefixed with `+@` when it is allowed or `-@` when it is denied, for example `+@read`, `-@dangerous` |
| `channels` | string[] | read-only | Glob patterns of the Pub/Sub channels the user can subscribe to and publish on, for example `news:*`, `chat:room1`. `*` means every channel, and an empty list means the user cannot use any channel. |
| `checksum` | string | read-only | Hash of the resource used for concurrency control |
| `commands` | string[] | read-only | Individual command rules refining the permissions granted through the categories, each written as a Valkey command name prefixed with `+` when it is allowed or `-` when it is denied, for example `+get`, `-flushall` |
| `createdAt` | string (date-time) | read-only | Date at which the user was created |
| `credentialsLastUpdatedAt` | string (date-time) | read-only | Date at which the user credentials were last updated |
| `id` | string (uuid) | read-only | Unique identifier of the user |
| `keys` | string[] | read-only | Glob patterns of the keys the user can access, for example `cache:*`, `session:user:42`. `*` means every key, and an empty list means the user cannot access any key. |
| `password` | string (password) | read-only | Password of the user. Returned only on creation or password reset. |
| `status` | publicCloud.database.UserStatusEnum | read-only | Current readiness status of the user — one of `CREATING`, `DELETING`, `ERROR`, `READY`, `UPDATING` |
| `username` | string | read-only | Login name of the user |

```json
{
  "admin": true,
  "categories": [
    "string"
  ],
  "channels": [
    "string"
  ],
  "checksum": "string",
  "commands": [
    "string"
  ],
  "createdAt": "2024-01-01T12:00:00Z",
  "credentialsLastUpdatedAt": "2024-01-01T12:00:00Z",
  "id": "00000000-0000-0000-0000-000000000000",
  "keys": [
    "string"
  ],
  "password": "string",
  "status": "CREATING",
  "username": "string"
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/managedDatabase/valkey/{serviceId}/user/{userId}/resetPassword" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.post("/v2/publicCloud/project/{projectId}/managedDatabase/valkey/{serviceId}/user/{userId}/resetPassword")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->post("/v2/publicCloud/project/{projectId}/managedDatabase/valkey/{serviceId}/user/{userId}/resetPassword");

print_r($result);
?>
```
