Skip to main content
Solved

didn’t find many campaigns properties in the date-versioned API


Forum|alt.badge.img+3

Hi there,

We’re migrating our integration with Klaviyo from v1 to the date-versioned API. Now I research stable version ‘2023-02-22’.

Getting data from the endpoint /api/campaigns/, I didn’t find many campaigns properties such as:

campaign_type
object
subject
from_email
from_name
num_recipients

Please advise where I can get these properties.

Thanks in advance!

Regards,

Evgeniy

Best answer by Brian Turcotte

Hi @imp_dev!

 

So I spoke with Engineering, and it turns out that all of this information is still available via API - you may just have to call multiple different endpoints such as GET Campaign + Get Campaign Message + Get Campaign Recipient Estimation, whereas previously this may have all been provided through one endpoint.

 

This restructuring will enable us to add some expanded functionality to each endpoint that the UI has that hasn't been possible to do in the API before.

 

I hope this helps to clarify!

- Brian

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

4 replies

Brian Turcotte
Forum|alt.badge.img+37

Hi @imp_dev!

 

May I ask what information you are receiving from the new endpoints, if any? Let me check on this with Engineering for you and I’ll get back to the thread ASAP on the expected behavior of this endpoint. 

 

Thanks,

Brian


Forum|alt.badge.img+3
  • Author
  • Contributor IV
  • 8 replies
  • March 20, 2023

Hi Brian,

Thank you for looking here!

For example, I’ve got the following data for one of campaigns:

curl -L -X GET 'https://a.klaviyo.com/api/campaigns/01GV3PM3H0984SCV55V5DMF67W' \
-H 'Authorization: Klaviyo-API-Key {{api_key}}' \
-H 'revision: 2023-02-22' \
-H 'Accept: application/json'

response:

Show content

{
    "data": {
        "type": "campaign",
        "id": "01GV3PM3H0984SCV55V5DMF67W",
        "attributes": {
            "name": "B456-075106 - c1 - EXTERNAL - 2023 March Email - Turkey Tuesday - Turkey Vest - 3/14/23",
            "status": "Sent",
            "archived": false,
            "channel": "email",
            "audiences": {
                "included": [
                    "W5ykDG"
                ],
                "excluded": []
            },
            "send_options": {
                "use_smart_sending": false,
                "ignore_unsubscribes": false
            },
            "message": "01GV3PM3KS7Z20SZRZ17P1Q948",
            "tracking_options": {
                "is_tracking_opens": true,
                "is_tracking_clicks": true,
                "is_add_utm": false,
                "utm_params": []
            },
            "send_strategy": {
                "method": "ab_test_campaign",
                "options_static": null,
                "options_throttled": null,
                "options_sto": null
            },
            "created_at": "2023-03-09T17:27:41.857059+00:00",
            "scheduled_at": "2023-03-13T16:10:52.583002+00:00",
            "updated_at": "2023-03-14T21:45:07.437708+00:00",
            "send_time": "2023-03-14T21:00:00+00:00"
        },
        "links": {
            "self": "https://a.klaviyo.com/api/campaigns/01GV3PM3H0984SCV55V5DMF67W/"
        }
    }
}

 

However, in v1 API we had another set of properties for the same campaign:

curl -L -X GET 'https://a.klaviyo.com/api/v1/campaign/01GV3PM3H0984SCV55V5DMF67W?api_key={{api_key}}'

Show content

{
    "object": "campaign",
    "id": "01GV3PM3H0984SCV55V5DMF67W",
    "subject": "Featured Product: Turkey Vest With Optional Bino Connect Kit",
    "from_email": "info@badlandspacks.com",
    "from_name": "Badlands",
    "sent_at": "2023-03-14 21:45:07",
    "send_time": "2023-03-14 21:00:00",
    "name": "B456-075106 - c1 - EXTERNAL - 2023 March Email - Turkey Tuesday - Turkey Vest - 3/14/23",
    "lists": [
        {
            "object": "list",
            "id": "W5ykDG",
            "name": "Profiles_huntspecies_turkey",
            "list_type": "segment",
            "folder": null,
            "created": "2023-03-09 17:21:07",
            "updated": "2023-03-09 17:26:31",
            "person_count": 37134
        }
    ],
    "excluded_lists": [],
    "status": "sent",
    "status_id": 1,
    "status_label": "Sent",
    "created": "2023-03-09 17:27:41",
    "updated": "2023-03-14 21:45:07",
    "num_recipients": 31234,
    "campaign_type": "A/B Send Time",
    "is_segmented": true,
    "message_type": "email",
    "template": {
        "object": "email-template",
        "id": "S3bxFP",
        "html": "«...CUT OUT...>>"

    }

}

 

So, I can’t find the following campaign properties in the new API:

campaign_type
object
subject
from_email
from_name
num_recipients


Brian Turcotte
Forum|alt.badge.img+37
  • Klaviyo Alum
  • 1393 replies
  • Answer
  • March 20, 2023

Hi @imp_dev!

 

So I spoke with Engineering, and it turns out that all of this information is still available via API - you may just have to call multiple different endpoints such as GET Campaign + Get Campaign Message + Get Campaign Recipient Estimation, whereas previously this may have all been provided through one endpoint.

 

This restructuring will enable us to add some expanded functionality to each endpoint that the UI has that hasn't been possible to do in the API before.

 

I hope this helps to clarify!

- Brian


Forum|alt.badge.img+3
  • Author
  • Contributor IV
  • 8 replies
  • March 24, 2023

Hi Brian,

Thank you for the info provided!

I’ve managed to get mentioned fields.

Kind regards,

Evgeniy