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
| Parameter | Type | Description |
|---|---|---|
id | String | Required. 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.
| Field | Type | Required | Description |
|---|---|---|---|
firstName | String | No | First name of the sales rep (2 to 30 characters). |
lastName | String | No | Last name of the sales rep (up to 30 characters). |
email | String | No | Email address of the sales rep. Must be unique. |
phoneNumber | String | No | Phone number of the sales rep (6 to 15 characters). |
status | String | No | active, pending, invited or inactive. |
verifiedEmail | Boolean | No | Whether the email address is verified. |
notes | String | No | Internal notes about the sales rep. |
image | String | No | URL of the sales rep's profile image. |
accessAll | Boolean | No | Give the sales rep access to every active company and all its customers. |
salesRepCompanies | Array | No | Replaces the sales rep's company access. Companies not in the list are removed. See Sales Rep Companies Object. |
assignAllCompanies | Boolean | No | Give the sales rep access to every active company. When true, salesRepCompanies is not used. |
unassignAllCompanies | Boolean | No | Remove all company access before applying the other access fields. |
defaultAccessType | String | No | Used with assignAllCompanies: customer, roles or all. Default is customer. |
defaultRoleIds | Array | No | Used 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 isfalsewith the messageSales Rep doesn't existif 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
| Field | Type | Description |
|---|---|---|
success | Boolean | Whether the sales rep was updated. |
message | String | Result message. |
data | Object | The updated sales rep. The fields are the same as in Get All Sales Reps. |
Notes
- Sending
salesRepCompaniesas 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.