---
title: "Create key-value store"
method: POST
path: "/v2/key-value-stores"
tags: ["Storage/Key-value stores"]
---

# Create key-value store

`POST /v2/key-value-stores`

Creates a key-value store and returns its object. The response is the same
object as returned by the [Get store](#/reference/key-value-stores/store-object/get-store)
endpoint.

Keep in mind that data stored under unnamed store follows [data retention
period](https://docs.apify.com/platform/storage#data-retention).

It creates a store with the given name if the parameter name is used.
If there is another store with the same name, the endpoint does not create a
new one and returns the existing object instead.

## Query parameters

- `name` string

## Response `200`

Returns the existing key-value store object if a store with the given name already exists.

- KeyValueStoreResponse — Response containing key-value store data.
  - `data` KeyValueStore, required
    - `id` string, required
    - `name` string, nullable
    - `userId` string, nullable
    - `username` string, nullable
    - `createdAt` string, date-time, required
    - `modifiedAt` string, date-time, required
    - `accessedAt` string, date-time, required
    - `actId` string, nullable
    - `actRunId` string, nullable
    - `consoleUrl` string, uri
    - `keysPublicUrl` string, uri — A public link to access keys of the key-value store directly.
    - `recordsPublicUrl` string, uri — A public link to access records of the key-value store directly.
    - `schema` object, nullable — Optional JSON schema describing the keys stored in the key-value store.
    - `urlSigningSecretKey` string, nullable — A secret key for generating signed public URLs. It is only provided to clients with WRITE permission for the key-value store.
    - `generalAccess` 'ANYONE_WITH_ID_CAN_READ' | 'ANYONE_WITH_NAME_CAN_READ' | 'FOLLOW_USER_SETTING' | 'RESTRICTED' — Defines the general access level for the resource.
    - `stats` KeyValueStoreStats
      - `readCount` integer
      - `writeCount` integer
      - `deleteCount` integer
      - `listCount` integer
      - `s3StorageBytes` integer
      - `storageBytes` integer

## Other responses

- `201`
- `400` — Bad request - invalid input parameters or request body.
- `401` — Unauthorized - authentication required or invalid token.
- `403` — Forbidden - insufficient permissions to perform this action.
- `405` — Method not allowed.
- `429` — Too many requests - rate limit exceeded.

---

[API](https://skmtc.net/apify/apis/apify-api.md) · [All operations](https://skmtc.net/apify/apis/apify-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/apify/apify-api/versions/01a71794279b/schema)
