Not a question that arises in connection with drafting a contract or pleadings (one hopes), but certainly in composing e-mail.
Both are recognised forms.
On the traditional assumption that the expression was originally shorthand for all correct (rendered in humorous, dialectical or unschooled US English as oll (or orl) korrect), OK has the merit of being closer to the source.
There is something fishy-sounding about that etymology, I’ve always thought, but the OED and Fowler repeat it. The latter gives some other possible origins and a case reference to Nippon Menkwa Kabushiki Kaisha (Japan Cotton Trading Co Ltd) v Dawsons Bank Ltd  51 Ll LR 147 (PC (Burma), 1935), where Lord Russell of Killowen calls it a ‘commercial barbarism’ but accepts its usage in business transactions (even if, on the facts of the case, writing O.K. on an invoice did not give rise to an estoppel).
The older usage citations in the OED have OK (the first is from 1839), with okay appearing later in the nineteenth century, so OK also appears to have age on its side. Spell with or without periods (I prefer to omit them).
Okeh is a variant (and the name of a jazz record company founded in 1918 by Otto K.E. Heinemann, as an obvious play on his initials and the popular expression). Okey-doke and okey-dokey emerged in the 1930s, Ned Flanders’s okely-dokely circa 1990.