Skip to main content

Get All Companies

This GET endpoint retrieves a list of all companies.

Endpoint

  • URL: /api/companies
  • Method: GET

Authentication

  • Header: accessToken
  • Type: Bearer Token
  • Value: <ACCESS-TOKEN>

Request Headers

HeaderTypeDescription
accessTokenstringAccess token for authentication. (required)

Query Parameters

ParameterTypeDescription
pagenumberThe page number to retrieve. Defaults to 1 if not specified.
limitnumberThe maximum number of items to return per page. Defaults to 10 if not specified.
namestringFilter for company name using a regular expression. Supports partial matches with case insensitivity.
emailstringFilter for company email using a regular expression. Supports partial matches with case insensitivity.
statusstringFilter by the company's status.
idstringFilter for a specific company by its unique ID.
id:instringFilter for multiple companies by a comma-separated list of IDs.
date_created:minstringFilters companies created on or after the specified date. Date should be in ISO 8601 format.
date_created:maxstringFilters companies created on or before the specified date. Date should be in ISO 8601 format.
date_modified:minstringFilters companies modified on or after the specified date. Date should be in ISO 8601 format.
date_modified:maxstringFilters companies modified on or before the specified date. Date should be in ISO 8601 format.
metafieldsstringUsed to filter by specific metafield value. Typically in the format metafields:field_name=value.
metafields-instringUsed to filter by specific metafield values included in a list. Typically in the format metafields-in:field_name=val1,val2.

Sample Request

curl --location '<BASE-URL>/companies' \
--header 'accessToken: <ACCESS-TOKEN>'

Response

  • Status Code: 200 OK

Sample Response Body

The response will include a list of companies with their details.

{
"success": true,
"data": [
{
"id": "company_id_1",
"name": "Company Name 1",
"address": "Company Address"
// additional fields...
},
{
"id": "company_id_2",
"name": "Company Name 2",
"address": "Company Address"
// additional fields...
}
// More companies...
]
}

Success Response Body

When successfully retrieving companies, the response will contain details for each company. Here's a breakdown of the response body:

FieldTypeDescription
successbooleanIndicates whether the request was successful.
dataarrayAn array of company objects containing detailed information about each company.
paginationobjectPagination details for navigating large sets of data.

Company Object Structure

Each company within the data array contains:

FieldTypeDescription
idstringID of the company.
entityIdnumberUnique identifier for the company within the system.
namestringName of the company.
emailstringEmail address associated with the company.
phoneNumberstringPrimary contact number for the company.
statusstringCurrent status of the company (e.g., "active").
billingAddressarrayAn array of billing address objects for the company.
shippingAddressarrayAn array of shipping address objects for the company.
priceListsarrayPrice lists associated with the company. Currently empty in the sample response.
productGroupsobjectProduct group inclusion/exclusion details.
shippingMethodsarrayShipping methods available for the company.
paymentMethodsarrayPayment methods available for the company.
isTaxExemptBooleanDoes company is Tax Exempt
paymentTermsArrayPayment Terms available for the company.
isSubCompanybooleanIndicates whether the company is a subsidiary.
createdByobjectInformation about the user or account that created this company entry.
metaFieldsarrayAdditional meta-information about the company. Currently empty in the sample response.
createdAtstringTimestamp of when the company entry was created.
updatedAtstringTimestamp of the last update to the company entry.
logostringURL of the company's logo, if available.
notesstringAdditional notes about the company.
companyGroupanyThe company group to which this company belongs, if applicable.

Billing/Shipping Address Structure

Each address (billing and shipping) contains:

FieldTypeDescription
idstringDatabase identifier for the address.
companyNamestringCompany name of this contact.
companyEmailstringCompany email of the contact.
firstNamestringFirst name of the contact person at this address.
lastNamestringLast name of the contact person at this address.
address1stringPrimary address line.
address2stringSecondary address line. Optional.
phoneNumberstringContact phone number for the address.
citystringCity of the address.
stateobjectState object containing the name and code of the state.
countryobjectCountry object containing the name and code of the country.
zipcodestringPostal code of the address.
isDefaultAddressbooleanIndicates whether this address is the default.
statusbooleanStatus of the address. Indicates active/inactive.
metaFieldsarrayMeta information related to the address. Currently empty in the sample response.
createdAtstringTimestamp of when the address was created.
updatedAtstringTimestamp of the last update to the address.

Payment Terms

FieldTypeDescription
paymentTermidId of payment Term.
depositRequiredbooleanIs deposit required for placing order
depositPercentagenumberDeposit percentage need to place order

Pagination Structure

Pagination information provided:

FieldTypeDescription
pagenumberThe current page number in the response.
totalnumberTotal number of records available.
countnumberNumber of records returned in the current response.

Error Responses

Status CodeDescription
400Bad Request: Invalid input data.
401Unauthorized: Access token is invalid or missing.
500Internal Server Error: An error occurred on the server.

Notes

  • Ensure the access token is valid and active to authenticate the request successfully.
  • The API may support pagination or filtering which should be included in the query if applicable.
  • Date fields (date_created:min, date_created:max, date_modified:min, date_modified:max) expect dates in the ISO 8601 format, e.g., 2024-09-30T00:00:00Z.
  • String filters like name and email use regular expressions, supporting partial matches and case insensitivity.
  • The metafields and metafields-in filters allow complex querying based on metafield values associated with the entities.