Skip to main content

Get Sales Rep

This GET endpoint retrieves detailed information about a specific sales representative using their unique ID.

Endpoint

  • URL: /api/salesRep/:id
  • Method: GET

Path Parameters

ParameterTypeDescription
idstringThe unique identifier of the sales rep to retrieve.

Authentication

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

Request Headers

HeaderTypeDescription
accessTokenstringAccess token for authentication. (required)

Request Body

No request body is required for this GET operation.

Response

  • Status Code: 200 OK

Sample Response Body

A successful response will return detailed information about the sales representative:

{
"success": true,
"data": {
"id": "66a5023524b16685e42a1eda",
"email": "salesrep@example.com",
"firstName": "John",
"lastName": "Doe",
"phoneNumber": "+1234567890",
"company": "665434c100e82884676936b9",
"status": "active",
"salesRepCompanies": [
"665434c100e82884676936b9",
"665434c100e82884676936ba"
],
"metaFields": [],
"createdAt": "2024-07-27T14:20:37.573Z",
"updatedAt": "2024-08-03T10:29:32.489Z"
}
}

Success Response

Main Response Fields

FieldTypeDescription
successbooleanIndicates if the request was successful.
dataobjectContains the details of the sales rep.

Sales Rep Object (data)

FieldTypeDescription
idstringUnique identifier for the sales rep.
emailstringEmail address of the sales rep.
firstNamestringFirst name of the sales rep.
lastNamestringLast name of the sales rep.
phoneNumberstringContact number of the sales rep.
companystringPrimary company ID associated with the sales rep.
statusstringCurrent status of the sales rep (e.g., "active").
salesRepCompaniesarrayArray of company IDs assigned to the sales rep.
metaFieldsarrayAdditional metadata related to the sales rep.
createdAtstring (ISO 8601)Timestamp of when the sales rep was created.
updatedAtstring (ISO 8601)Timestamp of the last update to the sales rep data.

Error Responses

Status CodeDescription
400 Bad RequestInvalid request format or id parameter.
401 UnauthorizedThe access token is invalid or missing.
403 ForbiddenYou do not have permission to access this resource.
404 Not FoundNo sales rep matches the specified id.
500 Internal Server ErrorAn error occurred on the server.

Sample Error Response

{
"success": false,
"message": "Error message describing what went wrong"
}

Notes

  • Ensure the id in the URL is replaced with the actual ID of the sales rep you wish to view.
  • Confirm your access token is valid and has the necessary permissions (READ_WRITE_CUSTOMER scope) to access sales rep data.
  • This endpoint returns detailed sales rep information for authorized users.
  • Sensitive fields like password are automatically excluded from the response.

Examples

Example Request

GET /api/salesRep/66a5023524b16685e42a1eda

Example Response

{
"success": true,
"data": {
"id": "66a5023524b16685e42a1eda",
"email": "john.doe@example.com",
"firstName": "John",
"lastName": "Doe",
"phoneNumber": "+1234567890",
"company": "665434c100e82884676936b9",
"status": "active",
"salesRepCompanies": [
"665434c100e82884676936b9",
"665434c100e82884676936ba",
"665434c100e82884676936bb"
],
"metaFields": [
{
"key": "territory",
"value": "Northeast"
}
],
"createdAt": "2024-07-27T14:20:37.573Z",
"updatedAt": "2024-08-03T10:29:32.489Z"
}
}