Rate limiting downstream APIs with Temporal

Temporal workers can call a downstream API faster than it can answer. This page explains where to set limits, how Retry Policies add backoff, and what to confirm before you rely on them.

On this page

Rate limiting downstream APIs with Temporal starts with where the load comes from

Most rate limiting problems in Temporal start with fan-out. A workflow splits work into activities, and each activity calls a partner, payment or internal API that has a quota. One workflow may be harmless, but a burst of workflows started by a batch job, a retry storm after an outage or a daily import can send far more calls per second than the provider allows. The activities are the component that touches the API, so that is where the control belongs, but the controls themselves sit on the worker and task queue side. Rate limiting in Temporal shapes how fast activities start, combined with retry backoff. It does not guarantee a provider's quota.

Teams usually need these controls in three situations: when several services or tenants share one API quota, when the provider bills per call and a spike has a direct cost, or when the provider starts returning HTTP 429 responses and the retries make the problem worse. Start by listing every downstream API an activity calls, the quota or contract limit for each, and the peak number of workflows that can start at the same time. Then identify which task queues and worker pools reach each API, because a limit set on one queue does not cap calls made from another.

Before you choose settings, confirm the exact option names, defaults and behavior for your Temporal SDK and Temporal Server versions, since rate and concurrency controls have changed across releases. Check the current SDK documentation for worker and task queue limits, and check the Temporal Server documentation for the matching server-side settings. Test the behavior under realistic load in a non-production namespace, and keep a record of which limit protects which API so that the next engineer can change it safely.

Where the limits sit between a workflow and the downstream API

The path starts when a workflow schedules an activity, which the Temporal service places on a task queue. A worker polls that queue, runs the activity, and the activity calls the downstream API, the system you are protecting. Each hand-off is a place a limit can apply: the queue's rate, the worker's concurrency, throttling inside the activity, and the Retry Policy that decides how quickly failed calls return. Check each point separately, because a limit set at one point does not protect the API from load arriving through another.

Four points where a limit can apply between a workflow and the protected API.

Which control to use for each kind of downstream pressure

This table compares the controls that limit load from Temporal workers on a downstream API, stating what each one limits, its scope and when it fits. Read each row before choosing, because the settings differ in scope and the exact names depend on your SDK and server release, which you should confirm before design.

ControlWhat it limitsScopeWhen it fits
Task queue rate limitRate of task dispatch from a task queue to workersPer task queue, set through the server or SDK (confirm the exact setting name for your release)Caps total call volume to one downstream API shared by all workers polling that queue
Worker concurrency cap on activitiesNumber of activity executions running at once in one worker processPer worker process or per activity type, depending on the SDK option usedProtects a downstream API from bursts caused by a single deployment of workers, and bounds memory use
Activity-level throttlingRate or concurrency of one activity type across workersPer activity type, often implemented in workflow code or a shared limiter (confirm SDK support)One API endpoint has its own quota that differs from other calls made by the same workflows
Priority and fairness settingsOrder in which queued tasks are dispatched when pressure buildsPer task queue or per workflow, depending on the feature (confirm availability in your server release)Several tenants or workflow types share one queue and one must not starve the others
Retry Policy backoffTiming of retries after a failed call, not the initial call ratePer activity, set through the activity's retry optionsDownstream errors such as throttling responses should slow retries rather than repeat quickly
Non-retryable error classificationRetries for errors that will not succeed on repeatPer activity, through error types in the retry optionsBusiness rejections should not consume quota through repeated attempts

Choosing between task queue, worker and activity limits

Each limit Temporal offers sits at a different layer: the task queue, the worker process, or the individual activity. The choices below decide who gets slowed down when a downstream API pushes back, and how far a limit drifts as the fleet grows.

Shared or per-tenant quotas

A single quota on a shared downstream API protects that API, but one noisy tenant or workflow type can use up the budget and delay every other customer on the same task queue. Per-tenant quotas isolate tenants, but they need one task queue or routing key per tenant and more configuration to keep in sync. Decide which party the downstream provider actually meters, then check that your queue layout matches that boundary before you tune any numbers.

Counting requests or concurrent connections

