Publish to a Queue via HTTP
Publish to a Queue directly via HTTP.
The following example shows you how to publish messages to a Queue from any HTTP client, using a Cloudflare API token to authenticate.
This allows you to write to a Queue from any service or programming language that supports HTTP, including Go, Rust, Python or even a Bash script.
- A queue created via the Cloudflare dashboard ↗ or the wrangler CLI.
- A Cloudflare API token with the
Queues Edit
permission.
To make sure you successfully authenticate and write a message to your queue, use curl
on the command line:
# Make sure to replace the placeholder with your shared secretcurl -XPOST -H "Authorization: Bearer <paste-your-api-token-here>" "https://api.cloudflare.com/client/v4/accounts/<paste-your-account-id-here>/queues/<paste-your-queue-id-here>/messages" --data '{ "body": { "greeting": "hello" } }'
{"success":true}
This will issue a HTTP POST request, and if successful, return a HTTP 200 with a success: true
response body.
- If you receive a HTTP 403, this is because your API token is invalid or does not have the
Queues Edit
permission.
For full documentation about the HTTP Push API, refer to the Cloudflare API documentation ↗.
Was this helpful?
- Resources
- API
- New to Cloudflare?
- Products
- Sponsorships
- Open Source
- Support
- Help Center
- System Status
- Compliance
- GDPR
- Company
- cloudflare.com
- Our team
- Careers
- © 2025 Cloudflare, Inc.
- Privacy Policy
- Terms of Use
- Report Security Issues
- Trademark