You can schedule re-scan of all data on your Bitbucket with a single REST-call like this:
curl -u admin -X PUT https://{bitbucket.server}/rest/security/latest/status/total_rescan
CODE
You can monitor progress of scanning on the Security Scan Report page.
Please note, that if you have a large Bitbucket instance, all existing branches in all projects and repositories will be scanned, which may be very resource-intensive and may take a long time to complete.
For full documentation of this API, including changing the number of scans run in parallel, see REST API for Mass Scanning.