Introduction

Coming soon

Requirements

To use the latest version of the REST API you must be using:

  • eQuate POS version 3 or higher
  • You may access the API over either HTTP or HTTPS, but HTTPS is recommended where possible.

Request/Response Format

The default response format is JSON. Requests with a message-body use plain JSON to set or update resource attributes. Successful requests will return a 200 OK HTTP status.

Some general information about responses:

  • Dates are returned in ISO8601 format: YYYY-MM-DDTHH:MM:SS
  • Resource IDs are returned as integers.
  • Any decimal monetary amount, such as prices or totals, will be returned as strings with two decimal places.
  • Other amounts, such as item counts, are returned as integers.
  • Blank fields are generally included as null or emtpy string instead of being omitted.

Errors

Occasionally you might encounter errors when accessing the REST API. There are four possible types:

Error Code Error Type
400 Bad Request Invalid request, e.g. using an unsupported HTTP method
401 Unauthorized Authentication or permission error, e.g. incorrect API keys
404 Not Found Requests to resources that don't exist or are missing
500 Internal Server Error Server error

Parameters

Almost all endpoints accept optional parameters which can be passed as a HTTP query string parameter, e.g. GET /inventory/products?per_page=30. All parameters are documented along each endpoint.


Available parameters


Field Type Description
page Integer Specify the page number. Default is 1.
per_page Integer Specify the page number. Default is 10.
search String Specify a search parameter if available
exclude Array Exclude a set of IDs from the results
include Array Include only a specific set of IDs from the results
offset Integer Offer the result list by a certain number of rows
order String Specify the order in which the results should be shown. Options ASC and DESC. Default is ASC.

Pagination

Requests that return multiple items will be paginated to 10 items by default. The items per page can be specified with the ?per_page parameter:

GET /orders?per_page=15

You can specify further pages with the ?page parameter:

GET /orders?page=2

You may also specify the offset from the first resource using the ?offset parameter:

GET /orders?offset=5

Page number is 1-based and omitting the ?page parameter will return the first page.

Authentication

cURL example:

curl \
    -X POST http://api.westeros.com/character/get \
    -F 'secret_key=your_api_key' \
    -F 'house=Stark,Bolton' \
    -F 'offset=0' \
    -F 'limit=50'

PHP example:

$data = [
    'code' => '10off',
    'discount_type' => 'percent',
    'amount' => '10',
    'individual_use' => true,
    'exclude_sale_items' => true,
    'minimum_amount' => '100.00'
];

print_r($woocommerce->post('coupons', $data));

Javascript example:

const data = {
  email: "john.doe@example.com",
  first_name: "John",
  last_name: "Doe",
  username: "john.doe",
  billing: {
    first_name: "John",
    last_name: "Doe",
    company: "",
    address_1: "969 Market",
    address_2: "",
    city: "San Francisco",
    state: "CA",
    postcode: "94103",
    country: "US",
    email: "john.doe@example.com",
    phone: "(555) 555-5555"
  },
  shipping: {
    first_name: "John",
    last_name: "Doe",
    company: "",
    address_1: "969 Market",
    address_2: "",
    city: "San Francisco",
    state: "CA",
    postcode: "94103",
    country: "US"
  }
};

WooCommerce.post("customers", data)
  .then((response) => {
    console.log(response.data);
  })
  .catch((error) => {
    console.log(error.response.data);
  });

To use this API, you need an API key. Please contact us at jon.snow@nightswatch.wes to get your own API key.

API Keys

Authentication over HTTPS

You may use HTTP Basic Auth by providing the REST API Consumer Key as the username and the REST API Consumer Secret as the password.

HTTP Basic Auth example:

curl https://www.example.com/api/accounts/customers \
    -u api_key:api_secret

Occasionally some servers may not parse the Authorization header correctly (if you see a "Consumer key is missing" error when authenticating over SSL, you have a server issue). In this case, you may provide the consumer key/secret as query string parameters instead.

Example for servers that not properly parse the Authorization header:

curl https://www.example.com/api/accounts/customers?api_key=xyz&api_secret=123

Authentication over HTTP

Accounts

Customers

The accounts module allows you to create and manage customer, gift cards, groups, subscriptions, and loyalty.

Customer properties


Customer properties


Field Type Description
id Integer Only specified when updating or deleting an existing record Read-Only
date_created String Customer profile creation date (Local) Read-Only
date_created_gmt String Customer profile creation date (GMT) Read-Only
date_modified String Customer profile modification date (Local) Read-Only
date_modified_gmt String Customer profile modification date (GMT) Read-Only
first_name String Customers first name
last_name String Customers last name
company String Customers company name
email String Customers company name
address Object Customer addresses (see Customer Addresses)
default_billing Integer Customers default billing address id (see Customer Addresses)
default_shipping Integer Customers default shipping address id (see Customer Addresses)
phone_home String Customers home phone number
phone_business String Customers business phone number
phone_mobile String Customers mobile phone number
password String Password for using the login API Write-Only
group Integer Default customer group id
c1 String Custom field value #1
c2 String Custom field value #2
c3 String Custom field value #3
c4 String Custom field value #4
c5 String Custom field value #5
c6 String Custom field value #6
c7 String Custom field value #7
c8 String Custom field value #8
c9 String Custom field value #9
c10 String Custom field value #10
payment Object Customer payment profiles (see Customer Payment Profiles)
mailing_list Boolean Should be considered for mailing lists
system_emails Boolean Receive system generated e-mails
collect_loyalty Boolean Customer is eligible to collect loyalty if enabled
loyalty String Total value of loyalty points

Customer Addresses


Field Type Description
id Integer Only specified when updating or deleting an existing record Read-Only
date_modified String Customer address modification date (Local) Read-Only
date_modified_gmt String Customer address modification date (GMT) Read-Only
alias String Customers address alias (description)
first_name String Address first name recipient
last_name String Address last name recipient
company String Address company
address1 String Customers address line 1
address2 String Customers address line 2
city String Customers city
province String Customers province/state
country String Customers country
postal String Customers postal/zip code

Customer Payment Profiles


Field Type Description
id Integer Specified when updating or deleting a record Read-Only
date_modified String Customer payment profile modification date (Local) Read-Only
date_modified_gmt String Customer payment profile modification date (GMT) Read-Only
payment_module String Payment module this profile is linked to Read-Only
method String Payment Method alias Write-Only
card_number String Credit card number. This field is write only but will return last 4 digits of existing profiles Write-Only
card_cvc Integer Credit card CVC/CVV value 123 Write-Only
card_month Integer Credit card expiration month 04
card_year Integer Credit card expiration year 2028
card_type String Card type: visa, mastercard, amex, discover Read-Only
default Boolean Set payment profile as default. Default is true
authorize Boolean Verify payment method by preauthorize payment before adding as profile. Default is true Write-Only
token Object Token data storage for recharging cards if applicable Read-Only

Create a customer

HTTP request

POST
/api/accounts/customers

cURL example:

curl -X POST https://example.com/api/accounts/customers \
    -u api_key:api_secret \
    -H "Content-Type: application/json" \
    -d '{   
    "first_name": "John",
    "last_name": "Doe",
    "company": "ACME Company",
    "email": "john.doe@example.com",
    "phone_home": "5555551234",
    "address": [{
        "alias": "Home",
        "address1": "123 Main Street",
        "address2": "",
        "city": "Mainville",
        "province": "Ontario",
        "country": "Canada",
        "postal": "K0K 0K0"
    }, {
        "alias": "Work",
        "address1": "860 Jack Street",
        "address2": "",
        "city": "Demoville",
        "province": "Ontario",
        "country": "Canada",
        "postal": "K0K 0K1"
    }],
    "payment": [
        {
            "method": "visa",
            "card_number": "4111111111111111",
            "card_month": "05",
            "card_year": "2023",
            "card_cvc": "123"
        }
    ]
}'

PHP example:

$data = [
    'code' => '10off',
    'discount_type' => 'percent',
    'amount' => '10',
    'individual_use' => true,
    'exclude_sale_items' => true,
    'minimum_amount' => '100.00'
];

print_r($woocommerce->post('coupons', $data));

Javascript example:

JSON response example:

{
    "id": 2,
    "date_created": "2022-04-24T12:52:11",
    "date_created_gmt": "2022-04-24T16:52:11",
    "date_modified": "2022-04-24T12:52:11",
    "date_modified_gmt": "2022-04-24T16:52:11",
    "first_name": "John",
    "last_name": "Doe",
    "company": "ACME Company",
    "email": "john.doe@example.com",
    "phone_home": "5555551234",
    "phone_business": "",
    "phone_mobile": "",
    "default_billing": 7,
    "default_shipping": 394,
    "group": 1,
    "mailing_list": true,
    "system_emails": true,
    "collect_loyalty": true,
    "loyalty": "0.00",
    "address": [{
        "id": 7,
        "date_modified": "2022-04-24T12:52:11",
        "date_modified_gmt": "2022-04-24T16:52:11",
        "alias": "Home",
        "address1": "123 Main Street",
        "address2": "",
        "city": "Mainville",
        "province": "Ontario",
        "country": "Canada",
        "postal": "K0K 0K0"
    }, {
        "id": 394,
        "date_modified": "2022-04-24T12:52:11",
        "date_modified_gmt": "2022-04-24T16:52:11",
        "alias": "Work",
        "address1": "860 Jack Street",
        "address2": "",
        "city": "Demoville",
        "province": "Ontario",
        "country": "Canada",
        "postal": "K0K 0K1"
    }],
    "payment": [{
        "id": 7,
        "date_modified": "2022-04-24T12:52:11",
        "date_modified_gmt": "2022-04-24T16:52:11",
        "default": false,
        "card_type": "visa",
        "card_number": "1111",
        "card_month": "05",
        "card_year": "2023",
        "token": {
            "CustomerProfileId": "906278097",
            "CustomerPaymentProfileId": "905976810"
        }
    }]
}

Retrieve a customer

HTTP request

GET
/api/accounts/customers/{id}

cURL example:

curl https://example.com/api/accounts/customers/2 \
    -u api_key:api_secret

