how to get clients sync status via API I try to use the build in API by bitcoin client and I wonder how to get the sync status via API of a runing client.
You can do it like this:

1) getblockcount gives you the most recent block you have [call it n]

2) getblockhash n gives you the hash for that block [call it hash]

3) getblock hash gives you the block. You can compare the time of that block with the current time, and estimate how many blocks behind you are. It should be approximately (now - blocktime) / 600 if the times are in seconds.