API reference

Environments

Use the production host for live data. Use staging while you build and test an integration. Both require a registered PurchasePlus user account.

EnvironmentBase URLUse
Productionhttps://api.purchaseplus.comLive production environment.
Staginghttps://api.rc-purchaseplus.comSandbox for integration development and testing.

Modules

The API is broken into separate modules for functional areas in PurchasePlus. Each module has its own SwaggerHub reference. Your application may need some or all of them.

SwaggerHub paths above are gradually replacing legacy app.swaggerhub.com references. Treat any remaining app.swaggerhub.com docs as insufficiently maintained.

Authentication

The PurchasePlus API uses token-based authentication. Make a sign-in request with your account email and password. The response headers contain Access-token, Client, and Uid, which must be passed on every subsequent request.

To Sign In

# Sign in
curl -D - "https://api.purchaseplus.com/access/api/auth/sign_in" \
  -H "Accept: application/vnd.mbapi.v2+json" \
  -d "email=your.name@yourbusiness.com&password=yourpassword"

If the request is successful, the response body contains your user account details. The headers contain the three values you need on every later call:

  • Access-tokenXxhhFMpq-RQxBJb_LhuCNO
  • Client4eWvqjwfS8KFaNG89dD4Tj
  • Uidyour.name@yourorganisation.com

Subsequent Requests

curl "https://api.purchaseplus.com/purchasing/api/purchaser/:id/invoices" \
  -H "Accept: application/vnd.mbapi.v2+json" \
  -H "Access-token: XxhhFMpq-RQxBJb_LhuCNO" \
  -H "Client: 4eWvqjwfS8KFaNG89dD4Tj" \
  -H "Uid: your.name@yourorganisation.com"

Authorisation

Once your user is authenticated, the resources you can access and what you can do with them is controlled by the authorisation system. This is currently based on the Personas your user has been assigned, and can only be maintained through the PurchasePlus user interface. To obtain additional authorisation, speak with an administrator at your organisation, or contact our customer success team.

Errors

The PurchasePlus API uses standard HTTP response codes to indicate whether your request was successful or whether there was an issue.

CodeStatusMeaning
200OKRequest was successful
400Bad RequestPossibly missing data
401UnauthorisedInvalid Access-token, Client, or Uid
403ForbiddenPersona lacks permission
404Not FoundResource does not exist; check the URL or id
406Not AcceptableRequired attributes missing
409ConflictResource may have been updated since you retrieved it
429Too Many RequestsLimit is 5 per second
500Server ErrorContact support if it persists

Pagination

For requests that return multiple records, you may need to make multiple requests to retrieve all results. Pass the page parameter with the page number you wish to request.

curl "https://api.purchaseplus.com/purchasing/api/purchaser/:id/invoices" \
  -H "Accept: application/vnd.mbapi.v2+json" \
  -H "Access-token: ..." \
  -H "Client: ..." \
  -H "Uid: ..." \
  -d "page=2"

Every resource response contains a links attribute with a link to self, plus links to any associated collections.

Responses returning a collection include a links object with first, last, next, and prev page links.

"links": {
  "first": "https://api.purchaseplus.com/supply/en/api/suppliers/xxx/catalogues?page=1&per_page=25",
  "last":  "https://api.purchaseplus.com/supply/en/api/suppliers/xxx/catalogues?page=2&per_page=25",
  "prev":  null,
  "next":  "https://api.purchaseplus.com/supply/en/api/suppliers/xxx/catalogues?page=2&per_page=25"
}

Every resource contains a self-link, and may also expose related resources you can fetch with subsequent calls.

"links": {
  "self": "https://api.purchaseplus.com/supply/api/suppliers/xxx/catalogues/xxxxxx/priced_catalogued_products/xxxxxxx"
}

"relationships": {
  "lines": {
    "links": {
      "self": "https://api.purchaseplus.com/point_of_sale/api/sales/1/lines"
    }
  }
}

"relationships": {
  "product": {
    "data": { "type": "products", "id": "411853" }
  }
}

Some calls return related resources alongside the primary data, saving the need for subsequent API calls. For example, retrieving a product's details from an invoice line, or department details with an invoice.

"included": [
  {
    "id":   "xxxxxx",
    "type": "products",
    "attributes": {
      "concatenated_description": "Chicken Thigh Meat : Diced (AW 2.5kg) 1 kg"
    }
  }
]