PHP example:

Javascript example:

JSON response example:

{
    "id": 2,
    "date_created": "2022-04-24T12:52:11",
    "date_created_gmt": "2022-04-24T16:52:11",
    "date_modified": "2022-04-24T12:52:11",
    "date_modified_gmt": "2022-04-24T16:52:11",
    "first_name": "John",
    "last_name": "Doe",
    "company": "ACME Company",
    "email": "john.doe@example.com",
    "phone_home": "5555551234",
    "phone_business": "",
    "phone_mobile": "",
    "default_billing": 7,
    "default_shipping": 394,
    "group": 1,
    "mailing_list": true,
    "system_emails": true,
    "collect_loyalty": true,
    "loyalty": "0.00",
    "address": [{
        "id": 7,
        "date_modified": "2022-04-24T12:52:11",
        "date_modified_gmt": "2022-04-24T16:52:11",
        "alias": "Home",
        "address1": "123 Main Street",
        "address2": "",
        "city": "Mainville",
        "province": "Ontario",
        "country": "Canada",
        "postal": "K0K 0K0"
    }, {
        "id": 394,
        "date_modified": "2022-04-24T12:52:11",
        "date_modified_gmt": "2022-04-24T16:52:11",
        "alias": "Work",
        "address1": "860 Jack Street",
        "address2": "",
        "city": "Demoville",
        "province": "Ontario",
        "country": "Canada",
        "postal": "K0K 0K1"
    }],
    "payment": [{
        "id": 7,
        "date_modified": "2022-04-24T12:52:11",
        "date_modified_gmt": "2022-04-24T16:52:11",
        "default": false,
        "card_type": "visa",
        "card_number": "1111",
        "card_month": "05",
        "card_year": "2023",
        "token": {
            "CustomerProfileId": "906278097",
            "CustomerPaymentProfileId": "905976810"
        }
    }]
}

List customers

HTTP request

GET
/api/accounts/customers

cURL example:

curl https://example.com/api/accounts/customers \
    -u api_key:api_secret

PHP example:

Javascript example:

JSON response example:

[{
    "id": 1,
    "date_created": "2021-10-10T12:22:08",
    "date_modified": "2022-04-24T14:39:54",
    "first_name": "Jane",
    "last_name": "Smith",
    "company": "",
    "email": "jane.smith@example.com",
    "phone_home": "5555555555",
    "phone_business": "",
    "phone_mobile": "",
    "default_billing": 5,
    "default_shipping": 5,
    "group": 1,
    "mailing_list": true,
    "system_emails": true,
    "collect_loyalty": true,
    "loyalty": "0.00",
    "address": [{
        "id": 5,
        "date_modified": "2022-04-24T14:39:54",
        "alias": "My Address",
        "address1": "809 Rodeo Drive",
        "address2": "",
        "city": "Demoville",
        "province": "California",
        "country": "United States",
        "postal": "90210"
    }],
    "payment": [{
        "id": 1,
        "date_modified": "2022-01-24T13:32:38",
        "default": true,
        "type": "payment_authorize",
        "card_type": "visa",
        "card_number": "1234",
        "card_month": "01",
        "card_year": "2022",
        "token": false
    }]
}, {
    "id": 2,
    "date_created": "2022-04-24T12:52:11",
    "date_created_gmt": "2022-04-24T16:52:11",
    "date_modified": "2022-04-24T12:52:11",
    "date_modified_gmt": "2022-04-24T16:52:11",
    "first_name": "John",
    "last_name": "Doe",
    "company": "ACME Company",
    "email": "john.doe@example.com",
    "phone_home": "5555551234",
    "phone_business": "",
    "phone_mobile": "",
    "default_billing": 7,
    "default_shipping": 394,
    "group": 1,
    "mailing_list": true,
    "system_emails": true,
    "collect_loyalty": true,
    "loyalty": "0.00",
    "address": [{
        "id": 7,
        "date_modified": "2022-04-24T12:52:11",
        "date_modified_gmt": "2022-04-24T16:52:11",
        "alias": "Home",
        "address1": "123 Main Street",
        "address2": "",
        "city": "Mainville",
        "province": "Ontario",
        "country": "Canada",
        "postal": "K0K 0K0"
    }, {
        "id": 394,
        "date_modified": "2022-04-24T12:52:11",
        "date_modified_gmt": "2022-04-24T16:52:11",
        "alias": "Work",
        "address1": "860 Jack Street",
        "address2": "",
        "city": "Demoville",
        "province": "Ontario",
        "country": "Canada",
        "postal": "K0K 0K1"
    }],
    "payment": [{
        "id": 7,
        "date_modified": "2022-04-24T12:52:11",
        "date_modified_gmt": "2022-04-24T16:52:11",
        "default": false,
        "card_type": "visa",
        "card_number": "1111",
        "card_month": "05",
        "card_year": "2023",
        "token": {
            "CustomerProfileId": "906278097",
            "CustomerPaymentProfileId": "905976810"
        }
    }]
}]

Available parameters


Field Type Description
page Integer Specify the page number. Default is 1.
per_page Integer Specify the page number. Default is 10.
search String Specify a search parameter if available
exclude Array Exclude a set of IDs from the results
include Array Include only a specific set of IDs from the results
offset Integer Offer the result list by a certain number of rows
order String Specify the order in which the results should be shown. Options ASC and DESC. Default is ASC.
email String Search by e-mail address
password String If specified, email must also be defined. Will return a result if email and password match.

Update a customer

HTTP request

PUT
/api/accounts/customers/{id}

cURL example:

curl -X PUT https://example.com/api/accounts/customers/2 \
    -u api_key:api_secret

PHP example:

Javascript example:

JSON response example:

{
    "id": 2,
    "date_created": "2022-04-24T12:52:11",
    "date_created_gmt": "2022-04-24T16:52:11",
    "date_modified": "2022-04-24T12:52:11",
    "date_modified_gmt": "2022-04-24T16:52:11",
    "first_name": "John",
    "last_name": "Doe",
    "company": "ACME Company",
    "email": "john.doe@example.com",
    "phone_home": "5555551234",
    "phone_business": "",
    "phone_mobile": "",
    "default_billing": 7,
    "default_shipping": 394,
    "group": 1,
    "mailing_list": true,
    "system_emails": true,
    "collect_loyalty": true,
    "loyalty": "0.00",
    "address": [{
        "id": 7,
        "date_modified": "2022-04-24T12:52:11",
        "date_modified_gmt": "2022-04-24T16:52:11",
        "alias": "Home",
        "address1": "123 Main Street",
        "address2": "",
        "city": "Mainville",
        "province": "Ontario",
        "country": "Canada",
        "postal": "K0K 0K0"
    }, {
        "id": 394,
        "date_modified": "2022-04-24T12:52:11",
        "date_modified_gmt": "2022-04-24T16:52:11",
        "alias": "Work",
        "address1": "860 Jack Street",
        "address2": "",
        "city": "Demoville",
        "province": "Ontario",
        "country": "Canada",
        "postal": "K0K 0K1"
    }],
    "payment": [{
        "id": 7,
        "date_modified": "2022-04-24T12:52:11",
        "date_modified_gmt": "2022-04-24T16:52:11",
        "default": false,
        "card_type": "visa",
        "card_number": "1111",
        "card_month": "05",
        "card_year": "2023",
        "token": {
            "CustomerProfileId": "906278097",
            "CustomerPaymentProfileId": "905976810"
        }
    }]
}

Delete a customer

HTTP request

DELETE
/api/accounts/customers/{id}

cURL example:

curl -X DELETE https://example.com/api/accounts/customers/2 \
    -u api_key:api_secret

PHP example:

Javascript example:

JSON response example:

{
    "id": 2,
    "date_created": "2022-04-24T12:52:11",
    "date_created_gmt": "2022-04-24T16:52:11",
    "date_modified": "2022-04-24T12:52:11",
    "date_modified_gmt": "2022-04-24T16:52:11",
    "first_name": "John",
    "last_name": "Doe",
    "company": "ACME Company",
    "email": "john.doe@example.com",
    "phone_home": "5555551234",
    "phone_business": "",
    "phone_mobile": "",
    "default_billing": 7,
    "default_shipping": 394,
    "group": 1,
    "mailing_list": true,
    "system_emails": true,
    "collect_loyalty": true,
    "loyalty": "0.00",
    "address": [{
        "id": 7,
        "date_modified": "2022-04-24T12:52:11",
        "date_modified_gmt": "2022-04-24T16:52:11",
        "alias": "Home",
        "address1": "123 Main Street",
        "address2": "",
        "city": "Mainville",
        "province": "Ontario",
        "country": "Canada",
        "postal": "K0K 0K0"
    }, {
        "id": 394,
        "date_modified": "2022-04-24T12:52:11",
        "date_modified_gmt": "2022-04-24T16:52:11",
        "alias": "Work",
        "address1": "860 Jack Street",
        "address2": "",
        "city": "Demoville",
        "province": "Ontario",
        "country": "Canada",
        "postal": "K0K 0K1"
    }],
    "payment": [{
        "id": 7,
        "date_modified": "2022-04-24T12:52:11",
        "date_modified_gmt": "2022-04-24T16:52:11",
        "default": false,
        "card_type": "visa",
        "card_number": "1111",
        "card_month": "05",
        "card_year": "2023",
        "token": {
            "CustomerProfileId": "906278097",
            "CustomerPaymentProfileId": "905976810"
        }
    }]
}

Gift Cards

The accounts module allows you to create and manage customer, gift cards, groups, subscriptions, and loyalty.

Gift card properties


Gift card properties


Field Type Description
id Integer Only specified when updating or deleting an existing record Read-Only
date_created String Gift card creation date (Local) Read-Only
date_created_gmt String Gift card creation date (GMT) Read-Only
date_modified String Gift card modification date (Local) Read-Only
date_modified_gmt String Gift card modification date (GMT) Read-Only
sku String Barcode/SKU of Gift card
total Decimal Total value of gift card
balance Decimal Remaining available balance of gift card Read-Only
customer_id Integer Customer ID (if applicable)
date_expire String Gift card expiration date (Local) if applicable
date_expire_gmt String Gift card expiration date (GMT) if applicable

