By default a spidering of the site is performed automatically at the end of a deploy. If you only need the spidering without a deploy, you can trigger it by calling this endpoint.
const SiteClient = require('datocms-client').SiteClient;const client = new SiteClient('YOUR-API-TOKEN');const buildTriggerId = '1822';client.buildTriggers.reindex(buildTriggerId).then(() => {console.log('Done!');}).catch((error) => {console.error(error);});