# Unable to update goals via API

**URL:** <https://community.hubspot.com/t/unable-to-update-goals-via-api/124643>\
**Category:** APIs & Integrations\
**Tags:** python\
**Created:** [January 23, 2025, 3:56pm UTC](https://community.hubspot.com/t/unable-to-update-goals-via-api/124643 "2025-01-23T15:56:04Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![AAjenifuja](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@AAjenifuja](https://community.hubspot.com/u/AAjenifuja)\
**Post date:** [January 23, 2025, 3:56pm UTC](https://community.hubspot.com/t/unable-to-update-goals-via-api/124643/1 "2025-01-23T15:56:04Z")

</div>

I’m unable to update goals via the python API.

Executing either one of the following:

```lia-code-sample
from hubspot.crm.objects.goals import BatchInputSimplePublicObjectBatchInput

from hubspot.crm.objects.goals import BatchInputSimplePublicObjectBatchInputUpsert

```

gives the errors respectively:

```lia-code-sample
ImportError: cannot import name 'BatchInputSimplePublicObjectBatchInput' from 'hubspot.crm.objects.goals'

ImportError: cannot import name 'BatchInputSimplePublicObjectBatchInputUpsert' from 'hubspot.crm.objects.goals'

```

Why is that?

---

<div class="post-metadata">

**Author:** ![GRajput](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/grajput/32/102020_2.png) [@GRajput](https://community.hubspot.com/u/GRajput)\
**Post date:** [January 24, 2025, 10:27am UTC](https://community.hubspot.com/t/unable-to-update-goals-via-api/124643/2 "2025-01-24T10:27:59Z")

</div>

Hi @AAjenifuja

Here is the link to the goals API

> **[Accounts Dashboard | HubSpot](https://app.hubspot.com/myaccounts?next=developerdocs&redirect=%2Fapi-reference%2Fcrm-goal-targets-v3%2Fguide)**

I hope this will help you out. Please mark it as **Solution Accepted and upvote** to help another Community member.  
Thanks!

---

<div class="post-metadata">

**Author:** ![AAjenifuja](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@AAjenifuja](https://community.hubspot.com/u/AAjenifuja)\
**Post date:** [January 24, 2025, 11:52am UTC](https://community.hubspot.com/t/unable-to-update-goals-via-api/124643/3 "2025-01-24T11:52:06Z")

</div>

Hi @GRajput  
Thanks for the response, but unfortunately, it doesn’t solve the problem.  
I did follow the documentation. From the error, it appears that the functions from the goals module relating to batch updates don’t exist or cannot be used.  
I have also recently found this to be the same for the function from the same module for singular goal updates. See the code snippet below.

```lia-code-sample
# import function for singular update to goals
from hubspot.crm.objects.goals import SimplePublicObjectInput

# error received upon execution
ImportError: cannot import name 'SimplePublicObjectInput' from 'hubspot.crm.objects.goals'

```

I would like to know what the problem is.

---

<div class="post-metadata">

**Author:** ![GRajput](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/grajput/32/102020_2.png) [@GRajput](https://community.hubspot.com/u/GRajput)\
**Post date:** [January 27, 2025, 7:50am UTC](https://community.hubspot.com/t/unable-to-update-goals-via-api/124643/4 "2025-01-27T07:50:08Z")

</div>

Hi @AAjenifuja

import requests  
import json

```lia-code-sample
url = "https://api.hubapi.com/crm/v3/objects/goal_targets/goalTargetId"
payload = json.dumps({
 "objectWriteTraceId": "string",
 "properties": {
 "property_date": "1572480000000",
 "property_radio": "option_1",
 "property_number": "17",
 "property_string": "value",
 "property_checkbox": "false",
 "property_dropdown": "choice_b",
 "property_multiple_checkboxes": "chocolate;strawberry"
 }
})
headers = {
 'authorization': 'Bearer YOUR_ACCESS_TOKEN',
 'content-type': 'application/json'
}
response = requests.request("PATCH", url, headers=headers, data=payload)
print(response.text)

```

 ![GRajput_0-1737964188785.png](https://d2qpr2jzcazej7.cloudfront.net/original/2X/b/b223007fbabf1ec2fe969e8c711986720cf636c7.png)

I hope this will help you out. Please mark it as **Solution Accepted and upvote** to help another Community member.  
Thanks!

---

<div class="post-metadata">

**Author:** ![AAjenifuja](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@AAjenifuja](https://community.hubspot.com/u/AAjenifuja)\
**Post date:** [January 27, 2025, 11:47am UTC](https://community.hubspot.com/t/unable-to-update-goals-via-api/124643/5 "2025-01-27T11:47:50Z")

</div>

Hi @GRajput ,  
I tried it and got the following error:

```lia-code-sample
{
 "status":"error",
 "message":"The scope needed for this API call isn't available for public use. If you have questions, contact support or post in our developer forum.",
 "correlationId":"xxxxxxxxxxxxxxxxxxx",
 "links":{
 "support":"https://help.hubspot.com/",
 "forum":"https://community.hubspot.com/t5/APIs-Integrations/bd-p/integrations"
 },
 "category":"MISSING_SCOPES"
}

```

Suggests there’s a restriction on the relevant scope(s) which explains why it doesn’t work. I imagine others are experiencing this too.  
Is this being worked on?

---

<div class="post-metadata">

**Author:** ![GRajput](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/grajput/32/102020_2.png) [@GRajput](https://community.hubspot.com/u/GRajput)\
**Post date:** [January 27, 2025, 1:02pm UTC](https://community.hubspot.com/t/unable-to-update-goals-via-api/124643/6 "2025-01-27T13:02:23Z")

</div>

Hi @AAjenifuja

please provide this scope to your access token crm.objects.goals.read

Thanks!

---

<div class="post-metadata">

**Author:** ![AAjenifuja](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@AAjenifuja](https://community.hubspot.com/u/AAjenifuja)\
**Post date:** [January 27, 2025, 1:09pm UTC](https://community.hubspot.com/t/unable-to-update-goals-via-api/124643/7 "2025-01-27T13:09:15Z")

</div>

Hi @GRajput  
My access token already has the scope:

![AAjenifuja_0-1737983218497.png](https://d2qpr2jzcazej7.cloudfront.net/optimized/3X/5/8/58c9abef48ea9924b349de4dcf99ac0f95c207bf_2_690x37.png)

I’d actually have expected the ideal scope to be crm.objects.goals.write

---

<div class="post-metadata">

**Author:** ![GRajput](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/grajput/32/102020_2.png) [@GRajput](https://community.hubspot.com/u/GRajput)\
**Post date:** [January 28, 2025, 6:57am UTC](https://community.hubspot.com/t/unable-to-update-goals-via-api/124643/8 "2025-01-28T06:57:02Z")

</div>

Hi @AAjenifuja

Please connect with the HubSpot support team for further support.

Thanks!