Create a gift card

HTTP request

POST
/api/accounts/giftcards

cURL example:

curl -X POST https://example.com/api/accounts/giftcards \
    -u api_key:api_secret \
    -H "Content-Type: application/json" \
    -d '{
  "sku": "003031198071",
  "total": "100.00"
}'

PHP example:

Javascript example:

JSON response example:

{
    "id": 1,
    "date_created": "2022-05-10T22:41:33",
    "date_created_gmt": "2022-05-11T02:41:33",
    "date_modified": "2022-05-10T22:41:33",
    "date_modified_gmt": "2022-05-11T02:41:33",
    "sku": "003031198071",
    "total": "100.00",
    "balance": "100.00"
}

Retrieve a gift card

HTTP request

GET
/api/accounts/giftcards/{id}

cURL example:

curl https://example.com/api/accounts/giftcards/1 \
    -u api_key:api_secret

PHP example:

Javascript example:

JSON response example:

{
    "id": 1,
    "date_created": "2022-05-10T22:41:33",
    "date_created_gmt": "2022-05-11T02:41:33",
    "date_modified": "2022-05-10T22:41:33",
    "date_modified_gmt": "2022-05-11T02:41:33",
    "sku": "003031198071",
    "total": "100.00",
    "balance": "100.00"
}

List gift cards

HTTP request

GET
/api/accounts/giftcards

cURL example:

curl https://example.com/api/accounts/giftcards \
    -u api_key:api_secret

PHP example:

Javascript example:

JSON response example:

[{
    "id": 2,
    "date_created": "2022-05-10T22:42:52",
    "date_created_gmt": "2022-05-11T02:42:52",
    "date_modified": "2022-05-10T22:42:52",
    "date_modified_gmt": "2022-05-11T02:42:52",
    "sku": "003031195171",
    "total": "50.00",
    "balance": "50.00"
}, {
    "id": 1,
    "date_created": "2022-05-10T22:41:33",
    "date_created_gmt": "2022-05-11T02:41:33",
    "date_modified": "2022-05-10T22:41:33",
    "date_modified_gmt": "2022-05-11T02:41:33",
    "sku": "003031198071",
    "total": "100.00",
    "balance": "100.00"
}]

Available parameters


Field Type Description
page Integer Specify the page number. Default is 1.
per_page Integer Specify the page number. Default is 10.
search String Specify a search parameter if available
exclude Array Exclude a set of IDs from the results
include Array Include only a specific set of IDs from the results
offset Integer Offer the result list by a certain number of rows
order String Specify the order in which the results should be shown. Options ASC and DESC. Default is ASC.

Update a gift card

HTTP request

PUT
/api/accounts/giftcards/{id}

cURL example:

curl -X PUT https://example.com/api/accounts/giftcards/2 \
    -u api_key:api_secret \
    -H "Content-Type: application/json" \
    -d '{
  "total": "10.00"
}'

PHP example:

Javascript example:

JSON response example:

{
    "id": 2,
    "date_created": "2022-05-10T22:42:52",
    "date_created_gmt": "2022-05-11T02:42:52",
    "date_modified": "2022-05-10T22:43:39",
    "date_modified_gmt": "2022-05-11T02:43:39",
    "sku": "003031195171",
    "total": "10.00",
    "balance": "10.00"
}

Delete a gift card

HTTP request

DELETE
/api/accounts/giftcards/{id}

cURL example:

curl -X DELETE https://example.com/api/accounts/giftcards/2 \
    -u api_key:api_secret

PHP example:

Javascript example:

JSON response example:

{
    "id": 2,
    "date_created": "2022-05-10T22:42:52",
    "date_created_gmt": "2022-05-11T02:42:52",
    "date_modified": "2022-05-10T22:43:39",
    "date_modified_gmt": "2022-05-11T02:43:39",
    "sku": "003031195171",
    "total": "10.00",
    "balance": "10.00"
}

Groups

The accounts module allows you to create and manage customer, gift cards, groups, subscriptions, and loyalty.

Group properties


Group properties


Field Type Description
id Integer Only specified when updating or deleting an existing record Read-Only
date_modified String Customer profile modification date (Local) Read-Only
date_modified_gmt String Customer profile modification date (GMT) Read-Only
name String Group name
description String Group description
discount Decimal Group discount (percentage)
loyalty Boolean If customers in group should be awarded loyalty

Create a group

HTTP request

POST
/api/accounts/groups

cURL example:

curl -X POST https://example.com/api/accounts/groups \
    -u api_key:api_secret \
    -H "Content-Type: application/json" \
    -d '{
  "name": "Wholesale Group",
  "description": "Wholesale group",
  "discount": 50,
  "loyalty": false
}'

PHP example:

Javascript example:

JSON response example:

{
    "id": 2,
    "date_modified": "2022-05-01T19:35:30",
    "name": "Wholesale Group",
    "description": "Wholesale group",
    "discount": "50.00",
    "loyalty": false
}

Retrieve a group

HTTP request

GET
/api/accounts/groups/{id}

cURL example:

curl https://example.com/api/accounts/groups/1 \
    -u api_key:api_secret

PHP example:

Javascript example:

JSON response example:

{
    "id": 1,
    "date_modified": "2022-02-14T11:43:25",
    "name": "Default Group",
    "description": "",
    "discount": "0.00",
    "loyalty": true
}

List groups

HTTP request

GET
/api/accounts/groups

cURL example:

curl https://example.com/api/accounts/groups \
    -u api_key:api_secret

PHP example:

Javascript example:

JSON response example:

[{
    "id": 1,
    "date_modified": "2022-02-14T11:43:25",
    "name": "Default Group",
    "description": "",
    "discount": "0.00",
    "loyalty": true
}, {
    "id": 2,
    "date_modified": "2022-05-01T19:35:30",
    "name": "Wholesale Group",
    "description": "Wholesale group",
    "discount": "50.00",
    "loyalty": false
}]

Available parameters


Field Type Description
page Integer Specify the page number. Default is 1.
per_page Integer Specify the page number. Default is 10.
search String Specify a search parameter if available
exclude Array Exclude a set of IDs from the results
include Array Include only a specific set of IDs from the results
offset Integer Offer the result list by a certain number of rows
order String Specify the order in which the results should be shown. Options ASC and DESC. Default is ASC.

Update a group

HTTP request

PUT
/api/accounts/groups/{id}

cURL example:

curl -X PUT https://example.com/api/accounts/groups/2 \
    -u api_key:api_secret \
    -H "Content-Type: application/json" \
    -d '{
  "discount": 25
}'

PHP example:

Javascript example:

JSON response example:

{
    "id": 2,
    "date_modified": "2022-05-01T19:35:30",
    "name": "Wholesale Group",
    "description": "Wholesale group",
    "discount": "25.00",
    "loyalty": false
}

Delete a group

HTTP request

DELETE
/api/accounts/groups/{id}

cURL example:

curl -X DELETE https://example.com/api/accounts/groups/2 \
    -u api_key:api_secret

PHP example:

Javascript example:

JSON response example:

{
    "id": 2,
    "date_modified": "2022-05-01T19:35:30",
    "name": "Wholesale Group",
    "description": "Wholesale group",
    "discount": "25.00",
    "loyalty": false
}

Subscriptions

The accounts module allows you to create and manage customer, gift cards, groups, subscriptions, and loyalty.

Subscription properties


Subscription properties


Field Type Description
id Integer Only specified when updating or deleting an existing record Read-Only
customer_id Integer Customer ID - Required for new subscriptions
date_created String Subscription creation date (Local) Read-Only
date_created_gmt String Subscription creation date (GMT) Read-Only
date_modified String Subscription modification date (Local) Read-Only
date_modified_gmt String Subscription modification date (GMT) Read-Only
start String Date timestamp for start date of subscription (GMT)
end String Date timestamp for end date of subscription (GMT)
frequency String Billing frequency monthly, quarterly, semi, yearly. Default is monthly
items Object Billing items (see Subscription Billing Items)
status Boolean Status of subscription
active Boolean If subscription is active
terms String Payment terms none, net7, net10, net15, net30, net60, net90, COD, EOM, CIA. Default is none
warehouse_id Integer Warehouse ID
billing_address_id Integer Billing Address ID
shipping_address_id Integer Shipping Address ID
last_invoice String Last invoice ID Read-Only
last_invoiced String Last invoice date (Local) Read-Only
last_invoiced_gmt String Last invoice date (GMT) Read-Only
c1 String Custom field value #1
c2 String Custom field value #2
c3 String Custom field value #3
c4 String Custom field value #4
c5 String Custom field value #5
c6 String Custom field value #6
c7 String Custom field value #7
c8 String Custom field value #8
c9 String Custom field value #9
c10 String Custom field value #10

Subscription Billing Items


Field Type Description
product_id Integer Product ID to add to subscription Read-Only
quantity Decimal Quantity of product_id
price Decimal Base price of item (excluding taxes)
tax_id Integer Tax ID to be applied to price

Create a subscription

HTTP request

POST
/api/accounts/subscriptions

cURL example:

curl -X POST https://example.com/api/accounts/subscriptions \
    -u api_key:api_secret \
    -H "Content-Type: application/json" \
    -d '{
  "customer_id": 2,
  "status": true,
  "start": "2025-05-05T15:00:00",
  "items": [{
        "product_id": 1,
        "quantity": 1,
        "tax_id": 1,
        "price": "100.00"
    }]
}'

PHP example:

Javascript example:

JSON response example:

{
    "id": 1,
    "customer_id": 2,
    "date_created": "2022-05-16T17:05:19",
    "date_created_gmt": "2022-05-16T21:05:19",
    "date_modified": "2022-05-16T17:05:19",
    "date_modified_gmt": "2022-05-16T21:05:19",
    "start": "2025-05-05T19:00:00",
    "status": true,
    "active": true,
    "frequency": "monthly",
    "terms": "none",
    "warehouse_id": 1,
    "items": [{
        "product_id": 1,
        "quantity": 1,
        "tax_id": 1,
        "price": "100.00"
    }]
}