Some APIs limit requests per second, others limit open connections or in-flight calls. A requests-per-second cap on a worker does not stop a burst of slow calls from holding connections open, and a concurrency cap does not stop fast calls from exceeding a per-minute quota. Confirm which metric the provider enforces, and in your own environment check whether its errors come back as rate-limit responses or as timeouts.

Worker processes sharing one quota

When several worker processes poll the same task queue, a limit set on each process adds up to the total the API sees. Ten workers each allowed a fixed rate can send ten times that rate in aggregate. Decide whether the limit is a queue-level budget shared by the fleet or a per-process setting, and document the calculation so an operator who adds replicas knows what changes.

Per-worker limits under autoscaling

Autoscaling changes the arithmetic on every deploy and every scale event. A per-worker cap that looked safe at three replicas can overwhelm the API at thirty, and scale-down can leave a queue starved. Test the scaling path with the same load profile you expect in production, and record which settings are fixed per process and which must be recalculated when the replica count changes.

Priority and fairness between workflow types

When one workflow type runs large batches and another handles customer-facing requests, a shared limit lets the batch starve the urgent work. Priority and fairness settings can reorder task dispatch, but they do not replace a rate budget, and their effect depends on how many tasks are queued. Decide which workflow types must keep moving during a backlog, and test that order with a realistic mix of queued work before relying on it.

Retry backoff as a load control

Retry Policies determine how quickly failed activities try again, and an aggressive policy can turn a brief throttling response into a sustained flood. Longer intervals and a capped maximum attempt count reduce pressure on the API but delay every workflow that is waiting on the retry. Mark errors such as invalid input as non-retryable, and check that the backoff you configure matches the retry-after guidance the provider returns.

Self-hosted deployment docs

How Retry Policies add backoff and where they can make overload worse

Retry Policies control how hard a Temporal worker pushes on a failing downstream API, and their defaults are not a safe setting for every API. An activity Retry Policy sets the initial retry interval, the backoff coefficient that grows the wait between attempts, the maximum interval, the maximum attempts, and the error types that should never be retried. Those settings decide how many calls reach a struggling API and how quickly they arrive. After an outage, every queued activity can retry on the same schedule, which produces a retry storm that adds load to an API already under pressure. Before you rely on a policy, confirm the default values in the SDK you use and calculate the total call rate across all workflows that share the API, not the rate of a single activity.

When the provider answers with a rate-limit response, treat it as a signal to back off, not as a generic failure to retry quickly. Map the provider's status code and any retry-after header to a non-retryable or specially handled error in the activity, and let the Retry Policy wait at least as long as the provider's quota window needs to reset. If your retry interval is shorter than the window, every retry is rejected and consumes an attempt. If your maximum attempts run out before the window resets, the workflow fails when the API would have accepted the work a minute later. Ask the provider which quota windows apply (per second, per minute, per day, per key) and confirm how it reports them before you choose intervals.

Retries and rate limits have to be tuned together. A worker-side rate limit or concurrency cap that is set without the Retry Policy can still be overwhelmed by retries that bypass the intended pace, and a generous Retry Policy can undo a careful cap by sending the same work back repeatedly. Review every activity that calls the API, set an explicit Retry Policy instead of relying on the default, and test the combined behavior with a simulated outage and a simulated rate-limit response. For the full tuning method, including how to set attempts, intervals and non-retryable errors, see the sibling page on Temporal retry policies and non-retryable errors.

How the design changes for one API or many shared tenants

When a single downstream API with a published quota is called by one workflow type, the main risk is that your own parallelism exceeds what the provider allows. The usual fit is a dedicated task queue for the activities that call the API, a worker-level cap on concurrent activity executions, and a Retry Policy whose backoff spaces out attempts after the provider returns throttling responses. Because only one caller competes for the quota, the design can stay simple and tuned to the provider's documented limit.

  • Dedicated task queue: Route only the calls to this API onto their own queue so other work cannot consume its worker slots.
  • Concurrency cap per worker: Set the number of concurrent activity executions so the sum across all workers stays under the quota.
  • Backoff in the Retry Policy: Use an exponential interval with a maximum that respects the provider's reset window, and mark authorization failures as non-retryable.
  • Scaling caution: Adding workers multiplies the total request rate, so the cap has to be set for the whole fleet, not per pod.

