Skip to main content

Orders API

Version: 1.0

Table of contents​

Overview​

An Order represents a customer's request to purchase one or more products from a shop. This AI-facing Orders API specification supports reading and filtering orders, counting orders, retrieving a specific order, updating a limited set of attributes, changing order lifecycle state, managing tags, and assigning advanced order-processing responsibility.

Creating orders is outside the scope of this specification; see Capabilities.

This specification covers exactly seven write operations, each targeting one existing order:

Admin features described in Help do not extend this API contract.

Concepts and terminology​

Order identifiers​

FieldMeaning
idNumeric identifier used in API paths such as /com/orders/{order_id}.json.
order_numberIdentifier intended for the merchant and customer. It is distinct from the API id.
nameDisplay name generated from the order number plus the merchant's configured prefix and suffix. The API can also set this field to a string value.
numberPosition of the order in the shop's order count.
tokenUnique value used when referencing the order.
cart_tokenIdentifier of the cart associated with the order.
checkout_tokenIdentifier of the checkout associated with the order.

Use id, not order_number, name, or number, as {order_id} in documented API paths.

Order lifecycle state​

ConceptDocumented values or meaning
Confirmationconfirmed_at records when the order was confirmed. confirmed_status is shown as unconfirmed before confirmation. The complete set of confirmed_status values is not specified.
Closureclosed_at is the close timestamp or null. closed_status is shown as unclosed before closure. A closed order has no more work to perform because its items have been fulfilled or refunded.
Cancellationcancelled_at is the cancellation timestamp or null. cancelled_status is shown as uncancelled before cancellation and cancelled in a cancellation example.

Payment status​

financial_status is read-only in this specification; see Business and API rules. Documented values are:

ValueMeaning
pendingPayment is pending and might still fail.
authorizedPayment has been authorized.
partially_paidOrder has been partially paid.
paidPayment has been recorded as paid.
partially_refundedPayment has been partially refunded.
refundedPayment has been refunded.
voidedPayment has been voided.

Use partially_paid with an underscore. partiallypaid is not a documented value.

Fulfillment status​

The Order resource documents these fulfillment_status values:

ValueMeaning
nullNo line item has been fulfilled.
partialAt least one line item has been fulfilled.
fulfilledEvery line item has been fulfilled.
restockedEvery line item has been restocked and the order cancelled.

The list endpoint uses different filter terms: unshipped, shipped, and partial. Do not substitute resource values for filter values.

Cancellation reasons​

ValueMeaning
customerCustomer changed or cancelled the order.
fraudOrder was fraudulent.
inventoryItems were not available in inventory.
declinedPayment was declined.
otherCancellation reason is not represented by another value.

Capabilities​

The documented API can:

  • List orders with server-side filters, field selection, sorting, and page-based pagination.
  • Count all orders or count cancelled orders using the documented example.
  • Retrieve an order by its API id.
  • Confirm, close, or reopen an order.
  • Update note and note_attributes using the documented update examples.
  • Add or remove tags.
  • Assign users, groups, and a location for advanced order processing.

The documented API does not provide an endpoint that deletes the Order resource. A DELETE endpoint exists only for removing tags.

Create Order is excluded from the AI capability set. Do not call or propose POST /com/orders.json, even when the credential has com.write_orders.

Business and API rules​

  • Write requests target one existing order by API ID. Use the documented JSON envelope for each operation; field presence in a response does not establish writability.
  • Confirmation, closure, payment, and fulfillment are separate states. Do not send undocumented lifecycle fields through the generic update endpoint.
  • financial_status and source_name can be set only when an order is created. They are read-only in this specification.
  • Orders created through Haravan POS might not have an attached customer. Consumers must handle customer: null.
  • billing_address can be absent when an order does not require a payment method.
  • shipping_address can be absent when an order does not require shipping.
  • Tags are stored as a comma-separated string. Each individual tag is limited to 40 characters.
  • total_price and total_tax are documented as positive values.
  • total_weight is not adjusted when items are removed from the order.
  • A gift-card line item is not taxed and is not included in shipping charges.
  • A closed order is described as having no remaining work because all items have been fulfilled or refunded.
  • Assignment is documented only for shops using advanced order processing.