Retrieve a subscription

HTTP request

GET
/api/accounts/subscriptions/{id}

cURL example:

curl https://example.com/api/accounts/subscriptions/1 \
    -u api_key:api_secret

PHP example:

Javascript example:

JSON response example:

{
    "id": 1,
    "customer_id": 2,
    "date_created": "2022-05-16T17:05:19",
    "date_created_gmt": "2022-05-16T21:05:19",
    "date_modified": "2022-05-16T17:05:19",
    "date_modified_gmt": "2022-05-16T21:05:19",
    "start": "2025-05-05T19:00:00",
    "status": true,
    "active": true,
    "frequency": "monthly",
    "terms": "none",
    "warehouse_id": 1,
    "items": [{
        "product_id": 1,
        "quantity": 1,
        "tax_id": 1,
        "price": "100.00"
    }]
}

List subscriptions

HTTP request

GET
/api/accounts/subscriptions

cURL example:

curl https://example.com/api/accounts/subscriptions \
    -u api_key:api_secret

PHP example:

Javascript example:

JSON response example:

[{
    "id": 1,
    "customer_id": 2,
    "date_created": "2022-05-16T17:05:19",
    "date_created_gmt": "2022-05-16T21:05:19",
    "date_modified": "2022-05-16T17:05:19",
    "date_modified_gmt": "2022-05-16T21:05:19",
    "start": "2025-05-05T19:00:00",
    "status": true,
    "active": true,
    "frequency": "monthly",
    "terms": "none",
    "warehouse_id": 1,
    "items": [{
        "product_id": 1,
        "quantity": 1,
        "tax_id": 1,
        "price": "100.00"
    }]
}, {
    "id": 2,
    "customer_id": 2,
    "date_created": "2022-05-16T17:06:56",
    "date_created_gmt": "2022-05-16T21:06:56",
    "date_modified": "2022-05-16T17:06:56",
    "date_modified_gmt": "2022-05-16T21:06:56",
    "start": "2022-05-16T21:06:56",
    "status": true,
    "active": true,
    "frequency": "monthly",
    "terms": "none",
    "warehouse_id": 1,
    "last_invoice": "S00-1652735216",
    "last_invoiced": "2022-05-16T17:06:56",
    "last_invoiced_gmt": "2022-05-16T21:06:56",
    "items": [{
        "product_id": 2,
        "quantity": 1,
        "tax_id": 1,
        "price": "25.00"
    }]
}]

Available parameters


Field Type Description
page Integer Specify the page number. Default is 1.
per_page Integer Specify the page number. Default is 10.
search String Specify a search parameter if available
exclude Array Exclude a set of IDs from the results
include Array Include only a specific set of IDs from the results
offset Integer Offer the result list by a certain number of rows
order String Specify the order in which the results should be shown. Options ASC and DESC. Default is ASC.
customer_id Integer List subscriptions by Customer ID

Update a subscription

HTTP request

PUT
/api/accounts/subscriptions/{id}

cURL example:

curl -X PUT https://example.com/api/accounts/subscriptions/1 \
    -u api_key:api_secret \
    -H "Content-Type: application/json" \
    -d '{
  "status": false
}'

PHP example:

Javascript example:

JSON response example:

{
    "id": 1,
    "customer_id": 2,
    "date_created": "2022-05-16T17:05:19",
    "date_created_gmt": "2022-05-16T21:05:19",
    "date_modified": "2022-05-16T17:10:56",
    "date_modified_gmt": "2022-05-16T21:10:56",
    "start": "2025-05-05T19:00:00",
    "status": false,
    "active": true,
    "frequency": "monthly",
    "terms": "none",
    "warehouse_id": 1,
    "items": [{
        "product_id": 1,
        "quantity": 1,
        "tax_id": 1,
        "price": "100.00"
    }]
}

Delete a subscription

HTTP request

DELETE
/api/accounts/subscriptions/{id}

cURL example:

curl -X DELETE https://example.com/api/accounts/subscriptions/1 \
    -u api_key:api_secret

PHP example:

Javascript example:

JSON response example:

{
    "id": 1,
    "customer_id": 2,
    "date_created": "2022-05-16T17:05:19",
    "date_created_gmt": "2022-05-16T21:05:19",
    "date_modified": "2022-05-16T17:10:56",
    "date_modified_gmt": "2022-05-16T21:10:56",
    "start": "2025-05-05T19:00:00",
    "status": false,
    "active": true,
    "frequency": "monthly",
    "terms": "none",
    "warehouse_id": 1,
    "items": [{
        "product_id": 1,
        "quantity": 1,
        "tax_id": 1,
        "price": "100.00"
    }]
}

Inventory

The accounts module allows you to create and manage customer, gift cards, groups, subscriptions, and loyalty.

Warehouses

Warehouses are required for invoices and payments.

Warehouse properties


Warehouse properties


Field Type Description
id String Only specified when updating or deleting an existing record Read-Only
date_modified String Terminal last modification date (Local) Read-Only
date_modified_gmt String Terminal last modification date (GMT) Read-Only
name String Warehouse name
status Boolean If warehouse is enabled or disabled
supply_management Boolean If supply management is enabled or disabled for this warehouse
phone1 String Warehouse phone number
phone2 String Warehouse alternate phone number
address Object Warehouse address (see Warehouse Address)

Warehouse Address


Field Type Description
date_modified String Invoice item modification date (Local) Read-Only
date_modified_gmt String Invoice item modification date (GMT) Read-Only
address1 String Warehouse address line 1
address2 String Warehouse address line 2
city String Warehouse city
province String Warehouse province/state
country String Warehouse country
postal String Warehouse postal/zip code

Create a warehouse

HTTP request

POST
/api/inventory/warehouses

cURL example:

curl -X POST https://example.com/api/inventory/warehouses \
    -u api_key:api_secret \
    -H "Content-Type: application/json" \
    -d '{
  "name": "Store 2",
  "phone1": "5555555552",
  "address": {
        "address1": "123 Big Street",
        "city": "Village",
        "province": "Ontario",
        "country": "Canada",
        "postal": "K0K 0K0"
    }
}'

PHP example:

Javascript example:

JSON response example:

{
    "id": 2,
    "date_modified": "2022-07-12T16:57:05",
    "date_modified_gmt": "2022-07-12T20:57:05",
    "name": "Store 2",
    "status": true,
    "supply_management": true,
    "phone1": "5555555552",
    "phone2": "",
    "address": {
        "date_modified": "2022-07-12T16:57:05",
        "date_modified_gmt": "2022-07-12T20:57:05",
        "address1": "123 Big Street",
        "address2": "",
        "city": "Village",
        "province": "Ontario",
        "country": "Canada",
        "postal": "K0K 0K0"
    }
}

Retrieve a warehouse

HTTP request

GET
/api/inventory/warehouses/{id}

cURL example:

curl https://example.com/api/inventory/warehouses/1 \
    -u api_key:api_secret

PHP example:

Javascript example:

JSON response example:

{
    "id": 1,
    "date_modified": "2022-07-12T16:57:05",
    "date_modified_gmt": "2022-07-12T20:57:05",
    "name": "Store 1",
    "status": true,
    "supply_management": true,
    "phone1": "5555555555",
    "phone2": "5555555123",
    "address": {
        "date_modified": "2022-07-12T16:57:05",
        "date_modified_gmt": "2022-07-12T20:57:05",
        "address1": "123 Main Street",
        "address2": "",
        "city": "Mainville",
        "province": "Ontario",
        "country": "Canada",
        "postal": "K0K 0K0"
    }
}

List warehouses

HTTP request

GET
/api/inventory/warehouses

cURL example:

curl https://example.com/api/inventory/warehouses \
    -u api_key:api_secret

PHP example:

Javascript example:

JSON response example:

[
    {
        "id": 1,
        "date_modified": "2022-07-12T16:57:05",
        "date_modified_gmt": "2022-07-12T20:57:05",
        "name": "Store 1",
        "status": true,
        "supply_management": true,
        "phone1": "5555555555",
        "phone2": "5555555123",
        "address": {
            "date_modified": "2022-07-12T16:57:05",
            "date_modified_gmt": "2022-07-12T20:57:05",
            "address1": "123 Main Street",
            "address2": "",
            "city": "Mainville",
            "province": "Ontario",
            "country": "Canada",
            "postal": "K0K 0K0"
        }
    },
    {
        "id": 2,
        "date_modified": "2022-06-28T10:35:53",
        "date_modified_gmt": "2022-06-28T14:35:53",
        "name": "Store 2",
        "status": true,
        "supply_management": true,
        "phone1": "5555555552",
        "phone2": "",
        "address": {
            "date_modified": "2022-06-28T10:35:53",
            "date_modified_gmt": "2022-06-28T14:35:53",
            "address1": "123 Big Street",
            "address2": "",
            "city": "Village",
            "province": "Ontario",
            "country": "Canada",
            "postal": "K0K 0K0"
        }
    }
]

Available parameters


Field Type Description
page Integer Specify the page number. Default is 1.
per_page Integer Specify the page number. Default is 10.
search String Specify a search parameter if available
exclude Array Exclude a set of IDs from the results
include Array Include only a specific set of IDs from the results
offset Integer Offer the result list by a certain number of rows
order String Specify the order in which the results should be shown. Options ASC and DESC. Default is ASC.

Update a warehouse

HTTP request

PUT
/api/inventory/warehouses/{id}

cURL example:

curl -X PUT https://example.com/api/inventory/warehouses/1 \
    -u api_key:api_secret \
    -H "Content-Type: application/json" \
    -d '{
  "status": false
}'

PHP example:

Javascript example:

JSON response example:

{
    "id": 1,
    "date_modified": "2022-07-12T16:57:05",
    "date_modified_gmt": "2022-07-12T20:57:05",
    "name": "Store 1",
    "status": false,
    "supply_management": true,
    "phone1": "5555555555",
    "phone2": "5555555123",
    "address": {
        "date_modified": "2022-07-12T16:57:05",
        "date_modified_gmt": "2022-07-12T20:57:05",
        "address1": "123 Main Street",
        "address2": "",
        "city": "Mainville",
        "province": "Ontario",
        "country": "Canada",
        "postal": "K0K 0K0"
    }
}

