> ## Documentation Index
> Fetch the complete documentation index at: https://upstash-context7-agent-09df3c1c-9c05-4093-9d6e-e4e2644ee98c-5.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Rate and Period

The rate specifies the maximum number of requests allowed in a given period (time window).

```typescript Configure Retry Attempt Count theme={null}
import { Client } from "@upstash/workflow";

const client = new Client({ token: "<QSTASH_TOKEN>" })

const { workflowRunId } = await client.trigger({
  url: "https://<YOUR_WORKFLOW_ENDPOINT>/<YOUR-WORKFLOW-ROUTE>",
  flowControl: {
    key: "user-signup",
    rate: 10,
    period: 100,
  }
})
```

**Example**:
If `rate = 2` and `period = 1 minute`, then **a maximum of 2 steps** can be executed per minute.

The first 2 requests within the minute are executed immediately:

<Frame caption="Steps are executed within limit">
  <img src="https://mintcdn.com/upstash-context7-agent-09df3c1c-9c05-4093-9d6e-e4e2644ee98c-5/MUUJo3wX3MySKgpL/img/workflow/rate_1.png?fit=max&auto=format&n=MUUJo3wX3MySKgpL&q=85&s=0373484e6b9f7a958eb9776484286d35" alt="Steps are executed within limit" width="2342" height="848" data-path="img/workflow/rate_1.png" />
</Frame>

The 3rd request in the same minute is not executed immediately:

<Frame caption="A new step cannot execute immediately">
  <img src="https://mintcdn.com/upstash-context7-agent-09df3c1c-9c05-4093-9d6e-e4e2644ee98c-5/MUUJo3wX3MySKgpL/img/workflow/rate_2.png?fit=max&auto=format&n=MUUJo3wX3MySKgpL&q=85&s=fcaf178dfc160b4d353e5b1247dad3ef" alt="A new step cannot execute immediately" width="2342" height="848" data-path="img/workflow/rate_2.png" />
</Frame>

Instead of rejecting it, Workflow schedules the request in the next available time window:

<Frame caption="The new step is moved to the next time window">
  <img src="https://mintcdn.com/upstash-context7-agent-09df3c1c-9c05-4093-9d6e-e4e2644ee98c-5/MUUJo3wX3MySKgpL/img/workflow/rate_3.png?fit=max&auto=format&n=MUUJo3wX3MySKgpL&q=85&s=9f86f4ff5dce7e18e969404ec3cf99af" alt="The new step is moved to the next time window" width="2342" height="848" data-path="img/workflow/rate_3.png" />
</Frame>

Note that step executions may take longer than the defined period.
The rate limit only controls how many steps are **started** within each time window,
it does not limit their execution duration.


## Related topics

- [Flow Control](/qstash/features/flowcontrol.md)
- [Overview](/workflow/features/flow-control.md)
- [Changelog](/qstash/overall/changelog.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.