You need to create plugin in di.xml inside etc/webapi_rest folder to call plugin only in REST API.
Example :
app/code/Vendor/Module/etc/webapi_rest/di.xml :
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Catalog\Api\ProductCustomOptionRepositoryInterface">
<plugin name="updateProductCustomOptionsAttributes" type="Magento\Catalog\Plugin\Model\Product\Option\UpdateProductCustomOptionsAttributes"/>
</type>
</config>
Add your plugin based on your requirement in di.xml.