Delete a warehouse

HTTP request

DELETE
/api/inventory/warehouses/{id}

cURL example:

curl -X DELETE https://example.com/api/inventory/warehouses/1 \
    -u api_key:api_secret

PHP example:

Javascript example:

JSON response example:

{
    "id": 1,
    "date_modified": "2022-07-12T16:57:05",
    "date_modified_gmt": "2022-07-12T20:57:05",
    "name": "Store 1",
    "status": true,
    "supply_management": true,
    "phone1": "5555555555",
    "phone2": "5555555123",
    "address": {
        "date_modified": "2022-07-12T16:57:05",
        "date_modified_gmt": "2022-07-12T20:57:05",
        "address1": "123 Main Street",
        "address2": "",
        "city": "Mainville",
        "province": "Ontario",
        "country": "Canada",
        "postal": "K0K 0K0"
    }
}

Invoicing

The accounts module allows you to create and manage customer, gift cards, groups, subscriptions, and loyalty.

Invoices

The accounts module allows you to create and manage customer, gift cards, groups, subscriptions, and loyalty.

Invoice properties


Invoice properties


Field Type Description
id String Only specified when updating or deleting an existing record Read-Only
date_created String Invoice creation date (Local) Read-Only
date_created_gmt String Invoice creation date (GMT) Read-Only
date_modified String Invoice modification date (Local) Read-Only
date_modified_gmt String Invoice modification date (GMT) Read-Only
date_due String Invoice due date (Local) Read-Only
date_due_gmt String Invoice due date (GMT) Read-Only
status String Transaction status: pending, completed, held, cancelled
warehouse_id Integer Warehouse ID for the invoice
customer_id Integer Customer ID for the invoice
terminal_id String Terminal ID
subtotal Decimal Invoice subtotal (taxes excluded)
tax Decimal Total tax charged
total Decimal Invoice total (subtotal + taxes)
items Object Invoice items (see Invoice Items)
address_billing Integer Invoice billing address id (see Customer Addresses)
address_shipping Integer Invoice shipping Address ID id (see Customer Addresses)
c1 String Custom field value #1
c2 String Custom field value #2
c3 String Custom field value #3
c4 String Custom field value #4
c5 String Custom field value #5
c6 String Custom field value #6
c7 String Custom field value #7
c8 String Custom field value #8
c9 String Custom field value #9
c10 String Custom field value #10

Invoice Items


Field Type Description
id String Only specified when updating or deleting an existing record Read-Only
date_created String Invoice item modification date (Local) Read-Only
date_created_gmt String Invoice item modification date (GMT) Read-Only
date_modified String Invoice item modification date (Local) Read-Only
date_modified_gmt String Invoice item modification date (GMT) Read-Only
product_id Integer Product ID of item
description String Product description of item
quantity Integer Invoice item quantity
price Decimal Invoice price tax exclusive
tax Decimal Invoice item tax dollar
total Decimal Invoice item total
period_start String Invoicing period start date
period_end String Invoicing period end date
c1 String Custom field value #1
c2 String Custom field value #2
c3 String Custom field value #3
c4 String Custom field value #4
c5 String Custom field value #5
c6 String Custom field value #6
c7 String Custom field value #7
c8 String Custom field value #8
c9 String Custom field value #9
c10 String Custom field value #10

Create an invoice

HTTP request

POST
/api/invoicing/invoices

cURL example:

curl -X POST https://example.com/wp-json/wc/v3/customers \
    -u consumer_key:consumer_secret \
    -H "Content-Type: application/json" \
    -d '{
  "email": "john.doe@example.com",
  "first_name": "John",
  "last_name": "Doe",
  "username": "john.doe",
  "billing": {
    "first_name": "John",
    "last_name": "Doe",
    "company": "",
    "address_1": "969 Market",
    "address_2": "",
    "city": "San Francisco",
    "state": "CA",
    "postcode": "94103",
    "country": "US",
    "email": "john.doe@example.com",
    "phone": "(555) 555-5555"
  },
  "shipping": {
    "first_name": "John",
    "last_name": "Doe",
    "company": "",
    "address_1": "969 Market",
    "address_2": "",
    "city": "San Francisco",
    "state": "CA",
    "postcode": "94103",
    "country": "US"
  }
}'

PHP example:

$data = [
    'code' => '10off',
    'discount_type' => 'percent',
    'amount' => '10',
    'individual_use' => true,
    'exclude_sale_items' => true,
    'minimum_amount' => '100.00'
];

print_r($woocommerce->post('coupons', $data));

Javascript example:

const data = {
  email: "john.doe@example.com",
  first_name: "John",
  last_name: "Doe",
  username: "john.doe",
  billing: {
    first_name: "John",
    last_name: "Doe",
    company: "",
    address_1: "969 Market",
    address_2: "",
    city: "San Francisco",
    state: "CA",
    postcode: "94103",
    country: "US",
    email: "john.doe@example.com",
    phone: "(555) 555-5555"
  },
  shipping: {
    first_name: "John",
    last_name: "Doe",
    company: "",
    address_1: "969 Market",
    address_2: "",
    city: "San Francisco",
    state: "CA",
    postcode: "94103",
    country: "US"
  }
};

WooCommerce.post("customers", data)
  .then((response) => {
    console.log(response.data);
  })
  .catch((error) => {
    console.log(error.response.data);
  });

JSON response example:

{
    "id": 2,
    "date_created": "2021-09-13T19:09:49",
    "date_modified": "2022-04-24T14:52:11",
    "first_name": "John",
    "last_name": "Doe",
    "company": "ACME Company",
    "email": "john.doe@example.com",
    "phone_home": "5555551234",
    "phone_business": "",
    "phone_mobile": "",
    "c1": "",
    "c2": "",
    "c3": "",
    "c4": "",
    "c5": "",
    "c6": "",
    "c7": "",
    "c8": "",
    "c9": "",
    "c10": "",
    "default_billing": 7,
    "default_shipping": 394,
    "group": 1,
    "mailing_list": true,
    "system_emails": true,
    "collect_loyalty": true,
    "loyalty": "0.00",
    "address": [{
        "id": 7,
        "date_modified": "2022-04-24T14:51:45",
        "alias": "Home",
        "address1": "123 Main Street",
        "address2": "",
        "city": "Mainville",
        "province": "Ontario",
        "country": "Canada",
        "postal": "K0K 0K0"
    }, {
        "id": 394,
        "date_modified": "2022-04-24T14:52:11",
        "alias": "Work",
        "address1": "860 Jack Street",
        "address2": "",
        "city": "Demoville",
        "province": "Ontario",
        "country": "Canada",
        "postal": "K0K 0K1"
    }]
}

Retrieve an invoice

HTTP request

GET
/api/invoicing/invoices/{id}

cURL example:

curl https://example.com/api/accounts/customers/2 \
    -u api_key:api_secret

PHP example:

Javascript example:

JSON response example:

{
    "id": 2,
    "date_created": "2021-09-13T19:09:49",
    "date_modified": "2022-04-24T14:52:11",
    "first_name": "John",
    "last_name": "Doe",
    "company": "ACME Company",
    "email": "john.doe@example.com",
    "phone_home": "5555551234",
    "phone_business": "",
    "phone_mobile": "",
    "c1": "",
    "c2": "",
    "c3": "",
    "c4": "",
    "c5": "",
    "c6": "",
    "c7": "",
    "c8": "",
    "c9": "",
    "c10": "",
    "default_billing": 7,
    "default_shipping": 394,
    "group": 1,
    "mailing_list": true,
    "system_emails": true,
    "collect_loyalty": true,
    "loyalty": "0.00",
    "address": [{
        "id": 7,
        "date_modified": "2022-04-24T14:51:45",
        "alias": "Home",
        "address1": "123 Main Street",
        "address2": "",
        "city": "Mainville",
        "province": "Ontario",
        "country": "Canada",
        "postal": "K0K 0K0"
    }, {
        "id": 394,
        "date_modified": "2022-04-24T14:52:11",
        "alias": "Work",
        "address1": "860 Jack Street",
        "address2": "",
        "city": "Demoville",
        "province": "Ontario",
        "country": "Canada",
        "postal": "K0K 0K1"
    }]
}

List invoices

HTTP request

GET
/api/invoicing/invoices

cURL example:

curl https://example.com/api/accounts/customers \
    -u api_key:api_secret

PHP example:

Javascript example:

JSON response example:

[
  {
    "id": 1,
    "date_created": "2021-10-10T12:22:08",
    "date_modified": "2022-04-24T14:39:54",
    "first_name": "Jane",
    "last_name": "Smith",
    "company": "",
    "email": "jane.smith@example.com",
    "phone_home": "5555555555",
    "phone_business": "",
    "phone_mobile": "",
    "c1": "",
    "c2": "",
    "c3": "",
    "c4": "",
    "c5": "",
    "c6": "",
    "c7": "",
    "c8": "",
    "c9": "",
    "c10": "",
    "default_billing": 5,
    "default_shipping": 5,
    "group": 1,
    "mailing_list": true,
    "system_emails": true,
    "collect_loyalty": true,
    "loyalty": "0.00",
    "address": [{
        "id": 5,
        "date_modified": "2022-04-24T14:39:54",
        "alias": "My Address",
        "address1": "809 Rodeo Drive",
        "address2": "",
        "city": "Demoville",
        "province": "California",
        "country": "United States",
        "postal": "90210"
    }],
    "payment": [{
        "id": 1,
        "date_modified": "2022-01-24T13:32:38",
        "default": true,
        "type": "payment_authorize",
        "card_type": "visa",
        "card_number": "1234",
        "card_month": "01",
        "card_year": "2022",
        "token": false
    }]
}, {
    "id": 2,
    "date_created": "2021-09-13T19:09:49",
    "date_modified": "2022-04-24T14:52:11",
    "first_name": "John",
    "last_name": "Doe",
    "company": "ACME Company",
    "email": "john.doe@example.com",
    "phone_home": "5555551234",
    "phone_business": "",
    "phone_mobile": "",
    "c1": "",
    "c2": "",
    "c3": "",
    "c4": "",
    "c5": "",
    "c6": "",
    "c7": "",
    "c8": "",
    "c9": "",
    "c10": "",
    "default_billing": 7,
    "default_shipping": 394,
    "group": 1,
    "mailing_list": true,
    "system_emails": true,
    "collect_loyalty": true,
    "loyalty": "0.00",
    "address": [{
        "id": 7,
        "date_modified": "2022-04-24T14:51:45",
        "alias": "Home",
        "address1": "123 Main Street",
        "address2": "",
        "city": "Mainville",
        "province": "Ontario",
        "country": "Canada",
        "postal": "K0K 0K0"
    }, {
        "id": 394,
        "date_modified": "2022-04-24T14:52:11",
        "alias": "Work",
        "address1": "860 Jack Street",
        "address2": "",
        "city": "Demoville",
        "province": "Ontario",
        "country": "Canada",
        "postal": "K0K 0K1"
    }]
  }
]

