GET /lead-rotations/{rotationId}/next-user
Get the next user in a lead rotation
Retrieves the next user in the specified lead rotation and updates the current rotation position. The user must have access to the account that owns the rotation.
Authentication Required
Authorization: Bearer {token}
header string This header is required to access this endpoint
Required Parameters
x-account-id
header string Account ID for multi-tenant context
rotationId
path integer The ID of the lead rotation
Try it out
Loading...
Output:
Responses
Description
Next user retrieved successfully
{ "user": { "id": 0, "email": "string", "name": "string", "userId": "string", "weight": 0 }, "rotationId": "string", "newPosition": 0, "totalUsers": 0, "currentUser": "string", "nextUser": "string", "rotation": { "id": 0, "uniqueId": "string", "accountId": "string", "name": "string", "ticketTypeId": "string", "status": "string", "userRotationArray": [ { "userId": "string", "email": "string", "name": "string", "weight": 0 } ], "currentPosition": 0, "createdAt": "string", "updatedAt": "string", "createdBy": "string", "updatedBy": "string" }, "currentPosition": 0}Description
Unauthorized - User not authenticated
Description
Forbidden - User does not have permission to access this lead rotation
Description
Lead rotation not found
Description
Internal server error
References
#/components/parameters/xAccountIdHeader#/components/schemas/UserRotationMember#/components/schemas/TicketRotation#/components/schemas/NextUserResponse
#/components/parameters/xAccountIdHeader
in: headername: x-account-idschema: type: stringdescription: Account ID for multi-tenant contextrequired: trueexample: "2311"|export type xAccountIdHeader = any; // Schema type not fully supported#/components/schemas/UserRotationMember
type: objectdescription: A user in the rotation with their weightproperties: userId: type: string description: Unique ID of the user email: type: string description: Email of the user name: type: string description: Display name of the user weight: type: integer minimum: 1 maximum: 10 description: Weight for this user in the rotation (1-10). Higher weight means they receive more tickets.required: - userId - email - name - weight>export interface UserRotationMember { /** Unique ID of the user */ userId: string; /** Email of the user */ email: string; /** Display name of the user */ name: string; /** Weight for this user in the rotation (1-10). Higher weight means they receive more tickets. */ weight: number;}#/components/schemas/TicketRotation
type: objectdescription: Ticket rotation object representing a weighted round-robin strategy for distributing tickets among usersproperties: id: type: integer description: Internal database ID uniqueId: type: string description: Unique identifier for the ticket rotation accountId: type: string description: ID of the account that owns this ticket rotation name: type: string description: Name of the ticket rotation ticketTypeId: type: string description: ID of the ticket type associated with this rotation status: type: string description: Status of the ticket rotation enum: - active - inactive userRotationArray: type: array items: $ref: "#/components/schemas/UserRotationMember" description: Array of users in the rotation with their assigned weights (1-10) currentPosition: type: integer description: Current position in the weighted rotation array createdAt: type: string format: date-time description: When the ticket rotation was created updatedAt: type: string format: date-time description: When the ticket rotation was last updated createdBy: type: string description: Email of the user who created the ticket rotation updatedBy: type: string description: Email of the user who last updated the ticket rotationrequired: - id - uniqueId - accountId - name - status - userRotationArray|export interface TicketRotation { /** Internal database ID */ id: number; /** Unique identifier for the ticket rotation */ uniqueId: string; /** ID of the account that owns this ticket rotation */ accountId: string; /** Name of the ticket rotation */ name: string; /** ID of the ticket type associated with this rotation */ ticketTypeId?: string; /** Status of the ticket rotation */ status: "active" | "inactive"; /** Array of users in the rotation with their assigned weights (1-10) */ userRotationArray: UserRotationMember[]; /** Current position in the weighted rotation array */ currentPosition?: number; /** When the ticket rotation was created */ createdAt?: Date; /** When the ticket rotation was last updated */ updatedAt?: Date; /** Email of the user who created the ticket rotation */ createdBy?: string; /** Email of the user who last updated the ticket rotation */ updatedBy?: string;}#/components/schemas/NextUserResponse
type: objectdescription: Response containing information about the next user in the rotation (read-only, does not change position)properties: user: type: object description: The user who is next in the rotation properties: id: type: integer description: ID of the user email: type: string description: Email of the user name: type: string description: Name of the user userId: type: string description: ID of the user weight: type: integer description: Weight of the user in the rotation rotationId: type: string description: ID of the ticket rotation newPosition: type: integer description: The updated position in the rotation after this operation totalUsers: type: integer description: Total number of users in the rotation currentUser: type: string description: The current user in the rotation nextUser: type: string description: The next user in the rotation rotation: $ref: "#/components/schemas/TicketRotation" currentPosition: type: integer description: Current position in the rotation (unchanged)|export interface NextUserResponse { /** The user who is next in the rotation */ user?: { id?: number; email?: string; name?: string; userId?: string; weight?: number; }; /** ID of the ticket rotation */ rotationId?: string; /** The updated position in the rotation after this operation */ newPosition?: number; /** Total number of users in the rotation */ totalUsers?: number; /** The current user in the rotation */ currentUser?: string; /** The next user in the rotation */ nextUser?: string; rotation?: TicketRotation; /** Current position in the rotation (unchanged) */ currentPosition?: number;}Route Source Code
Check out the source code for this route entrypoint here: /lead-rotations/[rotationId]/next-user/route.ts
Or the swagger.yaml spec this documentation was generated from:
/lead-rotations/swagger.yaml