Skip to main content
Solved

Question about bulk profile import API how to get details of invalid email in the batch?


Forum|alt.badge.img

We are migrating from v1/v2 to new API. And we found that the individual profile import API cannot handle our workload (rate limit). So we are trying to use the bulk profile import. But we wonder that if there is one bad email in, say 1000, how could we find the offending email so that we can filter it out and resend the batch in case of failure. 

 

I know there is a profile-bulk-import-jobs API to get the status and info of the submitted job. Is the error details show us the offending email?

 

Similarly we will use bulk event API endpoints. We want to know if the same solution exists for bulk event job.

 

Thanks!

 

 

Best answer by QingZhu

Hi @carleygilmore,

 

Sorry about the wrong info. I worked on sending bulk events data to Klaviyo (in sandbox). I have to carefully exam the info at https://developers.klaviyo.com/en/reference/bulk_create_events. And I took another look at the example and found the section containing events. Sorry I did not look careful enough to find that part and reported to you of the, what I think, wrong example. Please ignore my previous complaint about the bulk event API example problem.

 

Thank you!

View original
Did this topic or the replies in the thread help you find an answer to your question?

5 replies

carleygilmore
Klaviyo Employee
Forum|alt.badge.img+2
  • Klaviyo Employee
  • 6 replies
  • June 10, 2024

Hi @QingZhu!

 

Thanks for using Klaviyo’s Developer Group and cheers on migrating to our new APIs! To fetch import errors for a specific bulk profile import job, you can call Get Bulk Profile Import Job Errors. The error message will contain a pointer containing a reference to the invalid email. Same goes for Bulk Create Events, that is, you will receive a 400 error with a pointer to the invalid email. I hope this answers your question!

 

Related resources:

Bulk Profile Import API
Bulk Create Events

 


Forum|alt.badge.img
  • Author
  • Problem Solver I
  • 3 replies
  • June 10, 2024

Hi @carleygilmore 

 

Thank you for the info! I will test my code today and intentionally add some invalid emails to see how I can get the info.

 

One more thing I want to mention is the example in bulk event API page is not correct. The payload in the example is a direct copy from that of the example in bulk profile API page. Would you please notify the relative part to review it?

 

Thank you!


carleygilmore
Klaviyo Employee
Forum|alt.badge.img+2
  • Klaviyo Employee
  • 6 replies
  • June 10, 2024

Awesome! Do you mind sending me these specific examples? I’m not sure if I’m seeing exactly what examples you’re referring to. Thanks so much for letting us know, as it’s important to us that our docs are correct and as helpful as possible.

 

Best,

 

Carley


Forum|alt.badge.img
  • Author
  • Problem Solver I
  • 3 replies
  • June 10, 2024

Yes, it is quoted on this page: https://developers.klaviyo.com/en/reference/bulk_create_events

Technically I am not 100% correct. The example’s “type” is correctly showing as “evetn-bulk-create”. But there are only “profile” in “attributes”, no “event”.

curl --request POST \
     --url https://a.klaviyo.com/api/event-bulk-create-jobs/ \
     --header 'Authorization: Klaviyo-API-Key your-private-api-key' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --header 'revision: 2024-05-15' \
     --data '
{
  "data": {
    "type": "event-bulk-create-job",
    "attributes": {
      "events-bulk-create": {
        "data": [
          {
            "type": "event-bulk-create",
            "attributes": {
              "profile": {
                "data": {
                  "type": "profile",
                  "attributes": {
                    "email": "sarah.mason@klaviyo-demo.com",
                    "phone_number": "+15005550006",
                    "first_name": "Sarah",
                    "last_name": "Mason",
                    "organization": "Example Corporation",
                    "title": "Regional Manager",
                    "image": "https://images.pexels.com/photos/3760854/pexels-photo-3760854.jpeg",
                    "location": {
                      "address1": "89 E 42nd St",
                      "address2": "1st floor",
                      "city": "New York",
                      "country": "United States",
                      "latitude": "40.7128",
                      "longitude": "74.0060",
                      "region": "NY",
                      "zip": "10017",
                      "timezone": "America/New_York",
                      "ip": "127.0.0.1"
                    }
                  },
                  "meta": {
                    "patch_properties": {
                      "unset": "skus"
                    }
                  }
                }
              }
            }
          }
        ]
      }
    }
  }
}
'


Forum|alt.badge.img
  • Author
  • Problem Solver I
  • 3 replies
  • Answer
  • June 11, 2024

Hi @carleygilmore,

 

Sorry about the wrong info. I worked on sending bulk events data to Klaviyo (in sandbox). I have to carefully exam the info at https://developers.klaviyo.com/en/reference/bulk_create_events. And I took another look at the example and found the section containing events. Sorry I did not look careful enough to find that part and reported to you of the, what I think, wrong example. Please ignore my previous complaint about the bulk event API example problem.

 

Thank you!