Skip to content
  1. Blog
  2. Learning

Async API Architecture: Using Queues to Scale REST and gRPC Services

TL;DR: An async API saves the request, puts the slow work on a message queue and replies at once. Separate workers then do the heavy tasks in the background, with retries for jobs that fail. Our eSignature API uses the same idea when it tells your app about document events through webhooks.

Your sign-up endpoint saves a user, sends a welcome email, builds a PDF and calls a partner service. The user waits for all of it. One slow email server can push the request past its timeout.

A queue fixes this without a rewrite. You keep the fast, required step in the request and move the rest to the background. Try it first on endpoints that stay slow after indexing, caching and connection pooling.

Who should use asynchronous queues in APIs?

Queues help teams whose endpoints do slow work during the request. File processing, email, reports and calls to outside services are the usual cases.

  • Backend engineers looking after slow or fragile endpoints.
  • Architects designing representational state transfer (REST) or gRPC Remote Procedure Calls (gRPC) services that must scale.
  • API owners whose work depends on third-party services they cannot control.

Why do synchronous APIs break down at scale?

A synchronous API must finish every step before it replies. One slow step, such as a file upload or a partner call, slows down the whole request.

What happens in a synchronous API call?

  1. The client sends a request.
  2. The API does all the work inline: database writes, outside calls and file processing.
  3. The API replies only after everything finishes.

What goes wrong as traffic grows?

  • Response times grow as tasks pile up.
  • Requests time out when a downstream service slows down.
  • One failed step can fail the whole request.
  • Web servers carry heavy background work, so they scale poorly.

Picture a cashier who must walk to the warehouse for every item before ringing up a customer. The line grows fast, even when the cashier is quick at the till.

What is asynchronous API processing?

The API checks the request, puts the work on a queue and replies straight away. A separate worker picks up the job and does the heavy lifting.

What does the client receive?

  • A success response right away.
  • An optional job ID to track the work.
  • An optional status endpoint or webhook that reports when the job is done.

What happens behind the scenes?

The API publishes a message to the queue. A worker reads that message, does the job on its own schedule and confirms it once the work succeeds.

How do message queues work in API architecture?

A message queue holds jobs between the part that creates them and the part that does them. Your API stays quick, and workers clear the queue at their own pace.

What are the core parts of a queue?

Part What it does
Producer (your API) Checks the input and publishes a job message.
Queue or topic Stores messages until a worker handles them.
Consumer (worker) Runs the background task.

Which queue technologies are common?

What is the difference between synchronous and asynchronous APIs?

A synchronous API replies after the work is done. An asynchronous API replies once the work is queued, so the client waits far less.

Aspect Synchronous API Asynchronous API with a queue
Request flow Client, API, work, response Client, API, queue, response
Response time Includes all the processing Usually milliseconds
User experience Can feel slow or stuck Feels quick
Failures Errors reach the client Workers retry and park failed jobs
Scaling Web servers scale with the work Workers scale on their own
Coupling Tied to every dependency Separated by the queue

How does a welcome email work with a queue?

The API saves the new user and replies at once. A worker sends the email a moment later, so a slow mail server never delays sign-up.

  1. The client sends a POST request to /users.
  2. The API stores the user, adds a SEND_WELCOME_EMAIL job to the queue and returns 201 Created.
  3. A worker reads the job, sends the email and confirms success.
  4. After repeated failures, the queue moves the job to a dead-letter queue (DLQ).

What does the code look like in Node.js with RabbitMQ?

The API publishes a small job message, and a worker reads and confirms it. These two snippets show that split.

API (producer)

channel.sendToQueue(
  "welcome-emails",
  Buffer.from(JSON.stringify({ type: "SEND_WELCOME_EMAIL", email })),
  { persistent: true },
);

Worker (consumer)

channel.consume("welcome-emails", async (msg) => {
  const payload = JSON.parse(msg.content.toString());
  // send email
  channel.ack(msg);
});

The persistent: true option asks RabbitMQ to keep the message across a broker restart. The worker calls ack only after the email is sent, so a crash leaves the job in the queue.

How do you add a queue to an existing API?

Start with one slow endpoint and move its side tasks to a worker. Then repeat the pattern where it helps.

What will you need?

  • A queue service, such as SQS, Service Bus, RabbitMQ or Kafka.
  • A worker service or serverless function.
  • Monitoring, alerts and retry settings.

