@gsmoore: The end_time attribute can be useful (note that it’s possible for its value to be null). The campaign entities also include a servable attribute, which may be helpful:
$ twurl -H ads-api.twitter.com "/1/accounts/18ce54d4x5t/campaigns?sort_by=created_at-desc&count=1" | jq
{
"request": {
"params": {
"count": 1,
"account_id": "18ce54d4x5t",
"sort_by": [
"created_at-desc"
]
}
},
"data": [
{
"name": "campaign",
"start_time": "2016-03-01T00:00:01Z",
"reasons_not_servable": [
"PAUSED_BY_ADVERTISER"
],
"servable": false,
"daily_budget_amount_local_micro": 500000,
"end_time": null,
"funding_instrument_id": "lygyi",
"duration_in_days": null,
"standard_delivery": true,
"total_budget_amount_local_micro": 1000000,
"id": "7qcdp",
"entity_status": "PAUSED",
"paused": true,
"account_id": "18ce54d4x5t",
"frequency_cap": null,
"currency": "USD",
"created_at": "2017-03-09T23:01:20Z",
"updated_at": "2017-03-09T23:01:20Z",
"deleted": false
}
],
"data_type": "campaign",
"total_count": 53,
"next_cursor": "yocerqhl5ja53tin6za4g"
}
However, keep in mind that the decision to pull stats also depends on the last time stats were pulled for the entities you’re considering.
Let’s say a campaign was created on 2017-01-23 at 00:00:01 UTC and has an end date of 2017-01-24 at 00:00:01 UTC. If you have a job to pull stats every day at 12:00:00 UTC and use end_time as the criterion to determine whether you should pull stats for a specific entity, then on 2017-01-24 at 12:00:00 UTC, the specific campaign will have ended. If you decide not to pull stats, then you’ll miss the data between 2017-01-23 at 12:00:01 UTC (the time after the last pull) and 2017-01-24 at 00:00:01 UTC (the campaign’s end time).
Hope this helps!