# Source: https://upstash.com/docs/redis/sdks/ts/commands/string/msetnx.md

# Source: https://upstash.com/docs/redis/sdks/py/commands/string/msetnx.md

> ## Documentation Index
> Fetch the complete documentation index at: https://upstash.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# MSETNX

> Set multiple keys in one go unless they exist already.

For billing purposes, this counts as a single command.

## Arguments

<ParamField type="Record<str, TValue>" required>
  An object where the keys are the keys to set, and the values are the values to set.
</ParamField>

## Response

<ResponseField required>
  `1` if all keys were set, `0` if at least one key was not set.
</ResponseField>

<RequestExample>
  ```py Example theme={"system"}
  redis.msetnx({
      key1: 1,
      key2: "hello",
      key3: { a: 1, b: "hello" },
  })
  ```
</RequestExample>