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_CUSTOMERorREAD_WRITE_CUSTOMER
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | String | Required. The ID of the sales rep. |
Query Parameters
| Parameter | Type | Description |
|---|---|---|
page | Integer | Page number to retrieve. Default is 1. |
limit | Integer | Number of entries per page. Default is 10. |
search | String | Search by company name or email (partial, case-insensitive match). |
accessType | String | Filter by access type: customer, roles or all. |
sort | String | Sort 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
| Field | Type | Description |
|---|---|---|
id | String | Unique identifier of the company access entry. |
salesRepId | String | ID of the sales rep. |
companyId | String | ID of the company. |
accessType | String | Type of access: customer, roles or all. |
customerIds | Array | IDs of the customers the sales rep can work with in this company. |
roleIds | Array | IDs of the customer roles the sales rep can work with in this company. |
company | Object | Company details: id, name, email, phoneNumber, status and isSubCompany. |
createdAt | String | Date and time the access was granted (ISO 8601). |
updatedAt | String | Date and time the access was last changed (ISO 8601). |
Pagination Details
| Field | Type | Description |
|---|---|---|
page | Integer | Current page number. |
total | Integer | Total number of entries that match the filters. |
count | Integer | Number of entries returned on this page. |
limit | Integer | Number of entries per page. |
Notes
- Sales reps with
accessAllset totruecan access every active company, even if this list is empty.