# `ApifyClient.API.KeyValueStores.Records`
[🔗](https://github.com/social-growth-studio/apify-client-ex/blob/v1.0.0/lib/apify_client/api/key_value_stores/records.ex#L1)

Provides API endpoints related to api/key value stores/records

# `delete`

```elixir
@spec delete(store_id :: String.t(), record_key :: String.t(), opts :: keyword()) ::
  :ok | {:error, ApifyClient.Error.t()}
```

Delete key-value store record

Removes a record specified by a key from the key-value store.

# `get`

```elixir
@spec get(store_id :: String.t(), record_key :: String.t(), opts :: keyword()) ::
  {:ok, any()} | {:error, ApifyClient.Error.t()}
```

Get key-value store record

Gets a value stored in the key-value store under a specific key.

The response body has the same `Content-Encoding` header as it was set in
[Set key-value store record](https://docs.apify.com/api/v2/key-value-store-record-put).

If the request does not define the `Accept-Encoding` HTTP header with the
right encoding, the record will be decompressed.

Most HTTP clients support decompression by default. After using the HTTP
client with decompression support, the `Accept-Encoding` header is set by
the client and body is decompressed automatically.

Please note that for security reasons, Apify API can perform small modifications
to HTML documents before they are served via this endpoint. To fetch the raw HTML
content without any modifications, use the `attachment` query parameter.

## Options

  * `attachment`: If `true` or `1`, the response will be served with `Content-Disposition: attachment` header,
    causing web browsers to offer downloading HTML records instead of displaying them.
    
  * `signature`: Signature used for the access.

# `head`

```elixir
@spec head(store_id :: String.t(), record_key :: String.t(), opts :: keyword()) ::
  :ok | {:error, ApifyClient.Error.t()}
```

Check if key-value store record exists

Check if a value is stored in the key-value store under a specific key.

# `list`

```elixir
@spec list(store_id :: String.t(), opts :: keyword()) ::
  {:ok, binary()} | {:error, ApifyClient.Error.t()}
```

Download key-value store records

Downloads all records from the key-value store as a ZIP archive.
Each record is stored as a separate file in the archive, with the filename equal to the record key.

You can optionally filter the records by `collection` or `prefix` to download only a subset of the store.

## Options

  * `collection`: If specified, only records belonging to a specific collection from the key-value store schema. The key-value store need to have a schema defined for this parameter to work.
    
  * `prefix`: If specified, only records whose key starts with the given prefix are included in the archive.
    
  * `signature`: Signature used for the access.

# `update`

```elixir
@spec update(
  store_id :: String.t(),
  record_key :: String.t(),
  body :: any(),
  opts :: keyword()
) ::
  {:ok, map() | nil} | {:error, ApifyClient.Error.t()}
```

Set key-value store record

Stores a value under a specific key to the key-value store.

The value is passed as the PUT payload and it is stored with a MIME content
type defined by the `Content-Type` header and with encoding defined by the
`Content-Encoding` header.

To save bandwidth, storage, and speed up your upload, send the request
payload compressed with Gzip compression and add the `Content-Encoding: gzip`
header. It is possible to set up another compression type with `Content-Encoding`
request header.

Below is a list of supported `Content-Encoding` types.

* Brotli compression: `Content-Encoding: br`
* Gzip compression: `Content-Encoding: gzip`
* Zstandard compression: `Content-Encoding: zstd`
* Deflate compression: `Content-Encoding: deflate`

## Request Body

**Content Types**: `*/*`, `application/json`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