API operations​

Base URL: https://apis.haravan.com. JSON request examples use Content-Type: application/json and Accept: application/json; supply the integration's configured authentication and replace sample IDs with verified shop IDs. Examples are illustrative.

List orders​

Purpose​

Use this operation to retrieve multiple orders and narrow the result on the server. Prefer it over downloading all orders and filtering locally.

Endpoint​

GET https://apis.haravan.com/com/orders.json

Input​

All inputs are query parameters.

ParameterTypeRequiredDescription
idsstringNoComma-separated API order IDs.
limitintegerNoResults per page. Default 50; maximum 50.
pagenot specifiedNoPage to return.
since_idnot specifiedNoReturn results after the specified API ID.
created_at_minISO 8601 timestampNoOrders created after the timestamp.
created_at_maxISO 8601 timestampNoOrders created before the timestamp.
updated_at_minISO 8601 timestampNoOrders updated after the timestamp.
updated_at_maxISO 8601 timestampNoOrders updated before the timestamp.
processed_at_minISO 8601 timestampNoOrders imported after the timestamp.
processed_at_maxISO 8601 timestampNoOrders imported before the timestamp.
financial_statusstringNopending, paid, partially_paid, refunded, voided, or partially_refunded. The list filter does not document authorized.
fulfillment_statusstringNounshipped, shipped, or partial.
statusstringNoopen, closed, cancelled, or any. any includes archived orders.
fieldsstringNoComma-separated fields to include in the response.
orderstringNoSort by created_at or updated_at, followed by asc or desc.

Output​

Returns HTTP 200 OK with an orders array. Each entry is an Order object. When fields is supplied, the examples show only the selected fields.

Constraints​

  • Page size cannot exceed 50.
  • Only created_at and updated_at are documented as sortable.
  • The default sort order is not specified.

Examples​

GET /com/orders.json?page=1
GET /com/orders.json?updated_at_min=2021-01-04T00:00:00.000Z
GET /com/orders.json?fields=id,name,created_at
GET /com/orders.json?since_id=1138637000
GET /com/orders.json?order=created_at%20desc

Count orders​

Purpose​

Use this operation when only the number of matching orders is needed and the Order objects themselves are unnecessary.

Endpoint​

GET https://apis.haravan.com/com/orders/count.json

Input​

Supports the same query parameters as List orders, including filters such as status, financial_status, fulfillment_status, date ranges, etc. The count reflects the orders matching the supplied parameters.

Output​

Returns HTTP 200 OK with a numeric count.

{
"count": 500
}

Constraints​

Count-specific limits are not specified.

Retrieve an order​

Purpose​

Use this operation when the API id of a specific order is known and the full Order resource is required.

Endpoint​

GET https://apis.haravan.com/com/orders/{order_id}.json

Input​

ParameterTypeRequiredDescription
order_idnumberYesOrder API ID in the path.

Output​

Returns HTTP 200 OK with an order object.

Constraints​

The error response for an unknown order_id is not specified.

Confirm an order​

Purpose​

Use this operation to confirm an existing order.

Endpoint​

POST https://apis.haravan.com/com/orders/{order_id}/confirm.json

Input​

ParameterTypeRequiredDescription
order_idnumberYesOrder API ID in the path.

The documented request body is an empty JSON object ({}).

Output​

Returns HTTP 200 OK with the updated order object.

Read order.id and confirmed_at to identify the order and its confirmation timestamp. The complete set of confirmation-status values is not specified.

Constraints​

Eligible states, repeat-call behavior, and confirmation-specific errors are not specified.

Order verification, payment confirmation, stock dispatch, and fulfillment creation are separate steps. Do not describe this operation as collecting payment or completing delivery. Its inventory and notification side effects are not specified.

Examples​

POST https://apis.haravan.com/com/orders/1225418252/confirm.json
Accept: application/json
Content-Type: application/json

{}

Close an order​

Purpose​

Use this operation when an order has no more work to perform because all items have been fulfilled or refunded.

Endpoint​

POST https://apis.haravan.com/com/orders/{order_id}/close.json

