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

# QStash Getting Started

Building with an AI coding agent?

Connect the Upstash MCP server and the QStash skill to Claude Code, Cursor, Codex, and other agents.

[Open](https://upstash.com/docs/agent-resources/overview.md)

QStash is a **serverless messaging and scheduling solution**. It fits easily into your existing workflow and allows you to build reliable systems without managing infrastructure.

Instead of calling an endpoint directly, QStash acts as a middleman between you and an API to guarantee delivery, perform automatic retries on failure, and more.

![QStash benefits diagram](https://mintcdn.com/upstash/V1WwT580M-elE8rq/img/qstash/qstash-benefits.png?fit=max\&auto=format\&n=V1WwT580M-elE8rq\&q=85\&s=a49cf2890891033348a5493f7c299762)

> [!TIP]
>
> We have a new SDK called [Upstash Workflow](https://upstash.com/docs/workflow/getstarted).
>
> **Upstash Workflow SDK** is **QStash** simplified for your complex applications
>
> * Skip the details of preparing a complex dependent endpoints.
> * Focus on the essential parts.
> * Enjoy automatic retries and delivery guarantees.
> * Avoid platform-specific timeouts.
>
> Check out [Upstash Workflow Getting Started](https://upstash.com/docs/workflow/getstarted) for more.

## Quick Start

Check out these Quick Start guides to get started with QStash in your application.

> [card] [Next.js](https://upstash.com/docs/qstash/quickstarts/vercel-nextjs)
>
> Build a Next application that uses QStash to start a long-running job on your platform

> [card] [Python](https://upstash.com/docs/qstash/quickstarts/python-vercel)
>
> Build a Python application that uses QStash to schedule a daily job that clean up a database

Or continue reading to learn how to send your first message!

## Send your first message

> [!TIP]
>
> **Prerequisite**
>
> You need an Upstash account before publishing messages, create one
> [here](https://console.upstash.com).

### Public API

Make sure you have a publicly available HTTP API that you want to send your
messages to. If you don't, you can use something like
[requestcatcher.com](https://requestcatcher.com/), [webhook.site](https://webhook.site/) or
[webhook-test.com](https://webhook-test.com/) to try it out.

For example, you can use this URL to test your messages: [https://firstqstashmessage.requestcatcher.com](https://firstqstashmessage.requestcatcher.com)

### Get your QStash Token

Go to the [QStash tab in the Upstash Console](https://console.upstash.com/qstash),
pick the region you want to use (see [Select a Region](https://upstash.com/docs/qstash/howto/multi-region)),
and copy the `QSTASH_TOKEN` from the **Quickstart** section.

![QStash environment variables in the Upstash Console](https://mintcdn.com/upstash/fRHWNKJ-Wj14qjOi/img/qstash/console-quickstart-env.jpg?fit=max\&auto=format\&n=fRHWNKJ-Wj14qjOi\&q=85\&s=2283ef659469f4765a0318edacb4a1db)

### Publish a message

A message can be any shape or form: json, xml, binary, anything, that can be
transmitted in the http request body. We do not impose any restrictions other
than a size limit of 1 MB (which can be customized at your request).

In addition to the request body itself, you can also send HTTP headers. Learn
more about this in the [message publishing section](https://upstash.com/docs/qstash/howto/publishing).

```bash cURL theme={"system"}
curl -XPOST \
    -H 'Authorization: Bearer <QSTASH_TOKEN>' \
    -H "Content-type: application/json" \
    -d '{ "hello": "world" }' \
    'https://qstash.upstash.io/v2/publish/https://<your-api-url>'
```

```bash cURL RequestCatcher theme={"system"}
curl -XPOST \
    -H 'Authorization: Bearer <QSTASH_TOKEN>' \
    -H "Content-type: application/json" \
    -d '{ "hello": "world" }' \
    'https://qstash.upstash.io/v2/publish/https://firstqstashmessage.requestcatcher.com/test'
```

Don't worry, we have SDKs for different languages so you don't
have to make these requests manually.

### Check Response

You should receive a response with a unique message ID.

![Request Catcher response for a QStash message](https://mintcdn.com/upstash/V1WwT580M-elE8rq/img/qstash/reqcatcher.png?fit=max\&auto=format\&n=V1WwT580M-elE8rq\&q=85\&s=f68c3043856bf77c5e55786a54d57cd7)

### Check Message Status

Head over to [Upstash Console](https://console.upstash.com/qstash) and go to the
`Logs` tab where you can see your message activities.

![QStash message log in the Upstash Console](https://mintcdn.com/upstash/V1WwT580M-elE8rq/img/qstash/log.png?fit=max\&auto=format\&n=V1WwT580M-elE8rq\&q=85\&s=beb5fcdfa587a89b438d2db22938f6df)

Learn more about different states [here](https://upstash.com/docs/qstash/howto/debug-logs).

## Features and Use Cases

> [card] [Background Jobs](https://upstash.com/docs/qstash/features/background-jobs)
>
> Run long-running tasks in the background, without blocking your application

> [card] [Schedules](https://upstash.com/docs/qstash/features/schedules)
>
> Schedule messages to be delivered at a time in the future

> [card] [Fan out](https://upstash.com/docs/qstash/features/url-groups)
>
> Publish messages to multiple endpoints, in parallel, using URL Groups

> [card] [FIFO](https://upstash.com/docs/qstash/features/queues#ordered-delivery)
>
> Enqueue messages to be delivered one by one in the order they have enqueued.

> [card] [Flow Control](https://upstash.com/docs/qstash/features/flowcontrol)
>
> Custom rate per second and parallelism limits to avoid overflowing your endpoint.

> [card] [Callbacks](https://upstash.com/docs/qstash/features/callbacks)
>
> Get a response delivered to your API when a message is delivered

> [card] [Retry Failed Jobs](https://upstash.com/docs/qstash/features/dlq)
>
> Use a Dead Letter Queue to have full control over failed messages

> [card] [Deduplication](https://upstash.com/docs/qstash/features/deduplication)
>
> Prevent duplicate messages from being delivered

> [card] [LLM Integrations](https://upstash.com/docs/qstash/integrations/llm)
>
> Publish, enqueue, or batch chat completion requests using large language models with QStash
> features.

## SDKs


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