Available parameters


Field Type Description
page Integer Specify the page number. Default is 1.
per_page Integer Specify the page number. Default is 10.
search String Specify a search parameter if available
exclude Array Exclude a set of IDs from the results
include Array Include only a specific set of IDs from the results
offset Integer Offer the result list by a certain number of rows
order String Specify the order in which the results should be shown. Options ASC and DESC. Default is ASC.
customer_id Integer List invoices by Customer ID
status String List invoices by status: pending, completed, held, cancelled

Update an invoice

HTTP request

PUT
/api/invoicing/invoices/{id}

cURL example:

curl -X PUT https://example.com/api/accounts/customers/2 \
    -u api_key:api_secret

PHP example:

Javascript example:

JSON response example:

{
    "id": 2,
    "date_created": "2021-09-13T19:09:49",
    "date_modified": "2022-04-24T14:52:11",
    "first_name": "John",
    "last_name": "Doe",
    "company": "ACME Company",
    "email": "john.doe@example.com",
    "phone_home": "5555551234",
    "phone_business": "",
    "phone_mobile": "",
    "c1": "",
    "c2": "",
    "c3": "",
    "c4": "",
    "c5": "",
    "c6": "",
    "c7": "",
    "c8": "",
    "c9": "",
    "c10": "",
    "default_billing": 7,
    "default_shipping": 394,
    "group": 1,
    "mailing_list": true,
    "system_emails": true,
    "collect_loyalty": true,
    "loyalty": "0.00",
    "address": [{
        "id": 7,
        "date_modified": "2022-04-24T14:51:45",
        "alias": "Home",
        "address1": "123 Main Street",
        "address2": "",
        "city": "Mainville",
        "province": "Ontario",
        "country": "Canada",
        "postal": "K0K 0K0"
    }, {
        "id": 394,
        "date_modified": "2022-04-24T14:52:11",
        "alias": "Work",
        "address1": "860 Jack Street",
        "address2": "",
        "city": "Demoville",
        "province": "Ontario",
        "country": "Canada",
        "postal": "K0K 0K1"
    }]
}

Delete an invoice

HTTP request

DELETE
/api/invoicing/invoices/{id}

cURL example:

curl -X DELETE https://example.com/api/accounts/customers/2 \
    -u api_key:api_secret

PHP example:

Javascript example:

JSON response example:

{
    "id": 2,
    "date_created": "2021-09-13T19:09:49",
    "date_modified": "2022-04-24T14:52:11",
    "first_name": "John",
    "last_name": "Doe",
    "company": "ACME Company",
    "email": "john.doe@example.com",
    "phone_home": "5555551234",
    "phone_business": "",
    "phone_mobile": "",
    "c1": "",
    "c2": "",
    "c3": "",
    "c4": "",
    "c5": "",
    "c6": "",
    "c7": "",
    "c8": "",
    "c9": "",
    "c10": "",
    "default_billing": 7,
    "default_shipping": 394,
    "group": 1,
    "mailing_list": true,
    "system_emails": true,
    "collect_loyalty": true,
    "loyalty": "0.00",
    "address": [{
        "id": 7,
        "date_modified": "2022-04-24T14:51:45",
        "alias": "Home",
        "address1": "123 Main Street",
        "address2": "",
        "city": "Mainville",
        "province": "Ontario",
        "country": "Canada",
        "postal": "K0K 0K0"
    }, {
        "id": 394,
        "date_modified": "2022-04-24T14:52:11",
        "alias": "Work",
        "address1": "860 Jack Street",
        "address2": "",
        "city": "Demoville",
        "province": "Ontario",
        "country": "Canada",
        "postal": "K0K 0K1"
    }]
}

Payments

The accounts module allows you to create and manage customer, gift cards, groups, subscriptions, and loyalty.

Payment properties


Payment properties


Field Type Description
id String Only specified when updating or deleting an existing record Read-Only
date_created String Payment creation date (Local) Read-Only
date_created_gmt String Payment creation date (GMT) Read-Only
date_modified String Payment modification date (Local) Read-Only
date_modified_gmt String Payment modification date (GMT) Read-Only
invoice_id String Invoice ID
terminal_id String Terminal ID
method String Payment Method alias
total Decimal Total amount paid
profile_id Integer Customer Payment Profile id Write-Only
type String Processing default payment, preauth,void, capture. Default is payment Write-Only
card_number String Credit card number Write-Only
card_cvc Integer Credit card CVC/CVV value 123 Write-Only
card_month Integer Credit card expiration month 04 Write-Only
card_year Integer Credit card expiration year 2028 Write-Only
save Boolean Save the card details in a token for future payments, this value will be false by default Write-Only
default Boolean If save = true, you can also set this to be the default payment profile. Default is false Write-Only
response_id String Required if type is set to capture, or void. Upon preauth, only response_id will be returned.

Create a payment

HTTP request

POST
/api/invoicing/payments

cURL example:

curl -X POST https://example.com/api/accounts/giftcards \
    -u api_key:api_secret \
    -H "Content-Type: application/json" \
    -d '{
  "sku": "003031198071",
  "total": "100.00"
}'

PHP example:

Javascript example:

JSON response example:

{
    "id": 1,
    "date_created": "2022-05-10T22:41:33",
    "date_created_gmt": "2022-05-11T02:41:33",
    "date_modified": "2022-05-10T22:41:33",
    "date_modified_gmt": "2022-05-11T02:41:33",
    "sku": "003031198071",
    "total": "100.00",
    "balance": "100.00"
}

Retrieve a payment

HTTP request

GET
/api/invoicing/payments/{id}

cURL example:

curl https://example.com/api/accounts/giftcards/1 \
    -u api_key:api_secret

PHP example:

Javascript example:

JSON response example:

{
    "id": 1,
    "date_created": "2022-05-10T22:41:33",
    "date_created_gmt": "2022-05-11T02:41:33",
    "date_modified": "2022-05-10T22:41:33",
    "date_modified_gmt": "2022-05-11T02:41:33",
    "sku": "003031198071",
    "total": "100.00",
    "balance": "100.00"
}

List payments

HTTP request

GET
/api/invoicing/payments

cURL example:

curl https://example.com/api/accounts/giftcards \
    -u api_key:api_secret

PHP example:

Javascript example:

JSON response example:

[{
    "id": 2,
    "date_created": "2022-05-10T22:42:52",
    "date_created_gmt": "2022-05-11T02:42:52",
    "date_modified": "2022-05-10T22:42:52",
    "date_modified_gmt": "2022-05-11T02:42:52",
    "sku": "003031195171",
    "total": "50.00",
    "balance": "50.00"
}, {
    "id": 1,
    "date_created": "2022-05-10T22:41:33",
    "date_created_gmt": "2022-05-11T02:41:33",
    "date_modified": "2022-05-10T22:41:33",
    "date_modified_gmt": "2022-05-11T02:41:33",
    "sku": "003031198071",
    "total": "100.00",
    "balance": "100.00"
}]

Available parameters


Field Type Description
page Integer Specify the page number. Default is 1.
per_page Integer Specify the page number. Default is 10.
search String Specify a search parameter if available
exclude Array Exclude a set of IDs from the results
include Array Include only a specific set of IDs from the results
offset Integer Offer the result list by a certain number of rows
order String Specify the order in which the results should be shown. Options ASC and DESC. Default is ASC.
invoice_id Integer List payments by invoice ID

Update a payment

HTTP request

PUT
/api/invoicing/payments/{id}

cURL example:

curl -X PUT https://example.com/api/accounts/giftcards/2 \
    -u api_key:api_secret \
    -H "Content-Type: application/json" \
    -d '{
  "total": "10.00"
}'

PHP example:

Javascript example:

JSON response example:

{
    "id": 2,
    "date_created": "2022-05-10T22:42:52",
    "date_created_gmt": "2022-05-11T02:42:52",
    "date_modified": "2022-05-10T22:43:39",
    "date_modified_gmt": "2022-05-11T02:43:39",
    "sku": "003031195171",
    "total": "10.00",
    "balance": "10.00"
}

Delete a payment

HTTP request

DELETE
/api/invoicing/payments/{id}

cURL example:

curl -X DELETE https://example.com/api/accounts/giftcards/2 \
    -u api_key:api_secret

PHP example:

Javascript example:

JSON response example:

{
    "id": 2,
    "date_created": "2022-05-10T22:42:52",
    "date_created_gmt": "2022-05-11T02:42:52",
    "date_modified": "2022-05-10T22:43:39",
    "date_modified_gmt": "2022-05-11T02:43:39",
    "sku": "003031195171",
    "total": "10.00",
    "balance": "10.00"
}

Purchasing

The accounts module allows you to create and manage customer, gift cards, groups, subscriptions, and loyalty.

Reporting

The accounts module allows you to create and manage customer, gift cards, groups, subscriptions, and loyalty.

Tools

The accounts module allows you to create and manage customer, gift cards, groups, subscriptions, and loyalty.