Input​

ParameterTypeRequiredDescription
order_idnumberYesOrder API ID in the path.

The documented request body is an empty JSON object ({}).

Output​

Returns HTTP 200 OK with the updated order object.

Read order.id and closed_at. The latter records closure time; it does not establish payment or delivery completion.

Constraints​

Server validation for orders that are not fully fulfilled or refunded is not specified.

The Admin Archive / Unarchive actions are recommended after delivery and payment are complete. This is workflow guidance, not an API validation rule. Whether these actions correspond exactly to close / open is not specified. Closure is not proof of payment or delivery.

Examples​

POST https://apis.haravan.com/com/orders/1225418252/close.json
Accept: application/json
Content-Type: application/json

{}

Reopen a closed order​

Purpose​

Use this operation to reopen an order that is closed.

Endpoint​

POST https://apis.haravan.com/com/orders/{order_id}/open.json

Input​

ParameterTypeRequiredDescription
order_idnumberYesOrder API ID in the path.

The documented request body is an empty JSON object ({}).

Output​

Returns HTTP 200 OK with the updated order object.

Read order.id and closed_at; the resource definition uses null when the order is not closed. Payment and fulfillment statuses are independent.

Constraints​

Behavior when the order is not closed is not specified.

Do not infer that reopening reverses payment or fulfillment. Those effects and repeat-call behavior are not specified.

Examples​

POST https://apis.haravan.com/com/orders/1225418252/open.json
Accept: application/json
Content-Type: application/json

{}

Update an order​

Purpose​

Use this operation only for the documented mutable attributes, note and note_attributes.

Endpoint​

PUT https://apis.haravan.com/com/orders/{order_id}.json

Input​

The request body uses an order envelope. Documented examples cover note and note_attributes; the full list of mutable fields is not specified.

ParameterTypeRequiredDescription
order_idnumberYesOrder API ID in the path; do not use display order numbers.
orderobjectDocumented envelopeContains the attributes to update.
order.idnumberNot specifiedIncluded in examples; keep consistent with the path. Omission support is unspecified.
order.notestringNot specifiedOrder note; null/empty clearing semantics unspecified.
order.note_attributesarray of objectsNot specifiedObjects with name and value strings. Replacement and omission behavior is not specified; do not assume per-key merging.

Output​

Returns HTTP 200 OK with the updated order object.

Read the returned note or note_attributes to report the resulting values. Do not assume other submitted fields were accepted.

Constraints​

  • Line items and their quantities cannot be changed.
  • The complete list of mutable attributes is not specified. Do not assume a field is writable because it appears in a response.
  • financial_status and source_name are read-only; see Business and API rules.

The order note is separate from internal history comments; this operation is not documented as adding a history comment. Admin editing of products, quantities, and prices is not available through this operation.

Examples​

PUT https://apis.haravan.com/com/orders/1225418252.json
Accept: application/json
Content-Type: application/json

{
"order": {
"id": 1225418252,
"note": "Customer contacted us about a custom engraving"
}
}

Update additional details (note_attributes):

PUT https://apis.haravan.com/com/orders/1225418252.json
Accept: application/json
Content-Type: application/json

{
"order": {
"id": 1225418252,
"note_attributes": [
{
"name": "colour",
"value": "red"
}
]
}
}

Add order tags​

Purpose​

Use this operation to add tags while preserving tags that are not named in the request.

Endpoint​

POST https://apis.haravan.com/com/orders/{order_id}/tags.json

Input​

ParameterTypeRequiredDescription
order_idnumberYesOrder API ID in the path.
tagsstringIncluded in exampleComma-separated tag names in the JSON body. Omission behavior is not specified.

Output​

Returns HTTP 200 OK with the resulting comma-separated tags string. The example adds a1,a2 to existing VIP and returns VIP,a1,a2.

{"tags": "VIP,a1,a2"}

Constraints​

  • The path targets one order; tags is a comma-separated string, not an array. Duplicate handling, case sensitivity, whitespace normalization, and empty-string behavior are not specified.
  • Admin can change tags on multiple orders at once; no bulk tag operation is documented for the API.
  • Use POST for this operation.

