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 the request
rotationId
path integer The ID of the lead rotation
Try it out
Loading...
Output:
Responses
Description
Next user retrieved successfully
{ "user": { "userId": "string", "email": "string", "name": "string", "weight": 0, "id": 0 }, "rotationId": 0, "currentPosition": 0, "totalUsers": 0, "rotation": { "id": 0, "name": "string", "accountId": "string", "status": "string", "teamId": 0, "userRotationArray": [ "string" ], "currentPosition": 0, "createdAt": "string", "updatedAt": "string", "createdBy": "string", "updatedBy": "string", "team": { "id": 0, "account_id": "string", "accountId": "string", "name": "string", "active": true, "members": [ { "userId": 0, "email": "string", "name": "string" } ], "createdBy": "string", "updatedBy": "string", "createdAt": "string", "updatedAt": "string" } }, "newPosition": 0, "currentUser": "string", "nextUser": "string"}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/TeamMember#/components/schemas/Team#/components/schemas/LeadRotation#/components/schemas/NextUserResponse
#/components/parameters/xAccountIdHeader
in: headername: x-account-idschema: type: stringdescription: Account ID for the requestrequired: trueexample: "2311"|export type xAccountIdHeader = any; // Schema type not fully supported#/components/schemas/TeamMember
type: objectdescription: User who is a member of a teamproperties: userId: type: integer description: ID of the user email: type: string description: Email of the user name: type: string description: Name of the userrequired: - userId - email|export interface TeamMember { /** ID of the user */ userId: number; /** Email of the user */ email: string; /** Name of the user */ name?: string;}#/components/schemas/Team
type: objectdescription: Team informationproperties: id: type: integer description: Team ID readOnly: true account_id: type: string description: ID of the account that owns this team accountId: type: string description: ID of the account that owns this team name: type: string description: Team name active: type: boolean default: true description: Whether the team is active members: type: array items: $ref: "#/components/schemas/TeamMember" description: Users who are members of this team createdBy: type: string description: Email of the user who created the team updatedBy: type: string description: Email of the user who last updated the team createdAt: type: string format: date-time description: When the team was created readOnly: true updatedAt: type: string format: date-time description: When the team was last updated readOnly: truerequired: - name|export interface Team { /** Team ID */ id?: number; /** ID of the account that owns this team */ account_id?: string; /** ID of the account that owns this team */ accountId?: string; /** Team name */ name: string; /** Whether the team is active */ active?: boolean; /** Users who are members of this team */ members?: TeamMember[]; /** Email of the user who created the team */ createdBy?: string; /** Email of the user who last updated the team */ updatedBy?: string; /** When the team was created */ createdAt?: Date; /** When the team was last updated */ updatedAt?: Date;}#/components/schemas/LeadRotation
type: objectdescription: Lead rotation object representing a strategy for distributing leads among usersproperties: id: type: integer description: Unique identifier for the lead rotation name: type: string description: Name of the lead rotation accountId: type: string description: ID of the account that owns this lead rotation status: type: string description: Status of the lead rotation enum: - active - archived - queued teamId: type: integer description: ID of the team associated with this lead rotation userRotationArray: type: array items: type: string description: Array of user emails in the rotation order currentPosition: type: integer description: Current position in the rotation array createdAt: type: string format: date-time description: When the lead rotation was created updatedAt: type: string format: date-time description: When the lead rotation was last updated createdBy: type: string description: Email of the user who created the lead rotation updatedBy: type: string description: Email of the user who last updated the lead rotation team: $ref: "#/components/schemas/Team"required: - id - name - accountId - status - userRotationArray|export interface LeadRotation { /** Unique identifier for the lead rotation */ id: number; /** Name of the lead rotation */ name: string; /** ID of the account that owns this lead rotation */ accountId: string; /** Status of the lead rotation */ status: "active" | "archived" | "queued"; /** ID of the team associated with this lead rotation */ teamId?: number; /** Array of user emails in the rotation order */ userRotationArray: string[]; /** Current position in the rotation array */ currentPosition?: number; /** When the lead rotation was created */ createdAt?: Date; /** When the lead rotation was last updated */ updatedAt?: Date; /** Email of the user who created the lead rotation */ createdBy?: string; /** Email of the user who last updated the lead rotation */ updatedBy?: string; team?: Team;}#/components/schemas/NextUserResponse
type: objectdescription: Response containing information about the next user in the rotationproperties: user: type: object description: The user who is next in the rotation properties: userId: type: string description: ID of the user email: type: string description: Email of the user name: type: string description: Name of the user weight: type: integer description: Weight of the user in the rotation id: type: integer description: ID of the user rotationId: type: integer description: ID of the lead rotation currentPosition: type: integer description: Current position in the rotation (unchanged) totalUsers: type: integer description: Total number of users in the rotation rotation: $ref: "#/components/schemas/LeadRotation" newPosition: type: integer description: The updated position in the rotation after this operation currentUser: type: string description: The current user in the rotation nextUser: type: string description: The next user in the rotation|export interface NextUserResponse { /** The user who is next in the rotation */ user?: { userId?: string; email?: string; name?: string; weight?: number; id?: number; }; /** ID of the lead rotation */ rotationId?: number; /** Current position in the rotation (unchanged) */ currentPosition?: number; /** Total number of users in the rotation */ totalUsers?: number; rotation?: LeadRotation; /** The updated position in the rotation after this operation */ newPosition?: number; /** The current user in the rotation */ currentUser?: string; /** The next user in the rotation */ nextUser?: string;}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