Illustrative failure: a batch run is started with a large backlog, and the workers retry aggressively so the quota is exhausted within minutes. Confirm with the provider whether the quota is per key, per IP or per account, and how it is reset.

How to set up downstream rate limits in order

This sequence takes a team from the provider's documented limits to settings that keep Temporal workers within a downstream API's quota, including retries. Each step closes with a check so the team knows the control is working before the next one begins.

  1. Document the provider's limits and error responses

    Collect the provider's rate limit documentation for every API your workflows call: requests per second or minute, daily or monthly quotas, concurrency limits, and the exact error responses returned when a limit is hit, such as HTTP 429 with or without a Retry-After header. Ask the provider to confirm any limit that is not published, and note whether limits are per API key, per account or per IP address. The step is done when each API has a written limit sheet that the engineering and platform teams have both reviewed.

  2. Map each activity to the API it calls

    List every Activity type in the workflow code and record the downstream system, endpoint and credential each one uses. Some workflows call the same API from several Activities, and those calls share one quota, so group them by the API rather than by workflow. Confirm the mapping with the service owners and check it against the code, since an Activity added later can quietly add load. The step is done when every outbound call from a worker appears in one table that names its downstream API.

  3. Choose the control point for each API

    For each mapped API, decide where the limit is enforced: a task queue rate limit or worker-level concurrency cap in Temporal, an activity-level limit in the worker, the Retry Policy backoff for failed calls, or a gateway in front of the API. Temporal's task queue and worker controls shape how fast work is dispatched, while Retry Policies shape how failed attempts repeat. Record the reason for each choice and any API that needs a control outside Temporal. The step is done when each API has one named control point and an owner.

  4. Set concurrency and rate values in a test namespace

    Apply the chosen task queue rate limits, worker concurrency caps and Retry Policy settings in a test namespace that the team can already run workers against. Keep the values in version-controlled configuration so the change can be reviewed and reproduced. Confirm that the workers pick up the settings after a restart and that the values are visible in the Temporal Web UI or the CLI for the relevant task queue. The step is done when a reviewer can read the current values for every API from the repository and match them to the Temporal settings in the test namespace.

  5. Run a load test that reproduces a burst

    Start a burst of workflow executions that matches the worst realistic input the business expects, and include a run where the downstream API returns its limit error so that retries take place. Use a stub or sandbox of the provider where one is available, and count outbound calls at the API side or in a proxy log. Record throughput, queue backlog, retry counts and any time spent waiting in the queue. The step is done when the team has a repeatable test that shows how the system behaves under a burst.

  6. Confirm call volume with retries included

    Compare the number of calls the API receives during the burst with its documented quota for the same window, counting every retry attempt as a call. Retries are the most common reason a limit is exceeded, so a result that looks compliant without them is not enough. If the count exceeds the quota, lower the rate or concurrency value, lengthen the backoff, or mark errors as non-retryable where the provider says a retry will not succeed, then rerun the test. The step is done when the test shows the API received no more calls than its quota allows, with the evidence saved.

  7. Promote the settings through change control

    Move the reviewed settings to production through the organization's normal change process, with the limit sheet, the Activity mapping, the load test results and the call-count evidence attached to the change record. Schedule the change so the owners of each downstream API can watch for errors after it goes live, and agree on the metric that signals a problem, such as rising 429 responses or growing queue backlog. The step is done when production runs the approved values and the monitoring for each API is in place and assigned to an owner.

Security and operational risks of changing limits in production

Rate limits and concurrency caps are production controls, so changing them carries the same risk as changing firewall rules. The cards below cover who can change them, where downstream credentials sit, how retries can mask throttling, how to see backlog, and where the Temporal services are reachable from. Each card ends with a check your operations team can run.

Who can change limits

A self-hosted Temporal service with no Authorizer configured uses the default noopAuthorizer, which allows every API request with no authentication or access control. Anyone who can reach the frontend can change namespace-level behavior that affects how fast workers receive tasks. Check that an Authorizer is configured, that a ClaimMapper maps roles to namespaces, and that only named operators can change worker rate and concurrency settings. Keep a record of who changed each value and when.

Temporal security docs

Downstream credentials in workers

