Skip to main content

Get All Sales Rep Company Access

Retrieves the companies a sales rep can access, with pagination, search and basic company details. This is useful when a sales rep has access to many companies.

HTTP Request​

  • URL: /salesRep/{id}/companyAccess
  • Method: GET
  • Headers:
    • accessToken: Required. Your API access token.
  • Required scope: READ_CUSTOMER or READ_WRITE_CUSTOMER

Path Parameters​

ParameterTypeDescription
idStringRequired. The ID of the sales rep.

Query Parameters​

ParameterTypeDescription
pageIntegerPage number to retrieve. Default is 1.
limitIntegerNumber of entries per page. Default is 10.
searchStringSearch by company name or email (partial, case-insensitive match).
accessTypeStringFilter by access type: customer, roles or all.
sortStringSort order as field:direction. Field is createdAt or updatedAt, direction is asc or desc. Default is createdAt:desc.

cURL Example​

curl --location '<BASE_URL>/salesRep/66b1c2d3e4f5a6b7c8d9e0f1/companyAccess?page=1&limit=20&search=northwind' \
--header 'accessToken: <ACCESS_TOKEN>'

Response​

  • 200 OK: The list of company access entries was returned successfully.
  • 400 Bad Request: The access token is missing or invalid, the token does not have the required scope, or the sales rep ID is not valid.
  • 404 Not Found: No sales rep matches the ID (Sales Rep doesn't exist).

Sample JSON Response​

{
"success": true,
"data": [
{
"id": "66b1c2d3e4f5a6b7c8d9e0f2",
"salesRepId": "66b1c2d3e4f5a6b7c8d9e0f1",
"companyId": "665434c100e82884676936b9",
"accessType": "customer",
"customerIds": ["66a5023524b16685e42a1eda"],
"roleIds": [],
"company": {
"id": "665434c100e82884676936b9",
"name": "Northwind Supply",
"email": "purchasing@northwindsupply.com",
"phoneNumber": "9735550100",
"status": "active",
"isSubCompany": false
},
"createdAt": "2024-08-06T09:12:51.311Z",
"updatedAt": "2024-09-18T15:40:02.902Z"
}
],
"pagination": {
"page": 1,
"total": 1,
"count": 1,
"limit": 20
}
}

Response Details​

Company Access Data​

FieldTypeDescription
idStringUnique identifier of the company access entry.
salesRepIdStringID of the sales rep.
companyIdStringID of the company.
accessTypeStringType of access: customer, roles or all.
customerIdsArrayIDs of the customers the sales rep can work with in this company.
roleIdsArrayIDs of the customer roles the sales rep can work with in this company.
companyObjectCompany details: id, name, email, phoneNumber, status and isSubCompany.
createdAtStringDate and time the access was granted (ISO 8601).
updatedAtStringDate and time the access was last changed (ISO 8601).

Pagination Details​

FieldTypeDescription
pageIntegerCurrent page number.
totalIntegerTotal number of entries that match the filters.
countIntegerNumber of entries returned on this page.
limitIntegerNumber of entries per page.

Notes​

  • Sales reps with accessAll set to true can access every active company, even if this list is empty.