The Orders API provides a simple interface to manage orders.

An Order is a list of Line Items associated with a deal.

The API allows you to create, delete and update your orders. You can also retrieve a single order as well as list of all orders.

Line Items, Products and Orders are available only to users who are on the Enterprise plan.

Account administrators can disable changes to these entities in the account settings. When disabled, all data are preserved but only GET requests are allowed.

JSON format

NameTypeRead onlyDescription
idnumbertrueUnique identifier of the order.
deal_idnumbertrueId of the deal the order is associated to.
discountnumbertrueDiscount on the whole order in percents.
created_atstringtrueDate and time of when the order was created in UTC (ISO8601 format).
updated_atstringtrueDate and time of the last update in UTC (ISO8601 format).

Retrieve all orders

GET /v2/orders

Returns all orders available to the user according to the parameters provided.

NameTypeInRequiredDescription
pagenumberQueryfalsePage number to start from. Page numbering starts at 1, and omitting the page parameter will return the first page. e.g. ?page=2
per_pagenumberQueryfalseNumber of records to return per page. Defaults to 25. Maximum is 500.
idsnumberQueryfalseComma-separated list of IDs to be returned in request. e.g. ?ids=1,2,3
sort_bystringQueryfalseA field to sort by. Default ordering is ascending. If you want to change the sort ordering to descending, append :desc to the field e.g. sort_by=value:desc.
deal_idnumberQueryfalseId of the deal order is associated to. e.g. ?deal_id=12

Allowed for

  • Agents

Using cURL

curl -v -X GET https://api.getbase.com/v2/orders \-H "Accept: application/json" \-H "Authorization: Bearer $ACCESS_TOKEN"

Example response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8Content-Language: en
{  "items": [    {      "data": {        "id": 1,        "deal_id": 12,        "discount": 5,        "created_at": "2015-07-06T16:32:56Z",        "updated_at": "2015-07-06T16:32:56Z"      },      "meta": {        "type": "order"      }    }  ],  "meta": {    "type": "collection",    "count": 1,    "links": {      "self": "http://api.getbase.com/v2/orders?page=1&per_page=25"    }  }}

Create an order

POST /v2/orders
NameTypeInRequiredDescription
deal_idnumberBodytrueOrder's Deal ID, e.g. "deal_id": "12"
discountnumberBodyfalseOverall discount on the order in percents, e.g. e.g. "discount": "50", default: 0

Allowed for

  • Agents

Using cURL

curl -v -X POST https://api.getbase.com/v2/orders \-H "Accept: application/json" \-H "Content-Type: application/json" \-H "Authorization: Bearer $ACCESS_TOKEN" \-d '{  "data": {    "deal_id": 12,    "discount": 50  },  "meta": {    "type": "order"  }}'

Example response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8Content-Language: en
{  "data": {    "id": 19,    "deal_id": 12,    "discount": 50,    "updated_at": "2015-07-07T10:03:19Z",    "created_at": "2015-07-07T10:03:19Z"  },  "meta": {    "type": "order"  }}

Retrieve a single order

GET /v2/orders/:id

Returns a single order available to the user, according to the unique order ID provided. If the specified order does not exist, the request will return an error.

NameTypeInRequiredDescription
idnumberQuerytrueUnique identifier of the order.

Allowed for

  • Agents

Using cURL

curl -v -X GET https://api.getbase.com/v2/orders/1 \-H "Accept: application/json" \-H "Authorization: Bearer $ACCESS_TOKEN"

Example response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8Content-Language: en
{  "data": {    "id": 19,    "deal_id": 12,    "discount": 50,    "updated_at": "2015-07-07T10:03:19Z",    "created_at": "2015-07-07T10:03:19Z"  },  "meta": {    "type": "order"  }}

Update an order

PUT /v2/orders/:id

Updates order information. If the specified order does not exist, the request will return an error.

NameTypeInRequiredDescription
discountnumberBodytrueOverall discount on the order in percents, e.g. "discount": "25"

Allowed for

  • Agents

Using cURL

curl -v -X PUT https://api.getbase.com/v2/orders/1 \-H "Accept: application/json" \-H "Content-Type: application/json" \-H "Authorization: Bearer $ACCESS_TOKEN" \-d '{  "data": {    "discount": 25  }}'

Example response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8Content-Language: en
{  "data": {    "id": 1,    "deal_id": 12,    "discount": 25,    "updated_at": "2015-07-08T13:03:19Z",    "created_at": "2015-07-07T10:03:19Z"  },  "meta": {    "type": "order"  }}

Delete an order

PUT /v2/orders/:id

Delete an existing order and remove all of the associated line items in a single call. If the specified order does not exist, the request will return an error. This operation cannot be undone.

NameTypeInRequiredDescription
idnumberQuerytrueUnique id of the order.

Allowed for

  • Agents

Using cURL

curl -v -X DELETE https://api.getbase.com/v2/orders/1 \-H "Authorization: Bearer $ACCESS_TOKEN"

Example response

HTTP/1.1 204 No Content