Skip to main content

Vault | C# SDK | General Endpoints

General Endpoints

Change state

VaultClient.StateChange(string, int, ItemVersionState)

Change the state of a specific version of a secret or key.

required parameters

string

The item ID

int

The item version

ItemVersionState

The new state of the item version

Response Object

Task<Response<StateChangeResult>>

Response<StateChangeResult>

var response = await client.StateChange(
    "pvi_p6g5i3gtbvqvc3u6zugab6qs6r63tqf5",
    1,
    ItemVersionState.Deactivated
);

Delete

VaultClient.Delete(string)

Delete a secret, key or folder.

required parameters

string

The item ID

Response Object

Task<Response<DeleteResult>>

Response<DeleteResult>

await client.Delete("pvi_p6g5i3gtbvqvc3u6zugab6qs6r63tqf5");

Retrieve

VaultClient.Get(GetRequest)

Retrieve a secret, key or folder, and any associated information.

required parameters

GetRequest

The request to the '/get' endpoint.

Response Object

Task<Response<GetResult>>

The response containing the retrieved information.

var request = new GetRequest
    ("pvi_p6g5i3gtbvqvc3u6zugab6qs6r63tqf5")
    ;
var response = await client.Get(request);

Get Bulk

VaultClient.GetBulk(GetBulkRequest)

Retrieve a list of secrets, keys and folders.

required parameters

GetBulkRequest

The request to the '/get_bulk' endpoint.

Response Object

Task<Response<GetBulkResult>>

The response containing the retrieved information.

var response = await client.GetBulk(new()
{
    Filter = new Dictionary<string, string>()
    {
        { "id", "pvi_123" }
    }
});

List

VaultClient.List(ListRequest)

Retrieve a list of secrets, keys and folders, and their associated information.

required parameters

ListRequest

The request parameters to send to the '/list' endpoint.

Response Object

Task<Response<ListResult>>

The response containing the list of items and their information.

var request = new ListRequest();
var response = await client.List(request);

Update

VaultClient.Update(UpdateRequest)

Update information associated with a secret, key or folder.

required parameters

UpdateRequest

The request parameters to send to the update endpoint.

Response Object

Task<Response<UpdateResult>>

The response containing the updated information.

var request = new UpdateRequest
    ("pvi_p6g5i3gtbvqvc3u6zugab6qs6r63tqf5")
    .WithFolder("/personal")
    ;
var response = await client.Update(request);