Facebook ads custom audience Data is missing or does not match schema error

312 views Asked by At

i was building a integration with the facebook ads audience API, and according the documentation the request must be created like this:

POST - https://graph.facebook.com/v15.0/<MY_CUSTOM_AUDIENCE_ID>/users?access_token=<MY_ACCESS_TOKEN>

{
    "session":{
        "session_id":1, 
        "batch_seq":1, 
        "last_batch_flag":true, 
        "estimated_num_total":1
    },
    "payload":{
         "schema":[
            "FN"
    ],
        "data":
    [
     "8b1ebea129cee0d2ca86be6706cd2dfcf79aaaea259fd0c311bdbf2a192be148"
    ]
    }
}
Using the previus example a received a error 400:

{ "error": { "message": "(#100) Data is missing or does not match schema", "type": "OAuthException", "code": 100, "fbtrace_id": "AqrLd9uIw0D4BBFtHF33bdU" } }


For do this i used this documentation https://developers.facebook.com/docs/marketing-api/audiences/guides/custom-audiences#hash

Anyone has use this before?

1

There are 1 answers

0
1XTR On

Your schema field type is array but array use form multi-key qualification.

Change it to string: schema: 'FN' In docs you can see all formats.

This payload with multi keys work for me:

{
    "session": {
        "session_id": 123,
        "batch_seq": 1,
        "last_batch_flag": true
    },
    "payload": {
        "schema": [
            "EMAIL",
            "PHONE",
            "FN"
        ],
        "data": [
            ["EMAIL_HASH", "PHONE_HASH", "FN_HASH"]
        ]
    }
}