Tickets

The accounts module allows you to create and manage customer, gift cards, groups, subscriptions, and loyalty.

Ticket properties


Ticket properties


Field Type Description
id Integer Only specified when updating or deleting an existing record Read-Only
date_created String Payment creation date (Local) Read-Only
date_created_gmt String Payment creation date (GMT) Read-Only
date_modified String Payment modification date (Local) Read-Only
date_modified_gmt String Payment modification date (GMT) Read-Only
user_id Integer TIcket author User ID Read-Only
assignee String TIcket assignee User ID
customer_id Integer Customer ID
invoice_id String Invoice ID
warehouse_id Integer Warehouse ID
status String Status of ticket open, held, closed
severity String Severity of ticket low, normal, high
subject String Ticket subject
details String Details of ticket
replies Object Ticket replies (see Ticket Replies)

Ticket Replies


Field Type Description
id Integer Only specified when updating or deleting an existing record Read-Only
date_created String Ticket reply created date (Local) Read-Only
date_created_gmt String Ticket reply created date (GMT) Read-Only
user_id Integer TIcket reply User ID Read-Only
reply String Ticket reply content
public Boolean If ticket reply should be treated as public

Create a ticket

HTTP request

POST
/api/tools/tickets

cURL example:

curl -X POST https://example.com/api/tools/tickets \
    -u api_key:api_secret \
    -H "Content-Type: application/json" \
    -d '{
    "customer_id": 2,
    "status": "held",
    "severity": "high",
    "subject": "This is the ticket subject",
    "details": "Details of the ticket can be put in here"
}'

PHP example:

Javascript example:

JSON response example:

{
    "id": 10000,
    "date_created": "2022-07-12T16:09:09",
    "date_created_gmt": "2022-07-12T20:09:09",
    "date_modified": "2022-07-12T16:09:09",
    "date_modified_gmt": "2022-07-12T20:09:09",
    "user_id": 1,
    "assignee": "0",
    "warehouse_id": 0,
    "customer_id": 2,
    "invoice_id": "",
    "status": "held",
    "severity": "high",
    "subject": "This is the ticket subject",
    "details": "Details of the ticket can be put in here"
}

Retrieve a ticket

HTTP request

GET
/api/tools/tickets/{id}

cURL example:

curl https://example.com/api/tools/tickets/10000 \
    -u api_key:api_secret

PHP example:

Javascript example:

JSON response example:

{
    "id": 10000,
    "date_created": "2022-07-12T16:09:09",
    "date_created_gmt": "2022-07-12T20:09:09",
    "date_modified": "2022-07-12T16:14:20",
    "date_modified_gmt": "2022-07-12T20:14:20",
    "user_id": 1,
    "assignee": "0",
    "warehouse_id": 0,
    "customer_id": 2,
    "invoice_id": "",
    "status": "held",
    "severity": "high",
    "subject": "This is the ticket subject",
    "details": "Details of the ticket can be put in here",
    "replies": [
        {
            "id": 1,
            "date_created": "2022-07-12T16:14:20",
            "date_created_gmt": "2022-07-12T20:14:20",
            "reply": "This is a reply to the ticket",
            "user_id": 1
        }
    ]
}

List tickets

HTTP request

GET
/api/tools/tickets

cURL example:

curl https://example.com/api/tools/tickets \
    -u api_key:api_secret

PHP example:

Javascript example:

JSON response example:

[{
    "id": 10000,
    "date_created": "2022-07-12T16:09:09",
    "date_created_gmt": "2022-07-12T20:09:09",
    "date_modified": "2022-07-12T16:14:20",
    "date_modified_gmt": "2022-07-12T20:14:20",
    "user_id": 1,
    "assignee": "0",
    "warehouse_id": 0,
    "customer_id": 2,
    "invoice_id": "",
    "status": "held",
    "severity": "high",
    "subject": "This is the ticket subject",
    "details": "Details of the ticket can be put in here",
    "replies": [
        {
            "id": 1,
            "date_created": "2022-07-12T16:14:20",
            "date_created_gmt": "2022-07-12T20:14:20",
            "reply": "This is a reply to the ticket",
            "user_id": 1
        }
    ]
}, {
    "id": 10001,
    "date_created": "2022-07-12T16:09:09",
    "date_created_gmt": "2022-07-12T20:09:09",
    "date_modified": "2022-07-12T16:14:20",
    "date_modified_gmt": "2022-07-12T20:14:20",
    "user_id": 0,
    "assignee": "0",
    "warehouse_id": 0,
    "customer_id": 2,
    "invoice_id": "",
    "status": "open",
    "severity": "normal",
    "subject": "This is another ticket subject",
    "details": "Details of the ticket can be put in here"
}]

Available parameters


Field Type Description
page Integer Specify the page number. Default is 1.
per_page Integer Specify the page number. Default is 10.
search String Specify a search parameter if available
exclude Array Exclude a set of IDs from the results
include Array Include only a specific set of IDs from the results
offset Integer Offer the result list by a certain number of rows
order String Specify the order in which the results should be shown. Options ASC and DESC. Default is ASC.
customer_id Integer List tickets by Customer ID

Update a ticket

HTTP request

PUT
/api/tools/tickets/{id}

cURL example:

curl -X PUT https://example.com/api/tools/tickets/10000 \
    -u api_key:api_secret \
    -H "Content-Type: application/json" \
    -d '{
    "status": "closed"
}'

PHP example:

Javascript example:

JSON response example:

{
    "id": 10000,
    "date_created": "2022-07-12T16:09:09",
    "date_created_gmt": "2022-07-12T20:09:09",
    "date_modified": "2022-07-12T16:17:20",
    "date_modified_gmt": "2022-07-12T20:17:20",
    "user_id": 1,
    "assignee": "0",
    "warehouse_id": 0,
    "customer_id": 2,
    "invoice_id": "",
    "status": "closed",
    "severity": "high",
    "subject": "This is the ticket subject",
    "details": "Details of the ticket can be put in here",
    "replies": [
        {
            "id": 1,
            "date_created": "2022-07-12T16:14:20",
            "date_created_gmt": "2022-07-12T20:14:20",
            "reply": "This is a reply to the ticket",
            "user_id": 1
        }
    ]
}

Delete a ticket

HTTP request

DELETE
/api/tools/tickets/{id}

cURL example:

curl -X DELETE https://example.com/api/tools/tickets/10000 \
    -u api_key:api_secret

PHP example:

Javascript example:

JSON response example:

{
    "id": 10000,
    "date_created": "2022-07-12T16:09:09",
    "date_created_gmt": "2022-07-12T20:09:09",
    "date_modified": "2022-07-12T16:17:20",
    "date_modified_gmt": "2022-07-12T20:17:20",
    "user_id": 1,
    "assignee": "0",
    "warehouse_id": 0,
    "customer_id": 2,
    "invoice_id": "",
    "status": "closed",
    "severity": "high",
    "subject": "This is the ticket subject",
    "details": "Details of the ticket can be put in here",
    "replies": [
        {
            "id": 1,
            "date_created": "2022-07-12T16:14:20",
            "date_created_gmt": "2022-07-12T20:14:20",
            "reply": "This is a reply to the ticket",
            "user_id": 1
        }
    ]
}

Data

Coming soon

Payment methods

Payment methods can be added or modified using the payment_method endpoint.

Payment method properties


Payment method properties


Field Type Description
id Integer Only specified when updating or deleting an existing record Read-Only
date_modified String Customer profile modification date (Local) Read-Only
date_modified_gmt String Customer profile modification date (GMT) Read-Only
name String Payment method name
alias String Payment method alias Read-Only
status Boolean If payment method is enabled or disabled

Create a payment method

HTTP request

POST
/api/data/payment_methods

cURL example:

curl -X POST https://example.com/api/data/payment_methods \
    -u api_key:api_secret \
    -H "Content-Type: application/json" \
    -d '{
  "name": "Credit Card"
}'

PHP example:

Javascript example:

JSON response example:

{
    "id": 2,
    "date_modified": "2021-11-12T13:19:04",
    "date_modified_gmt": "2021-11-12T18:19:04",
    "name": "Credit Card",
    "alias": "creditcard",
    "status": true
}

Retrieve a payment method

HTTP request

GET
/api/data/payment_methods/{id}

cURL example:

curl https://example.com/api/data/payment_methods/2 \
    -u api_key:api_secret

PHP example:

Javascript example:

JSON response example:

{
    "id": 2,
    "date_modified": "2021-11-12T13:19:04",
    "date_modified_gmt": "2021-11-12T18:19:04",
    "name": "Credit Card",
    "alias": "creditcard",
    "status": true
}

List payment methods

HTTP request

GET
/api/data/payment_methods

cURL example:

curl https://example.com/api/data/payment_methods \
    -u api_key:api_secret

PHP example:

Javascript example:

JSON response example:

[
    {
        "id": 1,
        "date_modified": "2021-11-12T13:19:04",
        "date_modified_gmt": "2021-11-12T18:19:04",
        "name": "Cash",
        "alias": "cash",
        "status": true
    },
    {
        "id": 2,
        "date_modified": "2021-11-12T13:19:04",
        "date_modified_gmt": "2021-11-12T18:19:04",
        "name": "Credit Card",
        "alias": "creditcard",
        "status": true
    }
]

Available parameters


Field Type Description
page Integer Specify the page number. Default is 1.
per_page Integer Specify the page number. Default is 10.
search String Specify a search parameter if available
exclude Array Exclude a set of IDs from the results
include Array Include only a specific set of IDs from the results
offset Integer Offer the result list by a certain number of rows
order String Specify the order in which the results should be shown. Options ASC and DESC. Default is ASC.

Update a payment method

HTTP request

PUT
/api/data/payment_methods/{id}

cURL example:

curl -X PUT https://example.com/api/data/payment_methods/2 \
    -u api_key:api_secret \
    -H "Content-Type: application/json" \
    -d '{
  "status": false
}'

PHP example:

Javascript example:

JSON response example:

