di che linguaggio parli, in generale?
Le api si usano in maniera simile su tutti i linguaggi, ti mostro un esempio con C++.

codice:
#include <windows.h>//per usare le APIwin32 

const int Mouse_BUTTON_1 = 0
const int Mouse_BUTTON_2 = 1
const int Mouse_BUTTON_3 = 2

//sposta il cursore
_SetCursorPos(int x, int y) 
{ 
SetCursorPos(x, y);//api per spostare il mouse 
} 

//Funaione che clicca col mouse 
_Mouse_ClickPoint(int x, int y, int button) { 
    switch(button) { 
     case Mouse_BUTTON_1: 
mouse_event(MOUSEEVENTF_LEFTDOWN, x, y, 0, 0); 
     mouse_event(MOUSEEVENTF_LEFTUP, x, y, 0, 0); 
     break; 
     case Mouse_BUTTON_2: 
     mouse_event(MOUSEEVENTF_MIDDLEDOWN, x, y, 0, 0); 
     mouse_event(MOUSEEVENTF_MIDDLEUP, x, y, 0, 0); 
     break; 
     case Mouse_BUTTON_3: 
     mouse_event(MOUSEEVENTF_RIGHTDOWN, x, y, 0, 0); 
     mouse_event(MOUSEEVENTF_RIGHTUP, x, y, 0, 0); 
break; 
     } 
} 

main() {
_SetCursorPos(400, 300);
_Mouse_ClickPoint(400, 300, Mouse_BUTTON_1);

return 0;
}