> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nymblecommerce.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Sales Reps API Reference for Nymble Commerce

> REST API reference for Nymble Commerce sales rep management — list rep organizations, manage assignments, and support assisted B2B ordering workflows.

The Sales Reps API manages sales representative accounts and their organization assignments within Nymble Commerce. Sales reps operate under the **SalesRep JWT role** — their token automatically scopes all requests to their assigned customers, so they can only access data for organizations they belong to. Administrative endpoints (create, update, delete, activate, deactivate) require the **Admin** role.

<Note>
  Sales reps receive an invitation email when they are added to an organization. They log in through your organization's identity provider and receive a scoped JWT that limits data access to their assigned customers.
</Note>

***

## GET /api/salesreps/organizations

Returns the list of organizations that the currently authenticated sales rep is assigned to. The rep's identity is resolved automatically from the `UserId` JWT claim — you do not pass a user ID in the request.

**Security:** Admin policy

**Route:** `GET https://api.achievemomentum.com/api/salesreps/organizations`

### Response

<ResponseField name="salesRepOrganizations" type="array">
  Array of organization assignments for the sales rep.

  <Expandable title="OrganizationSalesRep object">
    <ResponseField name="organizationId" type="string">
      Unique identifier of the organization.
    </ResponseField>

    <ResponseField name="organizationName" type="string">
      Display name of the organization.
    </ResponseField>

    <ResponseField name="identityOrganizationId" type="string">
      The identity provider's organization identifier.
    </ResponseField>

    <ResponseField name="identityProviderUserId" type="string">
      The identity provider's user identifier for this rep.
    </ResponseField>

    <ResponseField name="organizationSalesRepId" type="string">
      Unique identifier for this rep–organization assignment.
    </ResponseField>

    <ResponseField name="salesRepId" type="string">
      Unique identifier of the sales rep record.
    </ResponseField>

    <ResponseField name="repNumber" type="string">
      The rep's assigned representative number within the organization.
    </ResponseField>

    <ResponseField name="firstName" type="string">
      Sales rep's first name.
    </ResponseField>

    <ResponseField name="lastName" type="string">
      Sales rep's last name.
    </ResponseField>

    <ResponseField name="email" type="string">
      Sales rep's email address.
    </ResponseField>

    <ResponseField name="phoneNumber" type="string">
      Sales rep's phone number.
    </ResponseField>

    <ResponseField name="active" type="boolean">
      Whether this rep is currently active in the organization.
    </ResponseField>
  </Expandable>
</ResponseField>

```json title="Example response" theme={null}
{
  "salesRepOrganizations": [
    {
      "organizationId": "34ku8ni238sdin0n23cdm6",
      "organizationName": "Acme Distributors",
      "identityOrganizationId": "kinde_org_abc123",
      "identityProviderUserId": "kinde_user_xyz789",
      "organizationSalesRepId": "OJ76hgt87hgas4ffG5",
      "salesRepId": "KJ76hgt87hgas4ffG3",
      "repNumber": "REP-001",
      "firstName": "Jane",
      "lastName": "Smith",
      "email": "jane@acmedist.com",
      "phoneNumber": "555-555-5555",
      "active": true
    }
  ]
}
```

```bash title="curl example" theme={null}
curl -X GET \
  "https://api.achievemomentum.com/api/salesreps/organizations" \
  -H "Authorization: Bearer <sales_rep_token>"
```

***

## GET /api/organizations/salesreps

Returns a paginated list of all sales reps assigned to the authenticated administrator's organization.

**Security:** Admin policy

### Query parameters

<ParamField query="pageNumber" default="1" type="integer">
  Page number for pagination. Defaults to `1`.
</ParamField>

<ParamField query="pageSize" default="25" type="integer">
  Number of results per page. Defaults to `25`.
</ParamField>

<ParamField query="sortOn" default="RepNumber" type="string">
  Field to sort results by. Defaults to `RepNumber`.
</ParamField>

<ParamField query="sortDirection" default="asc" type="string">
  Sort direction. Accepts `asc` or `desc`. Defaults to `asc`.
</ParamField>

### Response

Returns an array of sales rep records.

<ResponseField name="organizationId" type="string">
  Unique identifier of the organization.
</ResponseField>

