RFQ API: Submit a Sourcing Request from Your Buyer Portal
Use the HioBuy RFQ API to submit structured sourcing requirements from your own backend, answer clarification questions, and record quotation decisions — which are not orders.
RFQ API: Submit a Sourcing Request from Your Buyer Portal
Product search is for items that already exist in a catalog. A request for quotation (RFQ) is for a requirement: quantity, destination, specifications, and optionally a target price or a sample. Your application collects that requirement from a signed-in buyer, your backend submits it, and a sourcing team comes back with questions or a quotation.
hiobuy/rfq is an open-source developer demo of that path (MIT, rfq-demo 0.2.0). It is a sample buyer portal ("Northwind Supply", all copy is synthetic) with its own backend. The browser never holds a HioBuy API key. The official contract is the RFQ API documentation; this repository is example code.
- Repository: github.com/hiobuy/rfq
- Live demo: rfq.demo.hiobuy.com (demo mode; image uploads only)
- Official docs: hiobuy.com/en/api-docs/rfq
- Runtime: Node.js 24+ locally, or Cloudflare Workers with a Durable Object
This tutorial covers:
- The architecture: browser → your backend → HioBuy Gateway → HIOAsk.
- How to confirm access with a production key (
GET /v1/ask/identity). - How to submit an RFQ, attach files, answer questions, and edit the requirement.
- How to record a quotation decision — and why that is not an order or a payment.
- Webhooks, batches, and what the demo deliberately leaves out.
The hosted demo sends requests to a real sourcing team. Do not enter personal or confidential data there. The demo allows 3 new RFQs per hour per client and 30 per day for the App, and it has no bulk entry.
What you are building
A buyer-facing screen in your own product that can:
- Create a structured RFQ on behalf of a signed-in user.
- Show status, open questions, and quotations that belong to that user.
- Let the user answer a question, update the requirement, or accept / decline / request a revision of a quotation.
- Stay current when the sourcing team replies, by verifying signed webhooks and then re-reading the RFQ.
HioBuy isolates Apps. Ownership inside your App — which of your users may see which RFQ, message, quotation, or attachment — is your responsibility. The demo maps each visitor to an opaque external_user_id and authorizes every record against that id (server/store.mjs).
What this demo is (and is not)
What it is:
- A full-stack example: React UI talking only to
/api/*on the same origin, and a Fetch-API backend (server/handler.mjs) that callshttps://api.hiobuy.com/v1/ask/rfqs*with a server-side Bearer key. - A working webhook receiver at
/hooks/hiobuythat verifiesHioBuy-Signature, deduplicates by event id, and treats events as notices, not as the source of truth. - Contract tests against an in-memory fake Gateway, plus a local preview harness. The demo runtime itself has no mock mode: a missing key or an upstream error is shown as an error.
What it is not:
- A white-label store, a catalog, or a purchasing system. Accepting a quotation records the customer's decision only. Use the order APIs separately for purchasing and payment.
- A document-parsing service. The public API does not parse uploaded PDFs, close an accepted RFQ, or expose read markers; the demo does not invent those operations.
- A batch-submission UI.
POST /v1/ask/rfq-batchesis documented below and in the official docs, but the hosted demo does not offer it.
Architecture
Browser ── /api/* ──▶ Your backend (API key + webhook secret stay here)
│
│ Bearer production key
▼
HioBuy Gateway ──▶ HIOAsk (sourcing team)
▲
HIOAsk ── signed webhook ─────┘
POST /hooks/hiobuy
(verify, ack, re-read the RFQ)

The backend also proxies attachment bytes. Storage URLs are never sent to the browser. Images are allowlisted (PNG, JPEG, WebP); PDFs, when enabled, are forwarded as downloads.
Step 1 — Confirm access with a production key
RFQ is not enabled by creating a key alone. A HioBuy administrator enables Supplier Inquiry, completes the HIOAsk V2 binding for your App, and grants the invitation permissions rfq:read and rfq:write. RFQ must also be turned on for the linked App in HIOAsk. See Access and authentication.
You need a production key of that App. Sandbox keys are rejected for RFQ operations (403 RFQ_SANDBOX_UNAVAILABLE). If the RFQ's linked conversation is in play, the App also needs supplier_inquiry:read and supplier_inquiry:write.
Keep the key on the server. Check access first:
GET /v1/ask/identity
Host: api.hiobuy.com
Authorization: Bearer YOUR_HIOBUY_PRODUCTION_KEY
The response reports effective permissions in data.rfq.read and data.rfq.write. data.rfq.enabled describes Gateway readiness and can be true with just one of those permissions. With read access, GET /v1/ask/rfqs?limit=1 confirms HIOAsk is enabled for the App — an empty list with HTTP 200 is a successful check. data.rfq.webhook_configured means at least one RFQ event is subscribed; it does not prove that every event type is configured or that delivery works.
Step 2 — Submit an RFQ
Send title, quantity, unit, and destination in requirement. The API also requires specifications, an HTTPS reference URL, or an authorized image from a linked conversation. Use stable, opaque identifiers for external_ref and external_user_id — never names, emails, or phone numbers. The demo prefixes external_ref so demo requests stay recognizable and unique per visitor.
Idempotency-Key is required on every POST and PATCH. Reuse the same key and payload to retry; a changed payload with the same key returns 409. Reusing a single RFQ's external_ref with different content returns 409 RFQ_EXTERNAL_REF_CONFLICT.
POST /v1/ask/rfqs
Host: api.hiobuy.com
Authorization: Bearer YOUR_HIOBUY_PRODUCTION_KEY
Content-Type: application/json
Idempotency-Key: rfq-example-001-create
{
"external_ref": "rfq-example-001",
"external_user_id": "customer-example-42",
"language": "en",
"requirement": {
"title": "Custom cotton tote bag",
"quantity": 500,
"unit": "pcs",
"destination": "US",
"specs": "Natural cotton canvas, two-color logo."
}
}
A submission creates a conversation with context.type=rfq, or links an existing open conversation owned by the same App. Optional BCP 47 language sets the new conversation's language and defaults to en. An existing conversation keeps its language settings.
List the caller's RFQs with GET /v1/ask/rfqs?external_user_id=… (and read one with GET /v1/ask/rfqs/{id}). Then authorize the result in your own store before you return it to the browser.
Statuses you will see include new, reviewing, awaiting_clarification, sourcing, quoted, revision_requested, accepted, unable_to_source, closed, and cancelled. The official schema notes that reviewing and sourcing both mean in progress.
Step 3 — Attach images or a PDF
Each RFQ allows eight requirement attachments in total. PNG, JPEG, and WebP images can be up to 10 MiB and 2,400 pixels per dimension. PDFs can be up to 20 MiB. Your HIOAsk App needs image permission for these uploads. Requirement attachments are outside the daily chat media budget.
Send the raw file bytes with the matching Content-Type, the current X-RFQ-Version, and an Idempotency-Key. Use optional X-Image-Filename for a percent-encoded display name.
curl --request POST "https://api.hiobuy.com/v1/ask/rfqs/${RFQ_ID}/attachments" \
--header "Authorization: Bearer ${HIOBUY_API_KEY}" \
--header "Content-Type: image/png" \
--header "X-RFQ-Version: 1" \
--header "X-Image-Filename: Front%20view.png" \
--header "Idempotency-Key: rfq-example-001-photo" \
--data-binary "@front-view.png"
The response includes kind (image or document), size in bytes, and content_path. Fetch that path from your backend with rfq:read:
GET /v1/ask/rfqs/{id}/attachments/{attachmentId}/content
PDFs are stored as uploaded, without scanning or conversion, and are served as downloads. Preserve Content-Disposition: attachment when you forward a PDF. An invalid PDF returns 415 UNSUPPORTED_FILE_TYPE; a PDF over 20 MiB returns 413 FILE_TOO_LARGE.
The hosted demo runs with DEMO_MODE on: it accepts image uploads only and returns 403 DEMO_PDF_DISABLED for PDFs. That limit is the demo's, not the API's. Set DEMO_MODE=false only for a private integration test.
Step 4 — Answer questions, edit the requirement, use the conversation
When the sourcing team needs a clarification, the RFQ moves to awaiting_clarification and open_questions is populated. Answer with POST /v1/ask/rfqs/{id}/answers. Pass the current RFQ version in the body. Pass question_id to answer a specific open question; omitting it answers the earliest one. The call creates a normal customer message.
POST /v1/ask/rfqs/{id}/answers
Host: api.hiobuy.com
Authorization: Bearer YOUR_HIOBUY_PRODUCTION_KEY
Content-Type: application/json
Idempotency-Key: rfq-example-001-answer
{
"version": 2,
"question_id": "22222222-2222-4222-8222-222222222222",
"text": "The print is one colour, PMS 186 C, on one side only."
}
To change the requirement itself, PATCH /v1/ask/rfqs/{id}/requirement with the current version and a partial requirement. An optional note (up to 2,000 characters) can go with the change. The public API returns the current requirement version only; the demo keeps its own change log so the UI can show what moved.
If you get 409 VERSION_CONFLICT, read the latest RFQ before preparing a new request. Cancel an open RFQ with POST /v1/ask/rfqs/{id}/cancel (this also withdraws the current sent quotation).
The linked conversation uses the Supplier Inquiry message API: GET and POST /v1/ask/conversations/{conversation_id}/messages. You can reference requirement attachments in a chat message with rfq_attachment_ids (combined limit across attachment_ids and rfq_attachment_ids is four). Details are on the RFQ API page and the Supplier Inquiry docs.
Step 5 — Record a quotation decision
List previously sent quotations with GET /v1/ask/rfqs/{id}/quotations, or read one version with GET /v1/ask/rfqs/{id}/quotations/{version}. History contains versions already sent to the customer. Record a decision only on the current sent version.
The URL {version} is the quotation version. The body version is the RFQ version. Actions are accepted, rejected, and revision_requested. If a quotation has several options, provide option_id when accepting.
POST /v1/ask/rfqs/{id}/quotations/{version}/decision
Host: api.hiobuy.com
Authorization: Bearer YOUR_HIOBUY_PRODUCTION_KEY
Content-Type: application/json
Idempotency-Key: rfq-example-001-accept
{
"version": 4,
"action": "accepted",
"option_id": "33333333-3333-4333-8333-333333333333"
}
Acceptance is not an order and not a payment. The official API says so explicitly. After the customer accepts, use the order APIs if you are going to purchase.
When you display an option image, resolve its image_id against that quotation's attachments and read the returned content_path from your backend with rfq:read. Do not expose storage URLs. A stale or superseded quotation cannot be decided (QUOTATION_NOT_CURRENT); an expired one needs a new quote (QUOTATION_EXPIRED).
Step 6 — Verify webhooks, then re-read
Subscribe on your App's HTTPS endpoint in the HioBuy Developer Center. The four RFQ events are:
ask.rfq.updatedask.rfq.quotation.sentask.rfq.quotation.withdrawnask.rfq.closed
Also subscribe to ask.message.created if you show the conversation. That event is sent only for published staff replies. Customer messages, including those that reference RFQ attachments, do not trigger it. Webhook payloads do not include rfq_attachments.
Follow the signature verification procedure using the HioBuy-Signature header and the exact raw request body. The demo's server/webhook.mjs implements that check, deduplicates by event id (delivery is at-least-once), and acknowledges quickly. Then the UI re-reads the RFQ. Events can arrive more than once or out of order; they are notices, not the source of truth.
Without a public webhook URL (for example, when you are running locally with no tunnel), the demo still refreshes on window focus and after each user action.
Submitting several RFQs at once
This is in the public API and in the repository README. It is not in the demo UI.
POST /v1/ask/rfq-batches creates 1–100 RFQs in one all-or-nothing transaction. Retry with the same Idempotency-Key. Each item takes the same fields as a single RFQ; external_ref must be unique within the batch.
POST /v1/ask/rfq-batches
Host: api.hiobuy.com
Authorization: Bearer YOUR_HIOBUY_PRODUCTION_KEY
Content-Type: application/json
Idempotency-Key: 6f1c2b0e-batch-po-2026-118
{
"external_batch_ref": "PO-2026-118",
"items": [
{
"external_ref": "NW-2001",
"external_user_id": "u_7f3a9c",
"requirement": {
"title": "Cotton canvas tote bag",
"quantity": 2000,
"unit": "pcs",
"destination": "Netherlands",
"specs": "12 oz natural canvas, one-colour print"
}
},
{
"external_ref": "NW-2002",
"external_user_id": "u_7f3a9c",
"requirement": {
"title": "Bamboo cutting board",
"quantity": 800,
"unit": "pcs",
"destination": "Netherlands",
"specs": "35 x 25 cm, juice groove"
}
}
]
}
A 201 response returns the batch with items[].id. Read progress with GET /v1/ask/rfq-batches/{id}. There is no endpoint that lists batches, so store the batch ids in your own system. Each RFQ is then handled, quoted, and decided on its own, exactly like a single RFQ.
Run the demo
Live: https://rfq.demo.hiobuy.com
Locally (Node.js 24+):
git clone https://github.com/hiobuy/rfq.git
cd rfq
npm ci
cp .dev.vars.example .dev.vars && chmod 600 .dev.vars
# fill in HIOBUY_API_KEY, and HIOBUY_WEBHOOK_SECRET if you have a tunnel
npm run build && npm start
# UI + backend: http://127.0.0.1:18891
For UI development, run npm run dev:backend and npm run dev (Vite on port 18890 proxies /api and /hooks). npm test runs the backend contract tests against the fake Gateway.
To deploy your own Worker, copy wrangler.jsonc, set PUBLIC_ORIGIN and your route, then npm run build, npx wrangler deploy, and put HIOBUY_API_KEY and HIOBUY_WEBHOOK_SECRET with npx wrangler secret put. Register <PUBLIC_ORIGIN>/hooks/hiobuy as the webhook endpoint. wrangler.production.jsonc is the configuration of the hosted demo.
What your backend must do
These rules come from the official docs and from what the demo implements. Skip any of them and you will either leak data or double-submit work.
- Hold
HIOBUY_API_KEYand the webhook secret as server secrets. They must not reach the browser, URLs, logs, or the database. - Map each signed-in user to an opaque
external_user_id. Authorize every RFQ, conversation message, and attachment against that user before you serve it. - Send your own reference as
external_ref. - Forward the RFQ
version(orX-RFQ-Versionon binary uploads) and anIdempotency-Keyon every write. OnVERSION_CONFLICT, reload and retry with a new key only after you have the latest state. - Proxy attachment content. Do not expose storage URLs.
- Verify
HioBuy-Signatureon the raw body, deduplicate by event id, acknowledge with 2xx, and re-read the RFQ.
Access errors
From the RFQ API docs:
| HTTP | Code | What to do |
|---|---|---|
| 403 | INSUFFICIENT_SCOPE | Check the invitation permission for the requested operation. |
| 403 | APP_NOT_MAPPED | Complete the HIOAsk V2 binding for the App. |
| 403 | APP_DISABLED | Check that the App and Supplier Inquiry are active. |
| 403 | RFQ_DISABLED | Enable RFQ for the linked App in HIOAsk. |
| 403 | RFQ_SANDBOX_UNAVAILABLE | Use a production key. |
You will also meet 409 VERSION_CONFLICT, 409 RFQ_EXTERNAL_REF_CONFLICT, REQUIREMENT_TOO_VAGUE when the requirement has no specs, reference URL, or image, and the attachment errors already listed. The demo adds its own codes such as DEMO_RATE_LIMITED and DEMO_PDF_DISABLED; those are not part of the public API.
Next steps
- Read the RFQ API page. It is the contract; the repo is an example.
- Confirm
GET /v1/ask/identityon a production key, thenGET /v1/ask/rfqs?limit=1. - Clone hiobuy/rfq and run it against your own App, or start from
server/handler.mjsandserver/gateway.mjsin your existing backend. - Register the four RFQ webhook events (and
ask.message.createdif you show chat) and verify signatures before you trust any UI refresh. - When a quotation is accepted, call the order APIs only if you actually intend to purchase. The decision endpoint does not do that for you.
Integration help: support@hiobuy.com. Bugs in the example: open an issue on the repository.
Next step
If you already understand the workflow, move to the API reference for exact request and response fields, or open the developer console to create your application.
Ready to build?
Open the API documentation or create your HIOBuy developer application.