---
metadata:
  - name: generator
    content: Diplodoc Platform v5.50.6
alternate:
  - https://ydb.tech/docs/en/yql/reference/syntax/create-object-type-secret-access.md
  - https://ydb.tech/docs/ru/yql/reference/syntax/create-object-type-secret-access.md
sourcePath: en/core/yql/reference/syntax/create-object-type-secret-access.md
---
> **Documentation Index:** Fetch the complete configuration index at https://ydb.tech/docs/en/llms.txt

# CREATE OBJECT (TYPE SECRET_ACCESS)

<!-- source: en/yql/reference/syntax/_includes/deprecated_secrets_warning.md -->
{% note alert %}

**This command is deprecated** and will be removed in future versions of YDB. The recommended syntax for working with secrets is described in the [Secrets](https://ydb.tech/docs/en/concepts/datamodel/secrets.md) section.

{% endnote %}
<!-- endsource: en/yql/reference/syntax/_includes/deprecated_secrets_warning.md -->

All rights to use a secret belong to the secret's creator. The creator can grant another user read access to the secret through secret access management.

Access to secrets is managed using special `SECRET_ACCESS` objects. To grant permission to use the secret `secret_name` to the user `user_name`, create a `SECRET_ACCESS` object named `secret_name:user_name`.

```yql
CREATE OBJECT `secret_name:user_name` (TYPE SECRET_ACCESS);
```

Where:

* `secret_name` — the name of the [secret](https://ydb.tech/docs/en/yql/reference/syntax/create-object-type-secret.md).
* `user_name` — the name of the user who receives access.

## Example

The following statement grants access to the secret `MySecretName` to the user `another_user`:

```yql
CREATE OBJECT `MySecretName:another_user` (TYPE SECRET_ACCESS);
```
