Api documentation

This is just api documentation. All api work on REST API technology.

Root URL api: https://crm.h-profit.com/bapi/

All requests should be sent with these http headers:

Authorization Example: VWR2bQm7BzdJ7EEi0qYjJORK5BTelPez
Content-Type: application/json

These should be attached to each request!

Products

Product api is work in GET and POST

URL - /bapi/products

Get products GET

Retrieve a list of products with optional filtering by category.

Request query:

Require:

  • limit - default 500
  • offset - default 0

Optional:

  • category_id - default None
  • modify_start - UNIX timestamp int
  • modify_end - UNIX timestamp int
  • warehouse_id - int. Filter by warehouse
  • product_id - int, Filter by product

Note. modify_start and modify_end always indicated together.

Note. If you specify the argument count=1, the answer will be as follows:

{ "total": 90 // This value will depend on the available integration to the warehouses }

Example response:

{
    "products": [
        {
            "success": true,
            "data": [
                {
                    "id": 98598,
                    "name": "GA&MA Сімпл гель 047 Амбер 15мл",
                    "brand": {
                        "name": null,
                        "id": 6148
                    },
                    "category": [
                        {
                            "id": 18183,
                            "name": "Гелі",
                            "parent_id": 18179
                        },
                        {
                            "id": 18179,
                            "name": "Нігті",
                            "parent_id": null
                        }
                    ],
                    "attr": [],
                    "af": null,
                    "description": null,
                    "images": [
                        "https://crm.h-profit.com/bimages/get/0-6578-877855-0.jpg"
                    ],
                    "size": "xxx",
                    "unit": "units",
                    "sku": "4134804",
                    "barcode": null,
                    "stock": [
                        {
                            "id": 85608,
                            "mid": 8584,
                            "name": "hp_client",
                            "instock": 0,
                            "quantity": 0,
                            "net_price": 0,
                            "price": 0.0000,
                            "sale_price": 0.0000
                        }
                    ],
                    "type_product": 1
                }
            ]
        }
    ]
}

Update products POST

Create new simple products.

Request body example:

{
    "data": [
        {
            "name": "string",
            "brand": "string",
            "category": "string",
            "description": "string",
            "images": [
                "string"
            ],
            "unit": "string",
            "sku": "string",
            "barcode": "string",
            "stock": [
                {
                    "warehouse_name": "string",
                    "instock": 0,  // int or float
                    "quantity": 0,  // int or float
                    "net_price": 0,  // int or float
                    "price": 0  // int or float,
                    "marketplace_id": 546 // int | Your warehouse id
                }
            ],
            "remote_id": "string",
            "integration_id": int,
            "variations": [
                {
                    "sku": "string",
                    "remote_id": "string",
                    "price": float or int,
                    "net_price": float or int,
                    "attributes": [
                        {
                            "name": "string",
                            "value": "string"
                        }
                    ]
                }
            ]
        }
    ]
}

Example Request

{
    "data": [
        {
            "name": "New good",
            "brand": "",
            "category": "Best category",
            "description": "Description for this good. Can be empty but not null",
            "unit": "шт",
            "sku": "New_product_565",
            "barcode": "675544998867",
            "stock": [
                {
                    "warehouse_name": "Test",
                    "instock": 6,  // int or float
                    "quantity": 6,  // int or float
                    "net_price": 98,  // int or float
                    "price": 140  // int or float
                }
            ]
        }
    ]
}

Example Response

{
    "success": true,
    "data": [
        {
            "name": "New good",
            "responsible_user_id": 11,
            "fnsku": "New_product_565",
            "description": "Description for this good. Can be empty but not null",
            "asin": "675544998867",
            "attr_desc": "{}",
            "attr_dict": "{}",
            "af": "{}",
            "weight_measure": "units",
            "type_product": "1",
            "parent_id": null,
            "category_id": 17862,
            "updated_at": "2025-01-17 14:37:25.957284",
            "user_id": 11,
            "id": 64857
        }
    ]
}

Product Stock

URL - /bapi/product_stock

Update product stocks POST

The convenience of this handler is that you only need to pass the product id, composition, and the direct quantity

Request example

[
    {
        "product_id": 58218,
        "warehouse": 8521,
        "quantity": 16,
        "comment": ""  // It is not a necessary argument to be reflected in history.
    },
    ...
]

When using group, other keys are ignored

Example answer:

{
    "success": true,
    "errors": [
        {
            "product_id": 582187,
            "message": "no found product"
        }
    ],
    "success_updated_products": [
        58218
    ]
}

Possible errors:

  • not valid product_id - incorrect product identifier
  • not valid marketplace_id - incorrect warehouse identifier
  • marketplace_id {} not found - this warehouse was not found
  • quantity not valid - the quantity value is incorrect
  • no found product - this product was not found

Product Categories

URL - /bapi/product_categories

Get categories GET

Retrieve a list of product categories.

Request query:

Optional:

  • category_id - default None

Example response:

{
    "success": true,
    "data": [
        {
            "id": 17497,
            "user_id": 11,
            "name": "Іграшки",
            "types": 1,
            "created_at": "2024-09-02 06:42:20",
            "parent_id": 0
        },
        {
            "id": 17498,
            "user_id": 11,
            "name": "Інше",
            "types": 1,
            "created_at": "2024-09-02 06:42:30",
            "parent_id": 0
        },
        ...
    ]
}

Create and edit categories POST

Request structure: Required keys: (name, parent_id); Example request:

{
    "data": [
        // create
        {
            "name": "Test product category",  // string
            "parent_id": null  // Integer or null; null if root category
        },
        // edit
        {
            "id": 67,  // Integer; if available, will edit the category
            "name": "Games (SEGA)",  // string
            "parent_id": 34  // Integer or null; null if root category
        }
    ]
}

Response example:

{
    "data": [
        {
            "status": "ok",
            "name": "Test product category",
            "cid": 87
        },
        {
            "status": "ok",
            "name": "Games (SEGA)",
            "cid": 34
        }
    ]
}

Delete product category DELETE

Delete product category

Note. If you delete the product category in which there are products. Removal will remove binding to this category from all products.

Request example:

{
    "cid": 67  // category id
}

Response example:

{
    "success": true
}

Sales

URL - /bapi/sales

Get sales GET

Retrieve a list of sales.

Request query:

Require:

  • limit - default 500
  • offset - default 0

Optional (filters):

  • date_from - type UTC timestamp default None [example: 1695340800]
  • date_to - type UTC timestamp default None [example: 1695427199]
  • client_id - type int default None [example: 454433] - filter sales by client_id
  • warehouse_id - type int default None - filter sales by warehouse id (Returns the sale even if only one product on sale corresponds to the filter)
  • status - type str default None - fiilter sales by order_status. some examples of default statuses

Example response:

{
    "success": true,
    "data": [
        {
            "purchase_date": 1733988479,
            "date_ident": "20241212",
            "amount": 100.00,
            "oid": 3730,
            "amount_sale": 100.00,
            "more_info": "{\"fee\": 5.00, \"account_fee\": 0, \"fee_type\": 0}",
            "af": "",
            "prepaid_amount": 45.00,
            "responsible_user_id": 11,
            "channel_id": "[867]",
            "client_id": null,
            "comment": "",
            "discount": 0.00,
            "discount_type": "%",
            "order_status": "saled",
            "account_id": 14532,
            "prapaid_account_id": 2,
            "clients_delivery_id": null,
            "seller_order_id": "",
            "tracking_number": null,
            "delivery_info": null,
            "remote_order_id": null,
            "order_number": "12122402",
            "currency": "2",
            "fee": 5.00,
            "terminal_trx": null,
            "dps": null,
            "items": [
                {
                    "oiid": 4449,
                    "is_refund": 0,
                    "quantity": 1.000,
                    "barcode": "726578327384",
                    "product_id": 59809,
                    "mid": 8552,
                    "parent_id": null,
                    "net_price": 123.00,
                    "tax": 0,
                    "channel_tax": 5.0000,
                    "price": 100.00,
                    "base_price": 100.00,
                    "amount": 100.00,
                    "discount": 0.00,
                    "type_price": "",
                    "profit": -28.00,
                    "item_profit": -28.00,
                    "product_name": "Титикака",
                    "product_deleted": 0,
                    "ukzt": null
                }
            ]
        },
        {
            "purchase_date": 1744362309,
            "date_ident": "20250411",
            "amount": 20.00,
            "oid": 3994,
            "amount_sale": 20.00,
            "more_info": "{\"account_fee\": 0, \"fee_type\": 0}",
            "af": "",
            "prepaid_amount": 0.00,
            "responsible_user_id": 11,
            "channel_id": "[905]",
            "client_id": 106747,
            "comment": "",
            "cash_from_client": null,
            "discount": 0.00,
            "discount_type": "%",
            "order_status": "saled",
            "account_id": 2,
            "prapaid_account_id": null,
            "clients_delivery_id": 33043,
            "seller_order_id": "",
            "tracking_number": null,
            "delivery_info": null,
            "remote_order_id": null,
            "order_number": "11042501",
            "currency": "2",
            "fee": null,
            "terminal_trx": null,
            "dps": null,
            "items": [
                {
                    "oiid": 4780,
                    "is_refund": 0,
                    "quantity": 1.000,
                    "barcode": null,
                    "product_id": 79499,
                    "mid": 8511,
                    "parent_id": null,
                    "net_price": 0,
                    "tax": 0,
                    "channel_tax": 0,
                    "price": 20.00,
                    "base_price": 20.00,
                    "amount": 20.00,
                    "discount": 0.00,
                    "type_price": "",
                    "profit": 20.00,
                    "item_profit": 20.00,
                    "product_name": "Хороший вариативный товар. ",
                    "product_deleted": 0,
                    "ukzt": null
                }
            ],
            "client": {
                "id": 106747,
                "name": "Іван Іванов Іванович",
                "phone": "380860005555",
                "email": "",
                "first_name": "Іван",
                "last_name": "Іванов",
                "middle_name": "Іванович",
                "client_deliveries": [
                    {
                        "id": 33043,
                        "delivery_id": 1,
                        "city": "8d5a980d-391c-11dd-90d9-001a92567626",
                        "post_office": "1ec09d88-e1c2-11e3-8c4a-0050568002cf"
                    }
                ]
            }
        },
        ....
    ]
}

Create sales PUT

Create new sale

Example request:

{
    "amount": 50,
    "amount_sale": 50,
    "client_id": null,
    "channel_id": [],
    "order_status": "saled",
    "account_id": 2,
    "date": "2024-12-12T13:35:11.259Z",
    "products": {
        "0": {
            "pid": 41895,
            "count": 1,
            "discount": 5,
            "finish_price": 50.99,
            "mid": 3
        }
    },
    "comment": "",
    "prepaid_amount": ""
}

Products are indicated in an object whose keys are string indices as in the list, but lines.

Example response:

{
    "success": true,
    "oid": 3732,
    "order_number": "12122404",
    "balance": 11934010.61,
    "check": "allow",
    "check_id": 0,
    "type": ""
}

Edit sale POST

{
    "oid": 3732,
    "amount": 50,
    "amount_sale": 50,
    "client_id": null,
    "channel_id": [],
    "order_status": "saled",
    "account_id": 2,
    "date": "2024-12-12T13:35:11.259Z",
    "discount": 0,
    "discount_type": "%",
    "products": {
        "0": {
            "pid": 41895,
            "count": 2,
            "discount": 1,
            "finish_price": 50.99,
            "mid": 3
        }
    },
    "comment": "",
    "prepaid_amount": ""
}

Example response:

{
    "success": true,
    "oid": 3733,
    "order_number": "12122404",
    "balance": 11934010.61,
    "check": "allow",
    "check_id": 0,
    "type": ""
}

Delete sale DELETE

Delete your sale

{
    "oid": 3733
}

Example response:

{
    "success": true,
    "balance": 11934010.61
}

Clients

URL - /bapi/clients

Get clients GET

Retrieve a list of clients.

Request query:

Optional:

  • limit - default 500 (Recommended 100)
  • offset - default 0
  • id - int
  • client_id - int
  • updated_at- timestamp (Returns clients that have been updated after the specified time)

Example response:

{
    "success": true,
    "data": [
        {
            "id": 105424,
            "is_active": 1,
            "name": "",
            "phone": "380999999999",
            "email": "",
            "birth_day": "1995-12-16 00:00:00",
            "more_info": "{}",
            "birth_day_child_1": null,
            "birth_day_child_2": null,
            "birth_day_child_3": null,
            "discount": 0,
            "total_amount": 0.00,
            "city": "",
            "postal_code": null,
            "state_or_region": null,
            "country": null,
            "created_at": 1686981559,
            "updated_at": 1742370000,
            "address": "",
            "responsible_user_id": null,
            "comment": "",
            "first_name": "Світлана",
            "last_name": "Пасічко",
            "middle_name": "Юріївна",
            "ref": null,
            "nickname": "",
            "company": "",
            "invoice": "",
            "card_url": null,
            "card_number": null,
            "balance": 0.00
        },
        ...
    ]
}

Create client POST

Create a new client.

Request body example:

{
    "data": [
        {
            "first_name": "string",
            "last_name": "string",
            "phone": "string",
            "email": "string",
            "birth_day": "string",
            "discount": 0,
            "total_amount": 0,
            "city": "string",
            "address": "string",
            "company": "string"
            // for edit
            "id": int
        },
        ... // up to 3000 max rows
    ]
}

If you add the id key to the object, then when coincided, the client will be edited.

Remote orders

URL - /bapi/remote_orders

Get orders GET

Get remote orders

Request query:

Require:

  • limit - default 500
  • offset - default 0

Optiional:

  • start - UNIX timestamp of start datetime
  • end - UNIX timestamp of end datetime

If start and end parameters is missing, orders will be stretched over the past 3 months.

Example response:

{
    "success": true,
    "response": [
        {
            "integration_id": 435,
            "order_id": "321303990",
            "user_id": 11,
            "status": "pending",
            "local_status": null,
            "order_name": "Order ID: 321303990",
            "order_atributes": null,
            "info": {
                "is_paid": false,
                "payment_type": "Наложенный платеж"
            },
            "price": 500.32,
            "discount": 0.0,
            "currency": "грн",
            "date_created": "2024-12-11 16:31:54",
            "date_modified": "2024-12-11 16:31:55",
            "phone": "+380672225522",
            "email": null,
            "address_1": {
                "address_1": "",
                "city": "",
                "delivery_cost": 0,
                "delivery_operator": "nova_poshta"
            },
            "address_2": "",
            "is_deleted": 0,
            "order_data": [
                {
                    "id": 2423560633,
                    "name": "Зелена бавовняна шапка",
                    "product_id": 2423560633,
                    "sku": "shrek",
                    "quantity": 1.0,
                    "price": "500,32 грн",
                    "total": "500,32 грн",
                    "is_paid": false,
                    "payment_type": "Наложенный платеж",
                    "measure_unit": "шт."
                }
            ],
            "first_name": "Клієнт",
            "last_name": "Плюс",
            "client_id": 106623,
            "id": 2673521,
            "sales_id": null
        },
        ...
    ]
}

Create order POST

Create new remote order.

Request body example:

{
    "data": {
        // Required
        "order_id": int,  // Order id in your system
        "price": int or float,
        "currency": str,  // currency string ex.: "UAH" or "USD" or "грн."
        "first_name": string,  // client first name
        "address_1": RemoteAddressType{},
        "order_data": OrderDataType[]

        // Optional
        "status": string,  // default "pending"
        "order_name": string,  // default "Order ID: {order id}"
        "info": InfoType{},  // default {}
        "order_created": utc timestamp,  // example 1733397480.216189
        "order_modified": utc timestamp,  // example 1733397480.216189
        "phone": string,  // client phone number
        "email": string,  // client email
        "last_name": string,  // client last name
        "address_2": string  // Delivery index or additional delivery info
    }
}

See more information in order statuses, InfoType, RemoteAddressType

Response example

{
    "success": true,
    "reservedProducts": [
        [
            41901,  // product id
            "3"     // marketplace id
        ]
    ]
}

Reference

URL - /bapi/reference_info

GET Info

Request query

types - string. Comma-listed requested data. Available values: - accounts - products_category - expenses_category - brand - warehouses

Note. If types is empty or missing, then all the listed data is returned.

Response (example)

{
    "success": true,
    "data": {
        "accounts": [
            {
                "id": 2,
                "name": "Наличка",
                "balance": 11972109.66,
                "currency_id": 2,
                "types": 0,
                "created_at": 1587396469
            }
        ],
        "products_categories": [
            {
                "id": 17497,
                "name": "Іграшки",
                "types": 1,
                "parent_id": 0,
                "created_at": 1725259340
            }
        ],
        "expenses_categories": [
            {
                "id": 1,
                "name": "Общие",
                "types": 0,
                "is_global": 1,
                "is_receipt": 0,
                "is_profit": 0
            }
        ],
        "brands": [
            {
                "id": 6017,
                "name": "Новый бренд"
            }
        ],
        "warehouses": [
            {
                "id": 4,
                "name": "Components",
                "w_type": 3,
                "created_at": 1587382394,
                "is_deleted": 0
            }
        ]
    }
}

Product Sync

URL - /bapi/products_sync

GET product sync

Response (example)

{
    "success": true,
    "data": [
        {
            "product_id": 100025,
            "user_id": `your user id`,
            "integration_id": 435,
            "remote_id": "2595649057"
        }
    ]
}

POST product sync

bulk -require argument Structure post request example:

{
    "bulk": [
        {
            "product_id": 8695,
            "remote_id": "identificate string",
            "integration_id": 545
        }
    ]
}

Note bulk and keys in the objects specified in the example are mandatory

Example response:

{
    "success": true,
    "results": [
        {
            "product_id": 100027,
            "success": true,
            "message": "Привязка успешно создана",
            "sync_id": [],
            "existing": false
        }
    ],
    "stats": {
        "total": 1,
        "success": 1,
        "failed": 0,
        "existing": 0,
        "created": 1
    }
}

DELETE product sync

bulk - require argument Structure delete request example:

{
    "bulk": [
        {
            "remote_id": "identificate string",
            "integration_id": 545
        }
    ]
}

Note bulk and keys in the objects specified in the example are mandatory

Example response:

{
    "success": true,
    "message": "Успешно удалено 1 записей.",
    "deleted_items": [
        {
            "integration_id": 435,
            "remote_id": "fvfddssccs"
        }
    ]
}

Shipments

URL - /bapi/shipments

GET shipments

Request query:

If you only want a specific supply, then:

sid - Identifier of shipments

Else:

date_from - Start filter date date_to - End filter date status - Shipment status filter (pending, complete, saled) warehouse_id - Filter shipments by warehouse // Note This arguments not require

Response example

{
    "success": true,
    "data": [
        {
            "id": 11156,
            "user_id": 11,
            "marketplace_id": 8525,
            "expenses_id": null,
            "delivery_id": 9,
            "amazon_shipment_id": null,
            "shipment_status": "complete",
            "fba_destination": null,
            "fba_country": null,
            "from_address": null,
            "fee_total_units": null,
            "fee_per_unit": 0.00,
            "fee_total": 0.00,
            "currency": "2",
            "amount": 66000.00,
            "quantity": 2000.00,
            "delivered_date": 1744033768,
            "comment": "",
            "created_at": 1744033746,
            "name": "Поставка 0 од. від 07.04.2025",
            "expected_quantity": 2000.00,
            "received_amount": 66000.00,
            "supplier_id": null,
            "delivery_expenses_id": null,
            "responsible_user_id": null,
            "currency_rate": 1.0000,
            "ttn": "20451164735634",
            "ttn_status": null,
            "marketplace_name": "Тест поставки",
            "status_name": "complete"
        }
    ]
}

Warehouses

URL - /bapi/warehouses

GET warehouses

Request query:

  • limit - default 500
  • offset - default 0

Response (example)

{
    "success": true,
    "data": [
        {
            "id": 456,
            "name": "Amazon Bags",
            "created_at": 1587382361.0,
            "w_type": 3,
            "position": 0
        },
        {
            "id": 655,
            "name": "Components",
            "created_at": 1587382394.0,
            "w_type": 3,
            "position": 0
        },
        {
            "id": 8471,
            "name": "Show Room",
            "created_at": 1674476253.0,
            "w_type": 1,
            "position": 0
        }
    ]
}