To whom did escaped slaves have to pledge themselves to gain their freedom in the Spanish colonies?

Captain of the fort
Head of the church
King of Spain
Queen of France