Filtering

For requests that return multiple records, you can filter results using filter parameters. Example, returning invoices with the string "INV":

curl "https://api.purchaseplus.com/purchasing/api/purchaser/:id/invoices" \
  -H "Accept: application/vnd.mbapi.v2+json" \
  -H "Access-token: ..." \
  -H "Client: ..." \
  -H "Uid: ..." \
  -d "filter[invoice_number_cont]=INV"

Available predicates:

PredicateDescriptionNotes
*_eqequal
*_not_eqnot equal
*_matchesmatches with LIKEe.g. q[email_matches]=%@gmail.com
*_does_not_matchdoes not match with LIKE
*_matches_anymatches any
*_matches_allmatches all
*_does_not_match_anydoes not match any
*_does_not_match_alldoes not match all
*_ltless than
*_lteqless than or equal
*_gtgreater than
*_gteqgreater than or equal
*_presentnot null and not emptyString columns only. q[name_present]=1
*_blankis null or emptycol IS NULL OR col = ''
*_nullis null
*_not_nullis not null
*_inmatch any values in arrayq[name_in][]=Alice&q[name_in][]=Bob
*_not_inmatch none of values in array
*_lt_anyless than anycol < value1 OR col < value2
*_lteq_anyless than or equal to any
*_gt_anygreater than any
*_gteq_anygreater than or equal to any
*_lt_allless than allcol < value1 AND col < value2
*_lteq_allless than or equal to all
*_gt_allgreater than all
*_gteq_allgreater than or equal to all
*_not_eq_allnone of values in a set
*_startstarts withcol LIKE 'value%'
*_not_startdoes not start with
*_start_anystarts with any of
*_start_allstarts with all of
*_not_start_anydoes not start with any of
*_not_start_alldoes not start with all of
*_endends withcol LIKE '%value'
*_not_enddoes not end with
*_end_anyends with any of
*_end_allends with all of
*_contcontains valueuses LIKE
*_cont_anycontains any of
*_cont_allcontains all of
*_not_contdoes not contain
*_not_cont_anydoes not contain any of
*_not_cont_alldoes not contain all of
*_trueis true
*_falseis false
*_fuzzyfull text search
*_time_fromafter this time
*_time_tobefore this time
*_quarter_equalsmatches a date in the quarterQ1, q1 or 1

Request IDs

Each request you make to our API is logged and assigned a request id, returned in the PP-Request-Id response header. Use this id when contacting support about a specific request.

Versioning

The PurchasePlus API is currently on version 2.0. Provide the version on every request via the Accept header. If omitted, the system falls back to the deprecated v1.0 API.

curl "https://api.purchaseplus.com/access/api/auth/sign_in" \
  -H "Accept: application/vnd.mbapi.v2+json"

Refer to the Change Notes below for any breaking version changes, new endpoints, or new and deleted fields.

Idempotent Requests

The PurchasePlus API can optionally support idempotency to prevent the same transaction occurring multiple times. Provide the case-sensitive Idempotency-Key header on a request, with a UUID as its value.

If you make a request with the same Idempotency-Key twice, you receive the cached version of the original successful result. Only provide an Idempotency-Key for POST or PATCH requests, never GET or DELETE.

curl "https://api.purchaseplus.com/purchasing/api/purchaser/:id/invoices" \
  -H "Accept: application/vnd.mbapi.v2+json" \
  -H "Idempotency-Key: ca2a1871-82a2-496f-a2d2-3525d69426c3" \
  -H "Access-token: XxhhFMpq-RQxBJb_LhuCNO" \
  -H "Client: 4eWvqjwfS8KFaNG89dD4Tj" \
  -H "Uid: your.name@yourorganisation.com"

Rate Limiting

The PurchasePlus API is rate limited to protect all users from load issues. If your application reaches the limit you will see HTTP 429 on requests. The current limit is 5 requests per second per IP address. Contact our team if this is too low for your requirements.

Handle these errors gracefully by monitoring for 429s and implementing a retry mechanism with back-off.

Change Notes

  • Sep 2019 — Version 2 of the PurchasePlus API introduced (v2.0).
  • Apr 2024 — V2 API overhaul commences. SwaggerHub documentation underway across all modules, with a new Supplying module.