Examples​

POST https://apis.haravan.com/com/orders/1225418252/tags.json
Accept: application/json
Content-Type: application/json

{
"tags": "a1,a2"
}

Delete order tags​

Purpose​

Use this operation to remove the tags named in the request. It does not delete the Order resource.

Endpoint​

DELETE https://apis.haravan.com/com/orders/{order_id}/tags.json

Input​

ParameterTypeRequiredDescription
order_idnumberYesOrder API ID in the path.
tagsstringIncluded in exampleComma-separated tag names in the JSON body. Omission behavior is not specified.

Output​

Returns HTTP 200 OK with the remaining comma-separated tags string. The example removes a1,a2 and returns VIP.

{"tags": "VIP"}

Constraints​

Behavior when a requested tag is not present is not specified.

Use DELETE with the documented JSON body. It removes named tags from this order, not globally. Empty input, removing the final tag, matching rules, and repeat-call behavior are not specified.

Examples​

DELETE https://apis.haravan.com/com/orders/1225418252/tags.json
Accept: application/json
Content-Type: application/json

{
"tags": "a1,a2"
}

Assign order handling​

Purpose​

Use this operation to assign handling users, user groups, and a location when advanced order processing is enabled.

Endpoint​

POST https://apis.haravan.com/com/orders/{order_id}/assign.json

Input​

Whether each array can contain multiple values, what group_user_ids: [0] represents, and which fields are individually required are not specified.

ParameterTypeRequiredDescription
order_idnumberYesOrder API ID in the path.
user_idsarray of numbersNot specifiedHandling users; lookup endpoint and maximum cardinality unspecified.
group_user_idsarray of numbersNot specifiedHandling groups. [0] appears in the example; it is not a documented default or unassign command.
location_idnumberNot specifiedAssignment location; eligible locations and inventory effects unspecified.

Do not substitute employee names for IDs. Omitted fields, empty arrays, changing an existing assignment, and removing assignment have no documented semantics.

Output​

Returns HTTP 200 OK with the updated order. The example includes assignment fields such as assigned_location_id, assigned_location_name, assigned_location_at, and order_processing_status.

Constraints​

  • This operation is documented only for advanced order processing.
  • Eligibility, assignment validation, and permission errors are not documented.
  • In Admin, group/user assignment is part of advanced order processing and is available on Scale or higher packages. Whether the API enforces package eligibility and employee/location permissions is not specified.

Examples​

The meaning of group_user_ids: [0] in this example is not specified; do not use it as a default.

POST https://apis.haravan.com/com/orders/1225418252/assign.json
Accept: application/json
Content-Type: application/json

{
"user_ids": [200001038919],
"group_user_ids": [0],
"location_id": 876530
}

Data definitions​

Core Order fields​

FieldTypeDefinition and constraints
idnumberAPI identifier for the Order.
namestringMerchant/customer display name; generated from number plus configured prefix/suffix unless explicitly set by API.
numbernumberPosition in the shop's order count.
order_numberstringMerchant/customer identifier, distinct from API id.
emailstringCustomer email address.
contact_emailstringContact email of the buyer. Its relationship to email is not specified.
notestringOptional note attached by the merchant.
note_attributesarrayAdditional name/value details displayed in the order's Additional details section.
tagsstringComma-separated tags.
currencystringThree-letter ISO 4217 shop currency code.
created_atstringCreation timestamp in ISO 8601 format.
updated_atstringLast-update timestamp in ISO 8601 format.
confirmed_atstring or nullConfirmation timestamp in ISO 8601 format.
closed_atstring or nullClosure timestamp in ISO 8601 format.
cancelled_atstring or nullCancellation timestamp in ISO 8601 format.
cancel_reasonstring or nullDocumented cancellation-reason enum.
financial_statusstringPayment status; read-only.
fulfillment_statusstring or nullOverall fulfillment state.
processing_methodstring or nullcheckout, direct, manual, or offsite.
source_namestringOrder source; read-only, with protected Haravan channel values.
gatewaystringPayment gateway name recorded on the order.
gateway_codestringUnique identifier of the recorded payment gateway.
user_idnumberHaravan POS user who processed the order, when applicable.
location_idnumberPhysical location where the order was processed.

