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

# ARLEN

> Get the highest occupied array index plus one.

Use [ARCOUNT](./arcount) to count stored values.

## Arguments

<ParamField body="key" type="str" required>
  The array key.
</ParamField>

## Response

<ResponseField type="int" required>
  The highest occupied index plus one. A missing key returns `"0"` in TypeScript or `0` in Python. TypeScript returns a string even for small lengths.
</ResponseField>

<RequestExample>
  ```py Example theme={null}
  redis.arset("readings", 1000, "sample")
  print(redis.arlen("readings"))  # 1001
  print(redis.arcount("readings"))  # 1
  ```
</RequestExample>

See the [server command reference](/redis/commands/array/arlen) for protocol details.


## Related topics

- [ARLEN](/redis/commands/array/arlen.md)
- [ARCOUNT](/redis/sdks/ts/commands/array/arcount.md)
- [ARSET](/redis/sdks/py/commands/array/arset.md)
