Skip to main content

Update Sales Rep

Updates an existing sales rep. Only the fields you send are changed. Company access changes only when you send salesRepCompanies, assignAllCompanies or unassignAllCompanies.

HTTP Request​

  • URL: /salesRep/{id}
  • Method: PUT
  • Headers:
    • accessToken: Required. Your API access token.
    • Content-Type: application/json
  • Required scope: READ_WRITE_CUSTOMER

Path Parameters​

ParameterTypeDescription
idStringRequired. The ID of the sales rep to update.

Request Body​

The request body is a JSON object. All fields are optional, but at least one must be sent.

FieldTypeRequiredDescription
firstNameStringNoFirst name of the sales rep (2 to 30 characters).
lastNameStringNoLast name of the sales rep (up to 30 characters).
emailStringNoEmail address of the sales rep. Must be unique.
phoneNumberStringNoPhone number of the sales rep (6 to 15 characters).
statusStringNoactive, pending, invited or inactive.
verifiedEmailBooleanNoWhether the email address is verified.
notesStringNoInternal notes about the sales rep.
imageStringNoURL of the sales rep's profile image.
accessAllBooleanNoGive the sales rep access to every active company and all its customers.
salesRepCompaniesArrayNoReplaces the sales rep's company access. Companies not in the list are removed. See Sales Rep Companies Object.
assignAllCompaniesBooleanNoGive the sales rep access to every active company. When true, salesRepCompanies is not used.
unassignAllCompaniesBooleanNoRemove all company access before applying the other access fields.
defaultAccessTypeStringNoUsed with assignAllCompanies: customer, roles or all. Default is customer.
defaultRoleIdsArrayNoUsed with assignAllCompanies and defaultAccessType: "roles": IDs of the customer roles to grant.

cURL Example​

curl --location --request PUT '<BASE_URL>/salesRep/66b1c2d3e4f5a6b7c8d9e0f1' \
--header 'accessToken: <ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"status": "active",
"phoneNumber": "2125550199",
"salesRepCompanies": [
{
"company": "665434c100e82884676936b9",
"customers": ["66a5023524b16685e42a1eda", "66a5023524b16685e42a1edb"]
}
]
}'

Response​

  • 200 OK: The request was processed. Check success: it is false with the message Sales Rep doesn't exist if no sales rep matches the ID.
  • 400 Bad Request: The access token is missing or invalid, the token does not have the required scope, the request body is empty, or a field is invalid.

Sample JSON Response​

{
"success": true,
"message": "SalesRep updated successfully",
"data": {
"id": "66b1c2d3e4f5a6b7c8d9e0f1",
"firstName": "James",
"lastName": "Carter",
"email": "james.carter@aximcommerce.com",
"phoneNumber": "2125550199",
"status": "active",
"verifiedEmail": false,
"accessAll": false,
"metaFields": [],
"createdBy": {
"name": "ERP Connector api",
"type": "api"
},
"createdAt": "2024-08-06T09:12:51.204Z",
"updatedAt": "2024-10-09T13:05:59.036Z"
}
}

Response Details​

FieldTypeDescription
successBooleanWhether the sales rep was updated.
messageStringResult message.
dataObjectThe updated sales rep. The fields are the same as in Get All Sales Reps.

Notes​

  • Sending salesRepCompanies as an empty array removes all company access.
  • To change access for one company without affecting the others, use Manage Sales Rep Company Access.
  • The response does not include the company access. Use Get Sales Rep to see it.