# Using Last activity date when creating a workflow via the API

**URL:** <https://community.hubspot.com/t/using-last-activity-date-when-creating-a-workflow-via-the-api/20028>\
**Category:** APIs & Integrations\
**Tags:** workflows\
**Created:** [April 13, 2020, 11:40pm UTC](https://community.hubspot.com/t/using-last-activity-date-when-creating-a-workflow-via-the-api/20028 "2020-04-13T23:40:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![EBHamer](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/ebhamer/32/30191_2.png) [@EBHamer](https://community.hubspot.com/u/EBHamer)\
**Post date:** [April 13, 2020, 11:40pm UTC](https://community.hubspot.com/t/using-last-activity-date-when-creating-a-workflow-via-the-api/20028/1 "2020-04-13T23:40:36Z")

</div>

I am trying to use the workflow creation API, /automation/v3/workflows/, to create a workflow. I would like to branch on the Last Activity Date property being greater than 7 days. My JSON contains this:

…

“type”: “BRANCH”,  
“filters”: [  
[  
{  
“operator”: “GT”,  
“value”: “7 Days”,  
“name”: “Last activity date”,  
“property”: “last\_activity\_date”,  
“type”: “date”  
}  
]  
],  
“acceptActions”: [],  
“rejectActions”: []

…,

but this always leads to an error containing this: “branchErrors”:{“22811467”:[“BRANCH\_WITHOUT\_FILTERS”]}.

Is there a way to branch on the Last activity date?

---

<div class="post-metadata">

**Author:** ![WendyGoh](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/wendygoh/32/42320_2.png) [@WendyGoh](https://community.hubspot.com/u/WendyGoh)\
**Post date:** [April 14, 2020, 6:17am UTC](https://community.hubspot.com/t/using-last-activity-date-when-creating-a-workflow-via-the-api/20028/2 "2020-04-14T06:17:06Z")

</div>

Hey @EBHamer,

Are you looking to create a workflow with branch like this:

 ![Screen Shot 2020-04-14 at 2.14.47 PM.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/1/5/15bbac8d0fad95d72a2499a5a10574119ecaa0ac.png)

If so, I believe the format of the branch will be something like this:

```auto
actions:[
{
type:"BRANCH",
actionId:169706893,
filtersListId:513,
filters:[
[
{
filterFamily:"PropertyValue",
withinLastTime:7,
withinLastTimeUnit:"DAYS",
reverseWithinTimeWindow:true,
withinLastDays:7,
withinTimeMode:"PAST",
operator:"WITHIN_TIME",
property:"notes_last_updated",
type:"datetime"}]],
acceptActions:[],
rejectActions:[]}],

```

It looks like you might be missing out a couple of things such as: filterFamily, withinLastTime, withinLastTimeUnit.

Could you try adding these information in and see if it works?

---

<div class="post-metadata">

**Author:** ![EBHamer](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/ebhamer/32/30191_2.png) [@EBHamer](https://community.hubspot.com/u/EBHamer)\
**Post date:** [April 14, 2020, 10:16pm UTC](https://community.hubspot.com/t/using-last-activity-date-when-creating-a-workflow-via-the-api/20028/3 "2020-04-14T22:16:12Z")

</div>

Wendy,

Thank you very much for your help. This did work.

Where could I have looked to learn this for myself?

Thanks again,

Eric

---

<div class="post-metadata">

**Author:** ![WendyGoh](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/wendygoh/32/42320_2.png) [@WendyGoh](https://community.hubspot.com/u/WendyGoh)\
**Post date:** [April 15, 2020, 1:46am UTC](https://community.hubspot.com/t/using-last-activity-date-when-creating-a-workflow-via-the-api/20028/4 "2020-04-15T01:46:41Z")

</div>

Hey @EBHamer,

Generally, what I’d recommend is to create a workflow of your team desire and use the [Get workflows API](https://developers.hubspot.com/docs/methods/workflows/v3/get_workflows) to retrieve the specific parameter(s) needed for a particular action.
