Yes, to use a Cookie as a Cache Key, you can create it through a Header and attaching a Condition.
Access to the Fastly API is available from the following file on your cluster:
/mnt/shared/fastly_tokens.txt
We recommend attempting this on your Staging service before implementing it on Production.
Please refer to our community post on working with the API.