<ResponseField name="organizationSalesRepId" type="string">
  Unique identifier for this rep–organization assignment.
</ResponseField>

<ResponseField name="salesRepId" type="string">
  Unique identifier of the sales rep record.
</ResponseField>

<ResponseField name="firstName" type="string">
  Sales rep's first name.
</ResponseField>

<ResponseField name="lastName" type="string">
  Sales rep's last name.
</ResponseField>

<ResponseField name="email" type="string">
  Sales rep's email address.
</ResponseField>

<ResponseField name="phoneNumber" type="string">
  Sales rep's phone number.
</ResponseField>

<ResponseField name="repNumber" type="string">
  The rep's representative number within the organization.
</ResponseField>

<ResponseField name="active" type="boolean">
  Whether the sales rep is currently active in the organization.
</ResponseField>

```json title="Example response" theme={null}
[
  {
    "organizationId": "34ku8ni238sdin0n23cdm6",
    "organizationSalesRepId": "OJ76hgt87hgas4ffG5",
    "salesRepId": "KJ76hgt87hgas4ffG3",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "phoneNumber": "555-555-5555",
    "repNumber": "1234",
    "active": true
  },
  {
    "organizationId": "34ku8ni238sdin0n23cdm6",
    "organizationSalesRepId": "OJ76hgt87hgas4ffG6",
    "salesRepId": "AJ76hgt87hgas4ffG9",
    "firstName": "Mary",
    "lastName": "Doe",
    "email": "mary@doe.com",
    "phoneNumber": "555-555-5555",
    "repNumber": "MRY",
    "active": false
  }
]
```

```bash title="curl example" theme={null}
curl -X GET \
  "https://api.achievemomentum.com/api/organizations/salesreps?pageNumber=1&pageSize=25&sortOn=LastName&sortDirection=asc" \
  -H "Authorization: Bearer <admin_token>"
```

***

## PUT /api/organizations/salesreps

Creates a new sales rep and assigns them to your organization. If a sales rep with the given email already exists in the system, the existing rep record is reused and they are simply added to the organization. A welcome email is automatically sent to the rep with login instructions.

**Security:** Admin policy

### Request body

<ParamField body="firstName" type="string" required>
  Sales rep's first name.
</ParamField>

<ParamField body="lastName" type="string" required>
  Sales rep's last name.
</ParamField>

<ParamField body="email" type="string" required>
  Sales rep's email address. Used as the login identifier.
</ParamField>

<ParamField body="phoneNumber" type="string">
  Sales rep's phone number.
</ParamField>

<ParamField body="repNumber" type="string" required>
  Representative number to assign within the organization (e.g. `REP-001`).
</ParamField>

<ParamField body="roles" type="string[]">
  Roles to assign. Typically includes `SalesRep`.
</ParamField>

### Response

<ResponseField name="organizationId" type="string">
  The organization the rep was added to.
</ResponseField>

<ResponseField name="organizationName" type="string">
  Display name of the organization.
</ResponseField>

<ResponseField name="organizationSalesRepId" type="string">
  Unique identifier for this rep–organization assignment.
</ResponseField>

<ResponseField name="salesRepId" type="string">
  Unique identifier of the sales rep record.
</ResponseField>

<ResponseField name="firstName" type="string">
  Sales rep's first name.
</ResponseField>

<ResponseField name="lastName" type="string">
  Sales rep's last name.
</ResponseField>

<ResponseField name="email" type="string">
  Sales rep's email address.
</ResponseField>

<ResponseField name="phoneNumber" type="string">
  Sales rep's phone number.
</ResponseField>

<ResponseField name="repNumber" type="string">
  The assigned representative number.
</ResponseField>

<ResponseField name="identityProvider" type="string">
  The identity provider used (e.g. `IdP`).
</ResponseField>

<ResponseField name="identityProviderUserId" type="string">
  The identity provider's user identifier for this rep.
</ResponseField>

```json title="Example request" theme={null}
{
  "firstName": "John",
  "lastName": "Doe",
  "email": "john@doe.com",
  "phoneNumber": "123-456-7890",
  "repNumber": "REP-001",
  "roles": ["SalesRep"]
}
```

