Base URL
https://www.agility.bg/api/v1Endpoint
POST /orders/importPOST /orders/systemLimit
500 orders/request
Общ преглед
Как работи
1. Създавате ключ
Ключът е вързан към конкретен магазин и приема данни само за него.
2. Изпращате поръчки
Външната система прави POST с масив `orders` (до 500).
3. Поръчките са в Agility
С `/orders/import` поръчките минават през pipeline-а и влизат в таблото веднага. С `/orders/system` се записват в Sheets за последващ sync.
Бърз старт
- 1От таблото отворете Настройки → Синхронизиране на поръчки.
- 2Запазете секрета. Показва се само при създаване.
- 3Изпратете поръчки към POST /orders/import с Bearer token за директен импорт.
Authentication
API ключ
Всяка заявка трябва да съдържа store-scoped ключ в `Authorization` header. Отменени или невалидни ключове връщат `401`.
Authorization: Bearer agl_live_ВАШИЯТ_КЛЮЧEndpoint
POST /orders/import
Директно в Agility
Директен импорт в Agility: валидация, мачване на адреси/офиси и запис в магазина. Това е endpoint-ът за външен софтуер, който трябва да пълни таблото веднага.
POSTURLhttps://www.agility.bg/api/v1/orders/importBody{ orders: [...] }Endpoint
POST /orders/system
Към системата (Sheets)
Приема поръчки към нашата система (Google Sheets tab за магазина). Потребителят после синхронизира и импортира от таблото. Подходящ, когато искате междинен буфер.
POSTURLhttps://www.agility.bg/api/v1/orders/systemBody{ orders: [...] }Reference
Payload fields
Същият `orders` масив работи и за двата endpoint-а. Полетата по-долу са Shopify-съвместими; приемат се и snake_case alias-и (`order_code`, `customer_phone`, …).
NamerequiredUnique order number. Rows with the same value are grouped as one order.
EmailCustomer email. Stored when available.
Financial StatusPayment state. `paid` marks prepaid; `pending`/`unpaid` are treated as unpaid unless payment method says COD.
Paid atPayment timestamp. Compatibility field; usually optional.
Fulfillment StatusCompatibility field. Our system controls import status.
Fulfilled atCompatibility fulfillment timestamp.
Accepts MarketingCompatibility customer marketing flag.
CurrencyCurrency code, for example `EUR` or `BGN`.
SubtotalProduct subtotal. Used as fallback with `Shipping` and `Taxes` when `Total` is missing.
ShippingShipping amount charged to the customer.
TaxesTax amount. Used only for fallback total calculation.
TotalrequiredFinal order total and COD base for COD orders.
Discount CodeDiscount code stored with the order.
Discount AmountDiscount amount stored with the order.
Shipping MethodrequiredDelivery method text, for example `Speedy to_address` or `Econt to_office`.
Created atOrder creation date/time in ISO 8601 format.
Lineitem quantityQuantity for this line item.
Lineitem namerequiredProduct name used in item display and shipment notes.
Lineitem priceProduct unit price.
Lineitem compare at priceFallback item price when `Lineitem price` is missing.
Lineitem skuProduct SKU.
Lineitem requires shippingCompatibility line item flag.
Lineitem taxableCompatibility line item tax flag.
Lineitem fulfillment statusCompatibility line item fulfillment state.
Billing NameFallback customer name if `Shipping Name` is missing.
Billing StreetFallback address if shipping address is missing.
Billing Address1Fallback address line.
Billing Address2Compatibility billing address line 2.
Billing CompanyCompatibility billing company.
Billing CityFallback city if `Shipping City` is missing.
Billing ZipFallback postal code if `Shipping Zip` is missing.
Billing ProvinceCompatibility billing region.
Billing CountryStored on the order for multi-country routing (fallback: `Shipping Country`).
Billing PhoneFallback phone if `Shipping Phone` is missing.
Shipping NamerequiredCustomer full name for delivery and waybill creation.
Shipping StreetFallback/alternative shipping address text.
Shipping Address1requiredMain delivery address text.
Shipping Address2Extra shipping address details.
Shipping CompanyCompatibility shipping company.
Shipping CityrequiredDelivery city used for courier city validation.
Shipping ZipPostal code. Strongly recommended for courier city matching.
Shipping ProvinceCompatibility shipping region.
Shipping CountryFallback country when `Billing Country` is empty.
Shipping PhonerequiredDelivery phone used for search, history, and waybills.
NotesCustomer note and optional pickup-office metadata from some integrations.
Note AttributesExtra metadata or item properties, used in shipment notes where possible.
Cancelled atCompatibility cancellation timestamp.
Payment MethodrequiredUse `Cash on Delivery (COD)` for COD orders; otherwise send the prepaid provider/name.
Payment ReferenceCompatibility external payment reference.
Refunded AmountCompatibility refunded amount.
VendorCompatibility vendor field.
Outstanding BalanceCompatibility outstanding balance.
EmployeeCompatibility POS employee field.
LocationCompatibility Shopify location/POS field.
Device IDCompatibility POS device field.
IdExternal/Shopify id. `Name` is still used as display order code.
TagsScanned for risk/report markers and customer verification display.
Risk LevelCompatibility Shopify risk level.
SourceSource channel, useful for debugging.
Lineitem discountCompatibility per-line discount.
PhoneFallback phone field.
CourierrequiredAPI-specific courier column. Allowed values: `Speedy`, `Econt`.
Example
Примерна заявка (директен импорт)
curl -s -X POST -H "Authorization: Bearer agl_live_KEY" -H "Content-Type: application/json" -d '{
"orders": [
{
"Name": "#25001",
"Created at": "2026-05-18T09:36:39.285Z",
"Shipping Name": "Ivan Petrov",
"Email": "ivan@example.com",
"Shipping Phone": "0888123456",
"Total": 49.90,
"Shipping": 0,
"Lineitem quantity": 1,
"Lineitem name": "Product A",
"Lineitem price": 49.90,
"Shipping Method": "Speedy to_address",
"Shipping Address1": "bul. Bulgaria 1",
"Shipping City": "Sofia",
"Shipping Zip": "1000",
"Billing Country": "BG",
"Courier": "Speedy",
"Financial Status": "pending",
"Payment Method": "Cash on Delivery (COD)",
"Note Attributes": ""
}
]
}' https://www.agility.bg/api/v1/orders/importПример — към системата (Sheets)
curl -s -X POST -H "Authorization: Bearer agl_live_KEY" -H "Content-Type: application/json" -d '{
"orders": [
{
"Name": "#25001",
"Created at": "2026-05-18T09:36:39.285Z",
"Shipping Name": "Ivan Petrov",
"Email": "ivan@example.com",
"Shipping Phone": "0888123456",
"Total": 49.90,
"Shipping": 0,
"Lineitem quantity": 1,
"Lineitem name": "Product A",
"Lineitem price": 49.90,
"Shipping Method": "Speedy to_address",
"Shipping Address1": "bul. Bulgaria 1",
"Shipping City": "Sofia",
"Shipping Zip": "1000",
"Billing Country": "BG",
"Courier": "Speedy",
"Financial Status": "pending",
"Payment Method": "Cash on Delivery (COD)",
"Note Attributes": ""
}
]
}' https://www.agility.bg/api/v1/orders/systemResponses
Отговори
200 — /orders/import
{
"ok": true,
"imported": 1,
"skippedExisting": 0,
"totalReadyForImport": 1
}200 — /orders/system
{
"ok": true,
"system": {
"accepted": 1,
"parseErrors": []
}
}4xx / 5xx
Невалиден ключ, липсващ `orders` масив, над 500 поръчки или невалидни данни.
Security
Сигурност
- Използвайте само HTTPS в production.
- Всеки ключ е ограничен до един магазин.
- При съмнение отменете ключа и създайте нов.