Timestamps use ISO 8601. Examples use UTC with a Z suffix (for example, 2021-05-13T07:29:20.1Z); the timezone of every response is not guaranteed. Send filter timestamps in UTC with Z; do not assume local timezone conversion.

Amount and weight fields​

FieldTypeMeaning
subtotal_pricenumberPrice after discounts and before shipping, duties, taxes, and tips.
total_discountsnumberTotal discounts in shop currency.
total_line_items_pricenumberSum of line-item prices in shop currency.
total_pricenumberSum of line-item prices, discounts, shipping, taxes, and tips; documented as positive.
total_taxnumberSum of taxes in shop currency; documented as positive.
total_weightnumberSum of line-item weights in grams; not adjusted when items are removed.
taxes_includedstringWhether taxes are included in the subtotal. Values are true and false.

Addresses​

billing_address and shipping_address contain address fields including address1, address2, city, company, country, country_code, first_name, last_name, latitude, longitude, name, phone, province, province_code, and zip. Response examples also include Haravan-specific district, district_code, ward, and ward_code.

Billing address is optional when no payment method is required. Shipping address is optional when no shipping is required.

Customer​

customer contains customer information and can be null, especially for orders created through Haravan POS. Consumers must not depend on its presence. Use the Customer API for the customer contract.

Line items​

Important documented line-item fields include:

FieldMeaning
idLine-item identifier.
product_idProduct identifier; can become null if the original product is later deleted.
variant_idProduct-variant identifier.
quantityPurchased quantity.
fulfillable_quantityquantity - max(refunded_quantity, fulfilled_quantity) - pending_fulfilled_quantity.
pricePrice before discounts.
total_discountDiscount applied to the line item; it is not subtracted from price.
gramsWeight in grams.
fulfillment_servicemanual or provider name.
fulfillment_statusSource lists fulfilled, null, or partial for a line item.
requires_shippingWhether shipping is required.
skuStock keeping unit.
titleProduct title.
variant_titleVariant title.
vendorSupplier name.
nameProduct-variant name.
gift_cardGift-card indicator; gift cards are not taxed or included in shipping charges.
taxableWhether the line item is taxable.
tax_linesTaxes applicable to the line item.

Response examples contain additional line-item fields such as barcode, properties, applied_discounts, image, product_exists, not_allow_promotion, and ma_cost_amount; their contracts are not specified.

Discounts, shipping, tax, refunds, and transactions​

  • discount_codes is an array. Documented fields include code, amount, and type; documented type values are percentage, shipping, and fixed_amount, with fixed_amount identified as the default.
  • shipping_lines is an array of shipping methods with code, price, source, title, and optionally tax_lines.
  • tax_lines contains price, rate, and title for applicable taxes.
  • refunds contains refunds associated with the order.
  • transactions contains transaction records. Use the Transactions API for the complete transaction contract.
  • fulfillments contains fulfillment records associated with the order.

Other response fields​

  • browser_ip, buyer_accepts_marketing, and referring_site appear in responses; their definitions are not specified.
  • Response examples include many additional fields without definitions. Presence in an example does not establish writability, enum values, or business behavior.

Search, filter, sort, and pagination​

  • Use ids to request known API IDs in one list call.
  • Use created_at_min/created_at_max, updated_at_min/updated_at_max, and processed_at_min/processed_at_max for server-side time ranges.
  • Use financial_status, fulfillment_status, or status for documented state filtering.
  • Use fields to reduce the response when only specific fields are needed.
  • Pagination is page-based through page; limit defaults to 50 and cannot exceed 50.
  • Sort only by the documented fields created_at and updated_at, using asc or desc.
  • Cursor pagination, a total-page response field, and a default sort order are not documented.

Permissions and limitations​

  • Read operations require com.read_orders.
  • Write operations require com.write_orders.
  • All Haravan APIs are subject to platform rate limits; the numeric threshold for Orders is not specified. See API Rate Limits.
  • No endpoint for deleting the Order resource is documented.
  • Assignment is limited to advanced order processing.
  • Historical data limits are not documented.