```bash title="curl example" theme={null}
curl -X PUT \
  "https://api.achievemomentum.com/api/organizations/salesreps" \
  -H "Authorization: Bearer <admin_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "phoneNumber": "123-456-7890",
    "repNumber": "REP-001",
    "roles": ["SalesRep"]
  }'
```

***

## PATCH /api/organizations/salesreps

Updates a sales rep's representative number within the organization.

**Security:** Admin policy

### Request body

<ParamField body="organizationSalesRepId" type="string" required>
  The unique identifier of the rep–organization assignment to update.
</ParamField>

<ParamField body="repNumber" type="string" required>
  The new representative number to assign.
</ParamField>

### Response

<ResponseField name="organizationId" type="string">
  The organization the rep belongs to.
</ResponseField>

<ResponseField name="organizationSalesRepId" type="string">
  Unique identifier for the rep–organization assignment.
</ResponseField>

<ResponseField name="salesRepId" type="string">
  Unique identifier of the sales rep record.
</ResponseField>

<ResponseField name="repNumber" type="string">
  The updated representative number.
</ResponseField>

<ResponseField name="firstName" type="string">
  Sales rep's first name.
</ResponseField>

<ResponseField name="lastName" type="string">
  Sales rep's last name.
</ResponseField>

<ResponseField name="email" type="string">
  Sales rep's email address.
</ResponseField>

<ResponseField name="success" type="boolean">
  `true` if the update succeeded.
</ResponseField>

```bash title="curl example" theme={null}
curl -X PATCH \
  "https://api.achievemomentum.com/api/organizations/salesreps" \
  -H "Authorization: Bearer <admin_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "organizationSalesRepId": "KJ76hgt87hgas4ffG3",
    "repNumber": "REP-099"
  }'
```

***

## POST /api/organizations/salesreps/activate

Reactivates a previously deactivated sales rep within your organization. The rep's identity provider access and data sync permissions are restored, and they receive a re-invitation email.

**Security:** Admin policy

### Request body

<ParamField body="organizationSalesRepId" type="string" required>
  The unique identifier of the rep–organization assignment to activate.
</ParamField>

### Response

Returns `200 OK` with no body on success.

```bash title="curl example" theme={null}
curl -X POST \
  "https://api.achievemomentum.com/api/organizations/salesreps/activate" \
  -H "Authorization: Bearer <admin_token>" \
  -H "Content-Type: application/json" \
  -d '{ "organizationSalesRepId": "KJ76hgt87hgas4ffG3" }'
```

***

## POST /api/organizations/salesreps/deactivate

Deactivates a sales rep within your organization. Their login access and data sync permissions are revoked, but their record is preserved. You can reactivate them at any time.

**Security:** Admin policy

### Request body

<ParamField body="organizationSalesRepId" type="string" required>
  The unique identifier of the rep–organization assignment to deactivate.
</ParamField>

### Response

Returns `200 OK` with no body on success.

```bash title="curl example" theme={null}
curl -X POST \
  "https://api.achievemomentum.com/api/organizations/salesreps/deactivate" \
  -H "Authorization: Bearer <admin_token>" \
  -H "Content-Type: application/json" \
  -d '{ "organizationSalesRepId": "KJ76hgt87hgas4ffG3" }'
```

***

## DELETE /api/organizations/salesreps

Permanently removes a sales rep from your organization. If the rep belongs to other organizations, only their access to your organization is revoked. If this is their only organization, their account is fully deleted from the identity provider and data sync system.

**Security:** Admin policy

<Warning>
  This action permanently removes the sales rep's access to your organization and cannot be undone. To temporarily suspend access, use the [deactivate](#post-apiorganizationssalesrepsdeactivate) endpoint instead.
</Warning>

### Request body

<ParamField body="organizationSalesRepId" type="string" required>
  The unique identifier of the rep–organization assignment to delete.
</ParamField>

### Response

<ResponseField name="success" type="boolean">
  `true` if the deletion succeeded.
</ResponseField>

```bash title="curl example" theme={null}
curl -X DELETE \
  "https://api.achievemomentum.com/api/organizations/salesreps" \
  -H "Authorization: Bearer <admin_token>" \
  -H "Content-Type: application/json" \
  -d '{ "organizationSalesRepId": "KJ76hgt87hgas4ffG3" }'
```
