I need to push some data on daily basis from ERP to SFMC

The package is already created on marketing cloud (read, write on Data extension).

I created a first POST request :

Body :

    "client_id": "client id of my package", 
    "client_secret": "client secret of my pakcage", 
    "account_id": "my accound id", 
    "grant_type": "client_credentials" 

URL : https://my_subdomain.auth.marketingcloudapis.com/v2/token

The second part is more confused for me. I created a second POST request :

URL : https://my_subdomain.rest.marketingcloudapis.com/data/v1/async/dataevents/key:External_Key_Of_My_Data_Extension/rowset

What i wrote in the body (raw & JSON):

Host: https://my_subdomain.rest.marketingcloudapis.com/
POST /hub/v1/dataevents/key:External_Key_Of_My_Data_Extension/rowset
Content-Type: application/json

In the authorization tab, I selected Bearer token and pasted the token that i obtained in the first POST request.

When i send the request =>

{"documentation":"https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm","errorcode":0,"message":"Bad Request"}

Does someone know where is my mistake ?

EDIT: Here my POST request

enter image description here

I had this message : {"documentation":"https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm","errorcode":0,"message":"Not Authorized"}

DOes someone know what does this mean ?

1 Answer 1


To insert Data Extension, you would need to use the REST API endpoint from this document

Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com
POST /data/v1/async/dataextensions/key:{{Your DE customer Key}}/rows
Content-Type: application/json
Authorization: Bearer YOUR_ACCESS_TOKEN

Sample Body:

   "items": [{
      "LastName" : "Jones",
      "ZipCode": "23456"
      "LastName" : "Sneed",
      "ZipCode": "23456"

In case you want to upsert a DE, then refer to this document

  • Thank you for your answer. In my case, I want to send data from a source A to a source B (my data extension). The source A is the data coming from the ERP and that will go to my DE on daily basis. I tried your method, i had error message (I edited my post to share what I wrote in the request). Sorry if it seems that my mistake is a stupid one, I'm completely a beginner in api call
    – ayakuza91
    Commented Jan 30, 2023 at 16:59
  • @ayakuza91 you might want to call the authentication request again to get a new access token then use it to retry with the 2nd call to insert the record to the DE. Since an access token v2 life time is 20 minutes.
    – Duc Le
    Commented Jan 30, 2023 at 17:03
  • Yes exactly, I managed to insert a record when i refresh the token and write a sample body but I don't know what looks like the data which is going to be pushed to me from ERP to my data extension so I don't know what I have to write in the body. How to parameter this ?
    – ayakuza91
    Commented Jan 31, 2023 at 8:48
  • @ayakuza91 I don't quite understand your question.. You are supposed to be the one who configures which value will be used in the body. For example, in the "items" array, you can specify "items": [{"Your field DE name 1" : "Your ERB value 1", "Your field DE name 2" : "Your ERB value 2"}, so on....]
    – Duc Le
    Commented Jan 31, 2023 at 9:12
  • 1
    ok I understand what you mean and it seems that I didn't really understand how does api call work. So, if the data that I want to push from ERP to a SFMC data extension contains 400 records (2 columns, 400 rows), should I have to 400 times like "items": [{"Your field DE name 1" : "Your ERB value 1", "Your ERB value 2", ... "Your ERB value 400","Your field DE name 2" : "Your ERB value 1","Your ERB value 2",..."Your ERB value 400"}
    – ayakuza91
    Commented Jan 31, 2023 at 9:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .