You can schedule re-scan of all data on your Bitbucket with a single REST-call like this:
curl -u admin -v -X PUT -d "" -H "Content-Type: application/json" http://bitbucket.server/rest/security/latest/status/total_rescan
admin is your Bitbucket admin user (you’ll be prompted for a password) and
bitbucket.server is URL of your Bitbucket server. 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 more documentation of this API, including changing the number of scans run in parallel, see REST API for Mass Scanning.