Activities that call downstream APIs need API keys or tokens, and those secrets usually live in worker environment variables or mounted files. A worker that is compromised, or a log line that prints a request header, exposes the credential to everyone who can read the worker. Check that each downstream credential is scoped to one API and one purpose, that workers pull it from a secrets store at startup, and that payload codecs or log filters keep it out of workflow history.

Retries that hide throttling

Retry Policies with generous maximum attempts and long backoff intervals can keep an activity running for hours while a provider returns throttling responses. The workflow looks healthy, but the account is accumulating rejected calls that may lead to a temporary block or a contract review. Check the attempt count and last failure type for activities that call each provider, and alert when retries for a single API exceed a threshold you set with the provider's documented limits.

Monitoring throttled activities

A worker-side rate limit slows task pickup without failing anything, so queue backlog grows quietly while latency rises. Teams often see the symptom in customer-facing delays before they see a metric. Check that dashboards show schedule-to-start latency and backlog per task queue, that activity failure and retry counts are tracked by downstream API, and that someone owns the alert when a queue stays above its normal depth for a sustained period.

Exposure of Temporal services

Temporal services should run on hosts that are not reachable from the public internet, with network access restricted to trusted internal networks. Because limit changes travel through the frontend, a publicly reachable endpoint combined with a missing Authorizer gives an outsider the ability to change them. Check the security groups or ingress rules for frontend and internode ports, confirm that mTLS is enabled for both internode and frontend traffic, and test the path from outside your network.

Self-hosted deployment docs

What buyers ask about rate limiting Temporal workers

What drives the effort of rate limiting Temporal workers?

The effort follows the number of downstream APIs that workers call, how many of them share a quota, how many workflow types reach each API, and what monitoring already exists. A single API with a dedicated quota and existing latency dashboards is a small job. Several APIs that share one vendor quota, with workflows that fan out into many activities, need more design and more load testing. Ask any partner to list each downstream API, its quota owner, its published limits, and the workflow types that call it before agreeing on scope.

How long does rate limiting work take?

The duration depends on the scope written into the engagement, so DeployOpen scopes it in writing before work starts and no duration is given here. The schedule is shaped by how many APIs and workflow types are in scope, how quickly quota agreements are confirmed, and how much load testing the client's environment allows. Ask for a written timeline with milestones for design, worker configuration, testing and handover, and check which items depend on the client.

What does the client need to provide for the work?

Plan to supply the API documentation for each downstream service, the quota and rate limit terms from each provider or internal owner, and test accounts or sandbox endpoints that allow realistic load. You also need a Temporal namespace where tests can run without touching production workflows, and access to the metrics and logs your workers already emit. Confirm early who can approve a quota change, because some limits are set by a vendor contract rather than by your team.

Can our internal team rate limit Temporal workers without a partner?

Yes, an internal team can do this alone if it can run load tests against non-production endpoints, read worker and task queue metrics, and change worker configuration through its normal deployment process. The harder part is knowing which downstream limits apply and how a burst of retries interacts with them. Teams without this experience usually benefit from a short design review to confirm the concurrency caps, task queue rate limits and Retry Policy backoff before they reach production.

What recurs after rate limiting is set up?

Tuning recurs. Provider quotas change, new workflow types start calling the same APIs, and traffic patterns shift with the business. Each Temporal SDK upgrade can also change worker behavior, so limits should be retested after upgrades. Plan an owner for reviewing dashboards for throttling errors and retry volume, a process for updating limits when a quota changes, and a periodic load test. If you want that continuing work handled by a partner, it can be arranged as a retainer after the initial scope is agreed in writing.

Which parts of the design are hardest to get right?

The hardest parts are the interactions between limits. A task queue rate limit can cap dispatch while a worker concurrency cap limits in-flight activities, and a Retry Policy with short intervals can still send a flood of attempts when a provider returns errors. Priority and fairness settings decide which workflows wait when capacity is short. Check that each limit matches the downstream quota, that backoff grows fast enough to ease pressure, and that non-retryable errors stop retries that would never succeed.

What should we check in our current setup before asking for a quote?

