CRM API shows only the first char of the result?
Since you are using getvalue, $result will be the contact's custom_13 value, so you don't need a foreach loop.

Try using below snippet

{crmAPI var='result' entity='Contact' action='getvalue' sequential=0 return="custom_13" id=$contactId}
Custom 13: {$result}


Pradeep