Steps to move slow work out of the request

  1. Find slow tasks the client does not need to wait for.
  2. Define a small job message that holds IDs, not whole records.
  3. Pick a queue that suits your cloud, scale and team.
  4. In the API, check the input, save it, queue the job and reply.
  5. Build workers that read, process, retry and confirm each job.

How do you keep it healthy after launch?

Watch queue depth, failures and retries, and add a DLQ for jobs that keep failing. Once one endpoint runs well, apply the same pattern to the next.

When should you use queues, and when should you avoid them?

Use queues to take slow side work out of the response. They add moving parts, so skip them where they bring little.

Use queues when

  • Tasks are slow or heavy.
  • The client does not need the result right away.
  • You need retries and fault tolerance.
  • Traffic comes in sudden spikes.

Avoid queues when

  • The work must finish before you reply.
  • You have no monitoring or alerts yet.
  • The system is small and simple.

What are good practices for queue-based APIs?

Keep messages small and make workers safe to run twice. Most problems come from large jobs and silent failures.

How should you design messages and workers?

  • Keep messages small and send IDs instead of full records.
  • Make workers idempotent, so a repeated message does no harm.
  • Add a correlation ID to trace one request across services.

How should you run the queue?

  • Set retry limits and a DLQ for every queue.
  • Keep critical and noncritical jobs in separate queues.
  • Add workers side by side as the load grows.
  • Limit who can publish to and read from each queue.

What mistakes should you avoid with queues?

The usual mistakes come from treating the queue as storage or ignoring what happens when jobs fail. Watch for these:

  • Using the queue as a database.
  • Packing too many tasks into one job.
  • Leaving out failure paths and DLQs.
  • Making the API wait for the worker to finish.
  • Running without metrics or alerts.

How do async patterns fit with the BoldSign API?

The BoldSign API is a REST API, and webhooks let us notify your application in real time when specific events occur. Each one arrives as a Hypertext Transfer Protocol (HTTP) POST request with a JavaScript Object Notation (JSON) body.

Your webhook handler can follow the pattern in this guide. Save the event, put a job on your queue and reply quickly, then let a worker update your records. Our guide on why webhooks matter in API integration covers the receiving side in more detail.

For the protocol choice itself, read our gRPC vs REST comparison and our gRPC performance guide.

Which BoldSign API plan do you need, and what does it cost?

You can test every endpoint in a free API sandbox account. Live API sending, with webhooks, is on the Enterprise API plan, from $30 a month with 40 envelopes.

Each extra envelope costs $0.75, as listed on the BoldSign pricing page in November 2026. Prices are in USD.

Where should you go next with async APIs?

You now know how queues keep an API quick, how to add one, and when to leave it out. Pick your next step:

Frequently asked questions

Does async processing always make an API faster?

It makes the response the client waits for faster. The whole job can take the same time, or a little longer, since each message waits in the queue first.

Can I use a message queue with both REST and gRPC?

Yes. REST and gRPC only shape how clients talk to your API, while the queue sits behind the API, so the same queue serves either protocol.

When should I pick Kafka instead of SQS or RabbitMQ?

Pick Kafka for high-volume event streams that several systems read or replay. For plain background jobs, a simple job queue is usually easier to run.

How does a client find out that a queued job has finished?

Give the client a job ID with the first response. It can then poll a status endpoint, or your service can call it back through a webhook.

Are message queues too much for a small app?

Sometimes. Low traffic and quick tasks often work fine in a normal request, so add a queue once slow work starts to hurt response times.

What is a dead-letter queue?

A dead-letter queue holds messages that failed too many times. You can inspect them, fix the cause and replay them instead of losing the work.

What status code should an async endpoint return?

Many APIs return 202 Accepted when work is queued but not done yet. Return 201 Created when the main record is saved and only side tasks are queued.

Why should queue workers be idempotent?

Most queues can deliver the same message more than once. An idempotent worker gives the same result on a repeat, so a retry never sends two emails.

Priya Vinayagam

Priya Vinayagam is a Product Manager at BoldSign and an active full-stack developer at Syncfusion, with four years of hands-on experience across .NET and JavaScript. She writes practical, performance-focused technical articles that help developers tackle real-world challenges. Known for looking beyond the obvious, Priya brings a builder’s mindset to every post—breaking down complex problems into clear, actionable solutions. Connect with her on LinkedIn.

More posts by Priya Vinayagam
Get started

Sign up for your free trial today!

Start free trial
  • 30-day free trial
  • No credit card required