Errors and exceptions​

Only successful 200 OK responses are documented for these operations. Structured error payloads and operation-specific error status codes are not documented.

Callers must still account for these documented failure conditions or uncertainties:

  • Missing or insufficient read/write scope.
  • Unknown order_id.
  • Invalid enum or filter value.
  • limit greater than 50.
  • Attempt to update immutable or unsupported fields, including line items and quantities.
  • Invalid order state for a lifecycle action; exact state validation is not documented.
  • Advanced assignment used when the feature is unavailable.

The exact HTTP status and error body for these cases are not specified and must not be invented.

Usage guidance for AI​

  • Supported write operations are confirm, close, reopen, update, add tags, delete tags, and assign.
  • Use returned order fields to describe lifecycle/update/assignment results; tag operations instead return a tags object. HTTP 200 on another action is not proof of payment or shipping success.
  • Retry safety is undocumented. A timeout does not prove a write failed; inspect current order state before deciding whether another call is appropriate. No idempotency-key contract is supplied.
  • Keep history comments separate from order notes, and Admin editing capabilities separate from public PUT capabilities.
  • Use the API id for {order_id}; do not substitute order_number, name, or number.
  • Use GET /com/orders/count.json when only a count is needed.
  • Use server-side filters, field selection, sorting, and pagination instead of retrieving all orders for local processing.
  • Use only the documented list filter values. In particular, distinguish fulfillment filter values from the resource's fulfillment-status values.
  • Treat customer, billing_address, and shipping_address as optional.
  • Use the dedicated tag endpoints for tag changes.
  • Do not interpret DELETE /tags.json as Order deletion.
  • Treat fields shown only in response examples as read-only or unknown unless another source explicitly documents them as writable.
  • When validation, state transitions, errors, or capabilities are not documented, treat them as unknown rather than assuming conventional behavior.

Sources​

  • Orders API: routes, scope, request/response examples, restrictions and source inconsistencies.
  • Order processing workflow: separate verification/payment/shipping steps, advanced assignment and UI package availability.
  • Order management: Admin Archive / Unarchive workflow.
  • Basic order information: order notes versus history comments, and adding/removing labels.
  • Editing orders: broader UI editing capability; not evidence of additional public PUT fields.

Thông tin cần bổ sung cho 7 API write​

Các mục dưới đây cần dev xác nhận để hoàn thiện tools. Phạm vi chỉ gồm Confirm, Close, Open, Update, thêm tag, xóa tag và Assign.

APICần dev xác nhận
ConfirmTrạng thái được phép gọi; tác động tới tồn kho/thông báo và các field thay đổi; kết quả khi xác nhận lại.
Close / OpenĐiều kiện trạng thái, đặc biệt đơn chưa giao/chưa thanh toán; có tương ứng chính xác Lưu trữ/Bỏ lưu trữ trên Admin không; field thay đổi và hành vi gọi lặp.
UpdateDanh sách field được sửa, trường bắt buộc; order.id có bắt buộc không; bỏ field/null/rỗng; note_attributes thay toàn bộ hay gộp; điều kiện trạng thái riêng cho public PUT.
Thêm / xóa tagTag trùng/không tồn tại, hoa thường, khoảng trắng, chuỗi rỗng; response khi xóa tag cuối; hành vi gọi lại.
AssignAPI tra ID nhân viên/nhóm; trường bắt buộc; ý nghĩa [0]; số lượng người/nhóm; gán thay thế hay bổ sung; bỏ phân công; kho hợp lệ và tác động khi đổi kho.
  • Quyền nhân viên/phạm vi kho ngoài com.write_orders; cách API kiểm tra tính năng và gói đối với Assign.
  • HTTP status và body lỗi cho ID không tồn tại, thiếu quyền, input sai, trạng thái không hợp lệ.
  • Cơ chế gọi lặp/idempotency và xác định kết quả sau timeout; response thực tế để đối chiếu ví dụ tài liệu.

Ưu tiên chốt input của Update và Assign để dev thiết kế tool schema. Không suy ra quy tắc API từ khả năng thao tác trên UI.