OpenAPI Documentation
OpenAPI Documentation

Purchase dynamic traffic

Purchase dynamic traffic synchronously with the wallet balance. A successful response means the traffic is active and includes the corresponding traffic batch ID.

API information

Item Value
Method POST
Path /open-api/v1/dynamic/traffic/purchases
Authentication X-API-Key
Content-Type application/json
Processing Synchronous
Request number Required; protected for 24 hours

Request body

Field Type Required Description Constraints
request_no string Yes Caller-generated request number used only to prevent duplicate acceptance 1–64 characters; letters, digits, _, and - only
product_code string Yes Product code Use a value returned by the product list; maximum length 64
traffic_gb string Yes Traffic quantity in GB Greater than 0; plain decimal string with up to 6 decimal places; must satisfy the product specification

Payment methods, discount information, and unlisted fields are not accepted.

The purchase amount uses cumulative tiered pricing. Traffic covered by each tier is multiplied by that tier's unit price, and the amounts are added. The final total is rounded to four decimal places using HALF_UP; the full quantity is not priced at a single tier. Price is recalculated using the effective configuration when the order is submitted. Product-query results are estimates only.

Request example

curl --request POST \
  --url 'https://api-test.puraroute.com/gin/open-api/v1/dynamic/traffic/purchases' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <YOUR_API_KEY>' \
  --data '{
    "request_no": "traffic-20260824-001",
    "product_code": "DYNAMIC_1GB",
    "traffic_gb": "1.000000"
  }'

The product code above illustrates the format only. Use a value returned in real time by List dynamic traffic products.

Response fields

Field Type Description
order_no string Dynamic traffic order number
status string Always COMPLETED
product_code string Product code
traffic_gb string Traffic actually purchased, in GB
order_amount string USD order amount recalculated at order time; always 4 decimal places
currency string Always USD
traffic_lot_id string Traffic batch ID created by this purchase
finish_time string Completion time in GMT+8 ISO-8601

Successful response example

{
  "code": 0,
  "msg": "success",
  "data": {
    "order_no": "PO1912345678901234567",
    "status": "COMPLETED",
    "product_code": "DYNAMIC_1GB",
    "traffic_gb": "1.000000",
    "order_amount": "0.8500",
    "currency": "USD",
    "traffic_lot_id": "1912345678901234568",
    "finish_time": "2026-08-24T15:30:01.000+08:00"
  },
  "next": null
}

Possible error codes

code Description Recommended action
300006 Duplicate request number Query orders or traffic batches; do not resubmit
300184 Insufficient wallet balance Add funds, then purchase again with a new request number
300320 The resource price does not exist or does not match the requested specification.
400001 Authentication failed Check the API key
400009 The request parameters or traffic specification is invalid Correct the request
500000 System processing failed and the creation result may be uncertain Query orders, balance, and batches first; do not create again immediately

request_no only prevents duplicate acceptance; it is not a result-query key and does not replay the original result. See Request numbers and duplicate submissions.

On this page

Purchase dynamic traffic