How do I create a contact through the marketing cloud REST API?
As Mohith comments, HTML Enabled
is a required attribute, however you shouldn't receive a 500 error. Here's a working request:
Host: https://www.exacttargetapis.com
POST /contacts/v1/contacts
Content-Type: application/json
Authorization: Bearer {{accessToken}}
{
"contactKey":"6dcb271e-06db-4100-bebb-b141469cd4d1",
"attributeSets":[
{
"name":"Email Addresses",
"items":[
{
"values":[
{
"name":"Email Address",
"value":"[email protected]"
},
{
"name":"HTML Enabled",
"value":true
}
]
}
]
}
]
}
This returns the response payload:
{
"operationStatus": "OK",
"rowsAffected": 1,
"contactKey": "6dcb271e-06db-4100-bebb-b141469cd4d1",
"contactID": 12345678,
"contactTypeID": 0,
"isNewContactKey": true,
"requestServiceMessageID": "23ba75f2-ab1c-4b67-93dd-08de25f28c42",
"hasErrors": false,
"resultMessages": [],
"serviceMessageID": "673451c6-ce6b-4329-b1bf-6e1e1664803e"
}
If you are still having issues, please double-check that you have Write permission enabled in Contacts > List And Subscribers in your app (in App Center).