Create a shipping rate
const url = 'https://apibase.ecomweb.app/api/v1/stores/example/shipping-zones/1/rates';const options = { method: 'POST', headers: {'x-api-key': '<x-api-key>', 'Content-Type': 'application/json'}, body: '{"delivery_type":"STANDARD","display_name":"Giao tiêu chuẩn","rate_type":"FIXED","amount":25000,"condition_type":"NONE","min_value":1,"max_value":1,"estimated_days_min":1,"estimated_days_max":1,"carrier_code":"allingo","carrier_service_ids":["example"],"price_adjustment":-5000,"is_active":true,"sort_order":1}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://apibase.ecomweb.app/api/v1/stores/example/shipping-zones/1/rates \ --header 'Content-Type: application/json' \ --header 'x-api-key: <x-api-key>' \ --data '{ "delivery_type": "STANDARD", "display_name": "Giao tiêu chuẩn", "rate_type": "FIXED", "amount": 25000, "condition_type": "NONE", "min_value": 1, "max_value": 1, "estimated_days_min": 1, "estimated_days_max": 1, "carrier_code": "allingo", "carrier_service_ids": [ "example" ], "price_adjustment": -5000, "is_active": true, "sort_order": 1 }'Adds a rate to the zone. A FIXED rate charges amount. A CARRIER_QUOTE rate needs carrier_code allingo and at least one carrier_service_ids entry, takes its price from the carrier at checkout plus price_adjustment, forces amount to 0, and is refused with 400 unless the store has a connected carrier account.
Required scopes: write:shippings
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The ID of the shipping zone the rate belongs to.
The store’s ref, as returned by GET /stores.
Request Bodyrequired
Section titled “Request Bodyrequired”object
Kind of delivery.
Name shown to the shopper at checkout.
Example
Giao tiêu chuẩnZero means free
Example
25000What min_value and max_value are measured on: the order value or the weight in grams. Defaults to NONE, which always matches.
Lowest order value or weight, in grams, the rate applies to.
Highest order value or weight, in grams, the rate applies to.
Fastest estimated delivery, in days.
Slowest estimated delivery, in days.
Carrier of a carrier rate. Only allingo is supported.
AllinGo service ids; required (non-empty) for CARRIER_QUOTE
Signed VND added to the carrier quote
Example
-5000Whether the rate is offered at checkout.
Position of the rate in the zone’s list.
Responses
Section titled “Responses”object
Kind of delivery.
FIXED charges amount; CARRIER_QUOTE takes the price from the carrier at checkout.
What the rate’s min_value and max_value are measured on: NONE, the order value or the weight in grams.
Why an active carrier rate cannot produce options right now: carrier_not_connected, or null.
Rate ID.
ID of the zone the rate belongs to.
Name shown to the shopper at checkout.
Fee charged for a fixed rate; 0 means free. Always 0 for a carrier rate.
Lower bound of the condition, or null.
Upper bound of the condition, or null.
Fastest estimated delivery in days, or null.
Slowest estimated delivery in days, or null.
Carrier of a carrier rate: allingo. Null for a fixed rate.
IDs of the carrier services a carrier rate offers. Empty for a fixed rate.
Amount added to the carrier’s quote; may be negative. 0 for a fixed rate.
Whether the rate is offered at checkout.
Position of the rate in the zone’s list.
Example
{ "delivery_type": "STANDARD", "rate_type": "FIXED", "condition_type": "NONE", "active_reason": "carrier_not_connected"}The request is malformed or failed validation.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}The key is missing, invalid, revoked or expired.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}The key may not do this: a missing scope, a readonly key, a publishable key on a Store API route, or a disallowed origin.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}The resource does not exist in this store.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}