{
    "id": 2,
    "date_modified": "2021-11-12T13:19:04",
    "date_modified_gmt": "2021-11-12T18:19:04",
    "name": "Credit Card",
    "alias": "creditcard",
    "status": false
}

Delete a payment method

HTTP request

DELETE
/api/data/payment_methods/{id}

cURL example:

curl -X DELETE https://example.com/api/data/payment_methods/2 \
    -u api_key:api_secret

PHP example:

Javascript example:

JSON response example:

{
    "id": 2,
    "date_modified": "2021-11-12T13:19:04",
    "date_modified_gmt": "2021-11-12T18:19:04",
    "name": "Credit Card",
    "alias": "creditcard",
    "status": false
}

Terminals

Terminal information is required for invoices and payments.

Terminal properties


Terminal properties


Field Type Description
id String Only specified when updating or deleting an existing record Read-Only
date_modified String Terminal last modification date (Local) Read-Only
date_modified_gmt String Terminal last modification date (GMT) Read-Only
warehouse_id Integer Terminal default Warehouse ID
version String Terminal version Read-Only
status Boolean If terminal is enabled or disabled
date_sync String Terminal last synchronization date (Local) Read-Only
date_sync_gmt String Terminal last synchronization date (GMT) Read-Only

Create a terminal

HTTP request

POST
/api/data/terminals

cURL example:

curl -X POST https://example.com/api/data/terminals \
    -u api_key:api_secret \
    -H "Content-Type: application/json" \
    -d '{
  "name": "Credit Card"
}'

PHP example:

Javascript example:

JSON response example:

{
    "id": 2,
    "date_modified": "2021-11-12T13:19:04",
    "date_modified_gmt": "2021-11-12T18:19:04",
    "name": "Credit Card",
    "alias": "creditcard",
    "status": true
}

Retrieve a terminal

HTTP request

GET
/api/data/terminals/{id}

cURL example:

curl https://example.com/api/data/terminals/002 \
    -u api_key:api_secret

PHP example:

Javascript example:

JSON response example:

{
    "id": 2,
    "date_modified": "2021-11-12T13:19:04",
    "date_modified_gmt": "2021-11-12T18:19:04",
    "name": "Credit Card",
    "alias": "creditcard",
    "status": true
}

List terminals

HTTP request

GET
/api/data/terminals

cURL example:

curl https://example.com/api/data/terminals \
    -u api_key:api_secret

PHP example:

Javascript example:

JSON response example:

[
    {
        "id": 1,
        "date_modified": "2021-11-12T13:19:04",
        "date_modified_gmt": "2021-11-12T18:19:04",
        "name": "Cash",
        "alias": "cash",
        "status": true
    },
    {
        "id": 2,
        "date_modified": "2021-11-12T13:19:04",
        "date_modified_gmt": "2021-11-12T18:19:04",
        "name": "Credit Card",
        "alias": "creditcard",
        "status": true
    }
]

Available parameters


Field Type Description
page Integer Specify the page number. Default is 1.
per_page Integer Specify the page number. Default is 10.
search String Specify a search parameter if available
exclude Array Exclude a set of IDs from the results
include Array Include only a specific set of IDs from the results
offset Integer Offer the result list by a certain number of rows
order String Specify the order in which the results should be shown. Options ASC and DESC. Default is ASC.

Update a terminal

HTTP request

PUT
/api/data/terminals/{id}

cURL example:

curl -X PUT https://example.com/api/data/terminals/002 \
    -u api_key:api_secret \
    -H "Content-Type: application/json" \
    -d '{
  "status": false
}'

PHP example:

Javascript example:

JSON response example:

{
    "id": 2,
    "date_modified": "2021-11-12T13:19:04",
    "date_modified_gmt": "2021-11-12T18:19:04",
    "name": "Credit Card",
    "alias": "creditcard",
    "status": false
}

Delete a terminal

HTTP request

DELETE
/api/data/terminals/{id}

cURL example:

curl -X DELETE https://example.com/api/data/terminals/002 \
    -u api_key:api_secret

PHP example:

Javascript example:

JSON response example:

{
    "id": 2,
    "date_modified": "2021-11-12T13:19:04",
    "date_modified_gmt": "2021-11-12T18:19:04",
    "name": "Credit Card",
    "alias": "creditcard",
    "status": false
}

Users

Users are required for invoices and payments.

User properties


User properties


Field Type Description
id String Only specified when updating or deleting an existing record Read-Only
date_modified String Terminal last modification date (Local) Read-Only
date_modified_gmt String Terminal last modification date (GMT) Read-Only
status Boolean If user is enabled or disabled
first_name String Users first name
last_name String Users last name
phone String Users phone number
email String Users email
password String Users back office password Write-Only
operator_id String Operator ID
operator_pin String Operator PIN Write-Only
pay_rate Decimal Hourly pay rate for user
manager_id Integer User ID of user's manager
security_id Integer Security Group ID for user
date_start String Users start date (Local)
date_end String Users end date (Local)
address Object User address (see User Address)

User Address


Field Type Description
date_modified String User address modification date (Local) Read-Only
date_modified_gmt String User address modification date (GMT) Read-Only
address1 String User address line 1
address2 String User address line 2
city String User city
province String User province/state
country String User country
postal String User postal/zip code

Create a user

HTTP request

POST
/api/data/users

cURL example:

curl -X POST https://example.com/api/data/users \
    -u api_key:api_secret \
    -H "Content-Type: application/json" \
    -d '{
    "first_name": "Staff",
    "last_name": "Member",
    "email": "demo@example.com",
    "password": "thisisapassword",
    "operator_id": "6000",
    "operator_pin": "4315",
    "security_id": 2
}'

PHP example:

Javascript example:

JSON response example:

{
    "id": 2,
    "date_modified": "2022-07-17T19:21:51",
    "date_modified_gmt": "2022-07-17T23:21:51",
    "status": true,
    "first_name": "Staff",
    "last_name": "Member",
    "email": "demo@example.com",
    "operator_id": "6000",
    "pay_rate": "0",
    "manager_id": 0,
    "security_id": 2
}

Retrieve a user

HTTP request

GET
/api/data/users/{id}

cURL example:

curl https://example.com/api/data/users/2 \
    -u api_key:api_secret

PHP example:

Javascript example:

JSON response example:

{
    "id": 2,
    "date_modified": "2022-07-17T19:21:51",
    "date_modified_gmt": "2022-07-17T23:21:51",
    "status": true,
    "first_name": "Staff",
    "last_name": "Member",
    "email": "demo@example.com",
    "operator_id": "6000",
    "pay_rate": "0",
    "manager_id": 0,
    "security_id": 2
}

List users

HTTP request

GET
/api/data/users

cURL example:

curl https://example.com/api/data/users \
    -u api_key:api_secret

PHP example:

Javascript example:

JSON response example:

[
    {
        "id": 1,
        "date_modified": "2022-07-17T19:19:51",
        "date_modified_gmt": "2022-07-17T23:19:51",
        "status": true,
        "first_name": "Default",
        "last_name": "Administrator",
        "phone": "5555551234",
        "email": "administrator@example.com",
        "operator_id": "1000",
        "pay_rate": "25",
        "manager_id": 0,
        "security_id": 1,
        "date_start": "2022-01-24T00:00:00",
        "date_end": "2022-01-24T00:00:00",
        "address": {
            "date_modified": "2022-07-17T19:19:51",
            "date_modified_gmt": "2022-07-17T23:19:51",
            "address1": "123 Main Street",
            "address2": "",
            "city": "Demo",
            "province": "Ontario",
            "country": "Canada",
            "postal": "K0K 0K0"
        }
    },
    {
        "id": 2,
        "date_modified": "2022-07-17T19:21:51",
        "date_modified_gmt": "2022-07-17T23:21:51",
        "status": true,
        "first_name": "Staff",
        "last_name": "Member",
        "email": "demo@example.com",
        "operator_id": "6000",
        "pay_rate": "0",
        "manager_id": 0,
        "security_id": 2
    }
]

Available parameters


Field Type Description
page Integer Specify the page number. Default is 1.
per_page Integer Specify the page number. Default is 10.
search String Specify a search parameter if available
exclude Array Exclude a set of IDs from the results
include Array Include only a specific set of IDs from the results
offset Integer Offer the result list by a certain number of rows
order String Specify the order in which the results should be shown. Options ASC and DESC. Default is ASC.
email String Search user by e-mail address
password String If specified, email must also be defined. Will return a result if email and password match.

Update a user

HTTP request

PUT
/api/data/users/{id}

cURL example:

curl -X PUT https://example.com/api/data/users/2 \
    -u api_key:api_secret \
    -H "Content-Type: application/json" \
    -d '{
  "status": false
}'

PHP example:

Javascript example:

JSON response example:

{
    "id": 2,
    "date_modified": "2022-07-17T19:21:51",
    "date_modified_gmt": "2022-07-17T23:21:51",
    "status": false,
    "first_name": "Staff",
    "last_name": "Member",
    "email": "demo@example.com",
    "operator_id": "6000",
    "pay_rate": "0",
    "manager_id": 0,
    "security_id": 2
}

Delete a user

HTTP request

DELETE
/api/data/users/{id}

cURL example:

curl -X DELETE https://example.com/api/data/users/2 \
    -u api_key:api_secret

PHP example:

Javascript example:

JSON response example:

{
    "id": 2,
    "date_modified": "2022-07-17T19:21:51",
    "date_modified_gmt": "2022-07-17T23:21:51",
    "status": false,
    "first_name": "Staff",
    "last_name": "Member",
    "email": "demo@example.com",
    "operator_id": "6000",
    "pay_rate": "0",
    "manager_id": 0,
    "security_id": 2
}

Troubleshooting

The Westeros API uses the following error codes:

Error Code Meaning
X000 Some parameters are missing. This error appears when you don't pass every mandatory parameters.
X001 Unknown or unvalid secret_key. This error appears if you use an unknow API key or if your API key expired.
X002 Unvalid secret_key for this domain. This error appears if you use an API key non specified for your domain. Developper or Universal API keys doesn't have domain checker.
X003 Unknown or unvalid user token. This error appears if you use an unknow user token or if the user token expired.