I tested this approach on the local on-premise installation(10.15) where I have no access restrictions on both API gateway and external Elasticsearch(ES) instance used for storing analytics data(aka Analytics Datastore).
I haven't explored this yet on the .io hosted APIGW.
Having said that, you can in principle add the new custom variable into the index template using SOAPUI/POSTMAN if you have access to ES hosting your analytics data. You can refer the screenshot for sample request in my previous comment.
Let me know how it goes.
Regards,