@WBYeats,
Yes, optional. And as Dale said, it's more colloquial (although slightly less formal) to include the "to".
A stickler (pedant?) would say that the infinitive should not be split: "to access" is the infinitive, and "only" should not come between them. But this is an out-moded concept, and infinitives are regularly split today, without great harm.
Of course, if you omit the "to" in the examples given, that problem is removed, and the sentences become more elegant.