Gather the Temporal Server version and deployment method, the SDK and worker versions in use, the current worker concurrency settings, and any existing throttling or retry dashboards. Note which downstream APIs return rate limit responses today and how your teams respond to them. Also confirm whether the Temporal service runs on hosts that are not reachable from the public internet, since the Temporal deployment documentation recommends that layout. A written inventory like this makes a fixed-scope quote far more accurate.

Limits to confirm in your environment before relying on these controls

The controls covered on this page (task queue rate limits, worker limits, concurrency caps, priority and retry backoff) behave differently depending on server version, SDK, deployment model and the API you call. The values and behaviors below are not fixed in this page, so each one needs to be checked against the Temporal documentation and the provider's terms before you depend on it.

Exact setting names and availability

Confirm the precise names of the rate limit, concurrency and priority settings in the SDK and server versions you run, since they are added and changed across releases. Check whether each setting is set in code, on the worker, through the server or through the Temporal Cloud interface, and whether it is available in your language SDK. Record the versions you tested so the design is tied to a known combination. Do not rely on a setting name from an older example until you have matched it to your version.

Upgrade docs

Per worker or per task queue scope

Find out whether a limit applies to each worker process or is shared across every worker polling the task queue. A per-process limit multiplies as you add workers, so a limit that looks safe in testing can exceed the downstream quota in production. Check whether the throttle is enforced by the server or by each worker, and how many workers you expect at peak. Write the expected maximum request rate per API into your design before you choose values.

Behavior during autoscaling and restarts

Test what happens to a limit when workers scale out, scale in, crash or restart during a rollout. If a limit is set per process, new workers may add capacity the downstream API did not expect. If a shared limit is held in server state, check how in-flight tasks are counted when a worker stops. Include autoscaling events and rolling deployments in your load tests, and watch the downstream error rate during each one.

Changing limits without a restart

Confirm whether a rate or concurrency value can be changed on a running task queue, or whether a worker must restart to pick up a new value. Check whether the change takes effect immediately, after a delay, or only for newly polled tasks. Plan the procedure for lowering a limit during an incident, because a value that needs a restart may be too slow when the downstream API is already failing.

Self-hosted and Temporal Cloud differences

Compare the settings and their defaults between a self-hosted Temporal Service and Temporal Cloud before you choose where the controls live. Self-hosted operators manage dynamic configuration and worker processes themselves, while Temporal Cloud exposes its own namespace and capacity controls. Ask the vendor for the current list of supported controls on each deployment, and confirm how they are monitored and changed. Do not assume that a control available in one model exists in the other.

Temporal Cloud pricing

How the downstream API reports its quota

Ask the API provider how its quota is defined: requests per second, per minute, per day, per key or per account, and whether the limit is shared across your integrations. Find out which response codes and headers signal throttling, and whether they include a retry-after value your retry policy can honor. Read the provider's terms for any restriction on automated retries or bulk calls. Confirm these answers in writing before you set Retry Policy backoff values, because the provider's signals decide how your workflows should slow down.

How DeployOpen scopes and delivers downstream rate limiting for Temporal

DeployOpen plans, implements, tests and hands over Temporal worker and task queue throttling for downstream APIs inside infrastructure you control. Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts, and ongoing support is available as a retainer.

How we scope

  • Inventory each downstream API, its documented call limits, quotas and how it signals throttling to your workers.
  • Map which workflow types and activities call each API, and which share a worker pool or task queue.
  • Agree in writing which limits are enforced by worker settings, task queue rates, concurrency caps or retry backoff.

How we build

  • Configure worker concurrency and task queue rate limits per queue, with values set from the agreed limits of each API.
  • Set Retry Policies with backoff, maximum intervals and non-retryable error types so retries do not amplify load.
  • Test throttling under simulated load in a non-production namespace, then verify fairness and priority between competing workflow types.

How we hand over

  • Deliver the configuration as code with a record of each limit, its source, and the owner who approves changes.
  • Document the runbook for changing rate limits, adding a downstream API, and reading the metrics that show throttling.
  • Provide a retest plan so your team can rerun the load tests after Temporal Server or SDK upgrades.

How we support

  • Review throttling metrics and retry behavior after go-live, as agreed in the written scope.
  • Retest rate limits when a downstream provider changes its quotas or when workflow volume grows.
  • Continue support through a retainer covering upgrades, configuration changes and continuous testing.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.