Skip to content

Discount ​

INFO

Every response arrives in the shared envelope — code, message, messages, status_code, time — with the payload in data. The tables below describe what is inside data.

POST /discount/create ​

This method allows adding discount into the account.

Request body

FieldTypeRequiredDescription
namestringYes
organization_idsstring[]Yes
auto_attachbooleanYes
is_manualbooleanYes
statestringYesOne of: not_started, active, expired
live_typestringYesOne of: forever, duration
assign_typestringYesOne of: all, specific
apply_typestringYesOne of: percent, cash
valuenumberYes
currency_idstringYes
starting_datestringYes
ending_datestringYes
is_all_categoriesbooleanYes
category_idsstring[]No
nested_category_idsstring[]Yes
item_added_idsstring[]YesProduct ids
json
{
  "name": "string",
  "organization_ids": [
    "string"
  ],
  "auto_attach": false,
  "is_manual": false,
  "state": "not_started",
  "live_type": "forever",
  "assign_type": "all",
  "apply_type": "percent",
  "value": 0,
  "currency_id": "string",
  "starting_date": "string",
  "ending_date": "string",
  "is_all_categories": false,
  "category_ids": [
    "string"
  ],
  "nested_category_ids": [
    "string"
  ],
  "item_added_ids": [
    "string"
  ]
}

Response

FieldTypeDescription
_idstringid of discount
namestring
organization_idsstring[]
auto_attachboolean
is_manualboolean
statestringOne of: not_started, active, expired
live_typestringOne of: forever, duration
assign_typestringOne of: all, specific
apply_typestringOne of: percent, cash
valuenumber
currency_idstring
starting_datestring
ending_datestring
is_all_categoriesboolean
category_idsstring[]
nested_category_idsstring[]
item_added_idsstring[]
json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "_id": "string",
    "name": "string",
    "organization_ids": [
      "string"
    ],
    "auto_attach": false,
    "is_manual": false,
    "state": "not_started",
    "live_type": "forever",
    "assign_type": "all",
    "apply_type": "percent",
    "value": 0,
    "currency_id": "string",
    "starting_date": "string",
    "ending_date": "string",
    "is_all_categories": false,
    "category_ids": [
      "string"
    ],
    "nested_category_ids": [
      "string"
    ],
    "item_added_ids": [
      "string"
    ]
  },
  "time": "2025-05-01T12:00:00Z"
}

PUT /discount/update ​

This method allows updating discount in the account.

Request body

FieldTypeRequiredDescription
namestringYes
organization_idsstring[]Yes
auto_attachbooleanYes
is_manualbooleanYes
statestringYesOne of: not_started, active, expired
live_typestringYesOne of: forever, duration
assign_typestringYesOne of: all, specific
apply_typestringYesOne of: percent, cash
valuenumberYes
currency_idstringYes
starting_datestringYes
ending_datestringYes
is_all_categoriesbooleanYes
category_idsstring[]No
nested_category_idsstring[]Yes
item_added_idsstring[]YesProduct ids
_idstringYesid of customer
json
{
  "name": "string",
  "organization_ids": [
    "string"
  ],
  "auto_attach": false,
  "is_manual": false,
  "state": "not_started",
  "live_type": "forever",
  "assign_type": "all",
  "apply_type": "percent",
  "value": 0,
  "currency_id": "string",
  "starting_date": "string",
  "ending_date": "string",
  "is_all_categories": false,
  "category_ids": [
    "string"
  ],
  "nested_category_ids": [
    "string"
  ],
  "item_added_ids": [
    "string"
  ],
  "_id": "string"
}

Response

Same response shape as POST /discount/create.

DELETE /discount/delete/{id} ​

Delete a discount

Path parameters

ParameterTypeRequiredDescription
idstringYes

Request body

No request body.

Response

json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": "ok",
  "time": "2025-05-01T12:00:00Z"
}

GET /discount/get-by-id/{id} ​

Get discount using its _id

Path parameters

ParameterTypeRequiredDescription
idstringYes

Request body

No request body.

Response

Same response shape as POST /discount/create.

POST /discount/get-paging ​

Get discounts by paging

Request body

FieldTypeRequiredDescription
pagenumberYesDefault: 1
limitnumberYesDefault: 20
apply_typestringNo
statesstringNo
searchstringNo
currency_idstringNo
is_expiredbooleanNo
organization_idsstring[]No
json
{
  "page": 1,
  "limit": 20,
  "apply_type": "string",
  "states": "string",
  "search": "string",
  "currency_id": "string",
  "is_expired": false,
  "organization_ids": [
    "string"
  ]
}

Response

data.total is the total number of records and data.data[] holds the current page. The table below describes one record.

FieldTypeDescription
_idstringid of discount
namestring
organization_idsstring[]
auto_attachboolean
is_manualboolean
statestringOne of: not_started, active, expired
live_typestringOne of: forever, duration
assign_typestringOne of: all, specific
apply_typestringOne of: percent, cash
valuenumber
currency_idstring
starting_datestring
ending_datestring
is_all_categoriesboolean
category_idsstring[]
nested_category_idsstring[]
item_added_idsstring[]
json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "total": 0,
    "data": [
      {
        "_id": "string",
        "name": "string",
        "organization_ids": [
          "string"
        ],
        "auto_attach": false,
        "is_manual": false,
        "state": "not_started",
        "live_type": "forever",
        "assign_type": "all",
        "apply_type": "percent",
        "value": 0,
        "currency_id": "string",
        "starting_date": "string",
        "ending_date": "string",
        "is_all_categories": false,
        "category_ids": [
          "string"
        ],
        "nested_category_ids": [
          "string"
        ],
        "item_added_ids": [
          "string"
        ]
      }
    ]
  },
  "time": "2025-05-01T12:00:00Z"
}

POST /discount/get-all ​

Get all discounts

Request body

FieldTypeRequiredDescription
apply_typestringNoOne of: percent, cash
currency_idstringNo
organization_idsstring[]No
is_expiredbooleanNo
statesstring[]No
json
{
  "apply_type": "percent",
  "currency_id": "64e5b499189503e999999999",
  "organization_ids": [
    "64e5b499189503e999999999"
  ],
  "is_expired": false,
  "states": [
    "active"
  ]
}

Response

json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": [
    {
      "_id": "string",
      "name": "string",
      "organization_ids": [
        "string"
      ],
      "auto_attach": false,
      "is_manual": false,
      "state": "not_started",
      "live_type": "forever",
      "assign_type": "all",
      "apply_type": "percent",
      "value": 0,
      "currency_id": "string",
      "starting_date": "string",
      "ending_date": "string",
      "is_all_categories": false,
      "category_ids": [
        "string"
      ],
      "nested_category_ids": [
        "string"
      ],
      "item_added_ids": [
        "string"
      ]
    }
  ],
  "time": "2025-05-01T12:00:00Z"
}

GET /discount/get-deleted ​

Get deleted discount ids

Query parameters

ParameterTypeRequiredDescription
deleted_atstringYes

Request body

No request body.

Response

json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": [
    "string"
  ],
  "time": "2025-05-01T12:00:00Z"
}

This page is generated from the OpenAPI spec.

Bito 2.0 Integration API