Skip to main content

Get All Companies

Retrieves a paginated list of companies. Each company includes its company group and its billing and shipping addresses. Use the query parameters to filter the results.

HTTP Request​

  • URL: /companies
  • Method: GET
  • Headers:
    • accessToken: Required. Your API access token.
  • Required scope: READ_COMPANY or READ_WRITE_COMPANY

Query Parameters​

ParameterTypeDescription
pageIntegerPage number to retrieve. Default is 1.
limitIntegerNumber of companies per page. Default is 10.
nameStringFilter by company name. Partial, case-insensitive match.
emailStringFilter by company email. Partial, case-insensitive match.
statusStringFilter by status: pending, active or inactive.
idStringReturn only the company with this ID.
id:inStringComma-separated list of company IDs.
companyGroupStringFilter by company group ID.
parentIdStringReturn the direct sub-companies of this company (the members of its corporate). A company with several parents appears under each parent's filter. Indirect descendants are not returned; walk the tree by repeating the call with each child's ID. A company that has no corporate returns an empty list.
date_created:minStringCompanies created on or after this date (ISO 8601).
date_created:maxStringCompanies created on or before this date (ISO 8601).
date_modified:minStringCompanies updated on or after this date (ISO 8601).
date_modified:maxStringCompanies updated on or before this date (ISO 8601).
metafields:{code}StringFilter by a metafield value, e.g. metafields:erp_id=12543.
metafields-in:{code}StringFilter by a list of metafield values, e.g. metafields-in:erp_id=12543,12544.

cURL Example​

curl --location '<BASE_URL>/companies?status=active&page=1&limit=20' \
--header 'accessToken: <ACCESS_TOKEN>'

Response​

  • 200 OK: The companies were returned successfully.
  • 400 Bad Request: The access token is missing or invalid, or a filter value is not valid.

Sample JSON Response​

{
"success": true,
"data": [
{
"id": "66b9b3b166169eecd60e5ba8",
"entityId": 22,
"name": "Keystone Building Supply",
"email": "purchasing@keystonebuild.com",
"phoneNumber": "9085551234",
"status": "active",
"logo": null,
"isLock": false,
"priceLists": [],
"companyGroup": {
"_id": "66a6dd927d6c18df2d9eb836",
"name": "Wholesale",
"priceList": "66ad153dbf8641f96544341d",
"status": true,
"createdAt": "2024-07-29T00:08:50.416Z",
"updatedAt": "2024-10-03T11:07:39.111Z"
},
"shippingMethods": [],
"paymentMethods": [],
"paymentAccess": { "mode": "inherit", "methods": [] },
"paymentTerms": [],
"isSubCompany": false,
"parents": [],
"parentId": null,
"parentIds": [],
"isTaxExempt": false,
"taxExemptFileUrl": null,
"warehouses": [],
"metaFields": [],
"createdBy": {
"id": "64f0a70c6212cdcbe89a2402",
"name": "ERP integration",
"type": "api"
},
"createdAt": "2024-08-12T07:03:13.111Z",
"updatedAt": "2024-10-09T13:05:59.036Z",
"shippingAddress": [],
"billingAddress": [
{
"id": "66b9b3b166169eecd60e5ba9",
"company": "66b9b3b166169eecd60e5ba8",
"type": "billing",
"firstName": "John",
"lastName": "Doe",
"address1": "102 East Green Milton Road",
"city": "Elizabeth",
"state": { "name": "New Jersey", "code": "NJ" },
"country": { "name": "United States", "code": "US" },
"zipcode": "07202",
"isDefaultAddress": true,
"status": true,
"metaFields": [],
"createdAt": "2024-08-12T07:03:13.111Z",
"updatedAt": "2024-08-12T07:03:13.111Z"
}
]
}
],
"pagination": {
"page": 1,
"total": 1,
"count": 1
}
}

Response Details​

Company Data​

Each item in data has the same fields as the company returned by Get Company. The hierarchy fields are:

FieldTypeDescription
isSubCompanyBooleantrue when the company has at least one parent. Read-only: it follows parentIds and cannot be set through the API.
parentsArrayIDs of every company that has this company as a direct sub-company. Same values and order as parentIds.
parentIdStringDeprecated. Use parentIds. Returns the first parent in parentIds (parentIds[0], the oldest link), or null. A company can have several parents, so this is not "the" parent.
parentIdsArraySame as parents. Prefer this name in new integrations. Oldest link first.

See Corporate Hierarchy and Access for how companies are linked.

Pagination Details​

FieldTypeDescription
pageNumberCurrent page number.
totalNumberTotal number of companies matching the filters.
countNumberNumber of companies on this page.