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

# XADD

> Appends one or more new entries to a stream.

## Arguments

<ParamField body="key" type="string" required>
  The key to of the stream.
</ParamField>

<ParamField body="id" type="string | *" required>
  The stream entry ID. If `*` is passed, a new ID will be generated
  automatically.
</ParamField>

<ParamField body="entries" type="Record<string, unknown>" required>
  Key-value data to be appended to the stream.
</ParamField>

<ParamField body="options">
  <ParamField body="nomkStream" type="boolean">
    Prevent creating the stream if it does not exist.
  </ParamField>

  <ParamField body="trim">
    <ParamField body="type" type="'MAXLEN' | 'MINID'" required>
      The trim mode.
    </ParamField>

    {" "}

    <ParamField body="threshold" type="number | string" required>
      The threshold value for the trim mode.
    </ParamField>

    <ParamField body="comparison" type="~ | =" required>
      The comparison operator for the trim mode.
    </ParamField>

    <ParamField body="limit" type="number">
      Limit how many entries will be trimmed at most.
    </ParamField>
  </ParamField>
</ParamField>

## Response

<ResponseField type="string">The ID of the newly added entry.</ResponseField>

<RequestExample>
  ```ts Example
  await redis.xadd(key, "*", { name: "John Doe", age: 30 });

  ```

  ```ts Trimming
  await redis.xadd(key, "*", { name: "John Doe", age: 30 }, {
    trim: {
      type: "MAXLEN",
      threshold: 1000,
      comparison: "=",
    },
  });

  ```
</RequestExample>
