Create conversations & send messages

GET /v1/ask/identity

GET /v1/ask/identity
Authorization: Bearer YOUR_HIOBUY_PRODUCTION_KEY
{
  "data": {
    "app": {
      "id": "app_example",
      "name": "Example integration"
    },
    "api_key": {
      "environment": "production",
      "scopes": [
        "supplier_inquiry:read",
        "supplier_inquiry:write"
      ]
    },
    "inquiry": {
      "enabled": true,
      "mapped": true,
      "read": true,
      "write": true,
      "webhook_configured": true
    }
  }
}

Use https://api.hiobuy.com from your backend with Authorization: Bearer YOUR_HIOBUY_PRODUCTION_KEY. HIOBuy administration enables supplier inquiry for the App and provisions the V2 binding. Real chat requires a production Key and supplier_inquiry:read / supplier_inquiry:write. Identity inspection accepts any valid Key; a test Key reports environment=sandbox and cannot start real chat. This capability does not require warehouse fulfillment.

Create a conversation

Keep external_user_id stable for your customer and external_conversation_id stable for that customer + product + conversation generation. Both are 1–128 characters matching [A-Za-z0-9][A-Za-z0-9._:@-]{0,127}. Required on every POST: Idempotency-Key, 1–128 printable ASCII characters. Persist the request body and key before sending; after a timeout retry the same request. A changed payload with the same identity/key returns 409. A closed conversation stays closed; use a new generation ID for a new inquiry.

language is an optional canonical BCP 47 customer-language hint such as en or en-US; omit it or use null when unknown. target_language is the customer-facing reply language. Automatic language detection and translation processing details are private staff metadata. Use the customer language when known; no translation-preview API call is required from your app.

POST /v1/ask/conversations
Authorization: Bearer YOUR_HIOBUY_PRODUCTION_KEY
Content-Type: application/json
Idempotency-Key: create-customer-42-product-1
 
{
  "external_conversation_id": "customer-42-1688-673124809943-1",
  "external_user_id": "customer-42",
  "language": "en",
  "context": {
    "type": "product",
    "product_url": "https://detail.1688.com/offer/673124809943.html",
    "product_id": "673124809943",
    "product_title": "Knitted shoulder bag"
  }
}
{
  "data": {
    "id": "11111111-1111-4111-8111-111111111111",
    "external_app_id": "hiobuy:app_example",
    "external_conversation_id": "customer-42-1688-673124809943-1",
    "external_user_id": "customer-42",
    "language": "en",
    "context": {
      "type": "product",
      "product_url": "https://detail.1688.com/offer/673124809943.html",
      "product_id": "673124809943",
      "product_title": "Knitted shoulder bag"
    },
    "target_language": "en",
    "status": "pending",
    "last_message_at": null,
    "created_at": "2026-11-13T13:00:00.000Z",
    "updated_at": "2026-11-13T13:00:00.000Z"
  }
}

Send a message

After creation, save data.id as the conversation UUID, then send the first customer message. client_message_id is another stable 1–128 character identifier. Use type=text; content supports up to 10,000 Unicode code points and must not be blank unless a product card is supplied. Only the first customer message may include product_card. Its URL must be a canonical HTTPS 1688/Taobao/Tmall item URL; title is 1–200 plain characters, optional price_label at most 64. Send later messages on the same conversation without the card. IDs below are examples; substitute the returned conversation UUID.

POST /v1/ask/conversations/11111111-1111-4111-8111-111111111111/messages
Authorization: Bearer YOUR_HIOBUY_PRODUCTION_KEY
Content-Type: application/json
Idempotency-Key: send-customer-message-001
 
{
  "client_message_id": "customer-message-001",
  "type": "text",
  "content": "Can the supplier provide neutral packaging?",
  "product_card": {
    "url": "https://detail.1688.com/offer/673124809943.html",
    "title": "Knitted shoulder bag",
    "price_label": "CNY 6.50"
  }
}

201 Created / 200 OK

Public history contains original customer text and published customer-facing staff replies (sender_type=customer or staff). Private staff drafts, originals and internal notes are excluded. For integrations explicitly enabled for post-send recall, staff replies publish immediately after translation, without a fixed 30-second hold. Staff may recall them for 30 seconds from the server publication transaction; this deadline is not exposed by the public API and must not be inferred from created_at or Webhook delivery time. Legacy integrations retain their existing pre-publication hold until compatibility is confirmed. A recalled reply remains as a terminal recalled_at placeholder with empty content, no media and the original message ID/order; do not invent a status=recalled value. Incoming translation_status=pending is not a delivery failure. Do not overwrite the customer’s original text.

Try the real Inquiry Demo  and read its MIT-licensed source . The hosted demo uses its own server-configured Key and one fixed product. For your integration, configure your own production Key, product/channel and HTTPS Webhook. Demo/test conversations must set context.source=inquiry_demo; ordinary integrations omit it.

History, closure & ratings · Webhooks & delivery

Images

Confirm image permission with HIOBuy first. Send raw PNG/JPEG/WebP bytes from your backend, with a stable Idempotency-Key, matching Content-Type and X-Image-Filename (percent-encode non-ASCII filenames; decoded name at most 128 characters). Do not use multipart, base64 JSON or remote URLs. Resize proportionally to at most 2400 × 2400 pixels before upload; keep each file at most 10 MiB. Upload responses return metadata only, not a public URL.

Then send attachment_ids on the same conversation, at most four previously uploaded, unused, unexpired IDs accessible to the acting integration. Image-only: type=image, content="". Text with images: type=text and text content. A first-message product_card.image_attachment_id, when supplied, must also be in attachment_ids. Authorize each end user on your own backend. Uploading is separate from sending; preserve upload and send IDs/keys independently for retries.

curl --request POST \
  'https://api.hiobuy.com/v1/ask/conversations/11111111-1111-4111-8111-111111111111/attachments' \
  --header 'Authorization: Bearer YOUR_HIOBUY_PRODUCTION_KEY' \
  --header 'Idempotency-Key: upload-packaging-001' \
  --header 'Content-Type: image/png' \
  --header 'X-Image-Filename: packaging.png' \
  --data-binary '@packaging.png'
{
  "data": {
    "id": "33333333-3333-4333-8333-333333333333",
    "filename": "packaging.png",
    "content_type": "image/png",
    "size": 12345,
    "width": 1200,
    "height": 800,
    "content_path": "/v1/ask/attachments/33333333-3333-4333-8333-333333333333/content"
  }
}
POST /v1/ask/conversations/11111111-1111-4111-8111-111111111111/messages
Authorization: Bearer YOUR_HIOBUY_PRODUCTION_KEY
Content-Type: application/json
Idempotency-Key: send-packaging-001
 
{
  "client_message_id": "customer-image-001",
  "type": "image",
  "content": "",
  "attachment_ids": [
    "33333333-3333-4333-8333-333333333333"
  ]
}

Resolve content_path against https://api.hiobuy.com and fetch with your server-side HIOBuy Bearer Key and read scope. Relay bytes only to the customer authorized for that conversation; never expose the Key or treat the path as a public R2 URL. ?download=1 requests a download. Recalled message media must disappear from your display and public caches. Do not promise antivirus scanning, metadata removal or automatic re-encoding: those are not guarantees of the current upload contract. Invalid type/size/dimensions produce explicit errors (including HTTP 413/415/422); permission-disabled upstream calls may map to 502 HIOASK_INTEGRATION_REJECTED.

Get Support

Need integration help? Contact Developer Support at support@hiobuy.com · Response within 1–2 business days

Email support